From 977bd56eaafc3e46563919ebac1d8ddf50d3bbfc Mon Sep 17 00:00:00 2001 From: Lexi Mayfield Date: Thu, 28 Dec 2023 17:27:40 -0500 Subject: [PATCH] Don't sanitize gtest, use permissive- on MSVC --- include/lexio/bufwriter.hpp | 18 +++++++++++++----- tests/CMakeLists.txt | 8 +------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/lexio/bufwriter.hpp b/include/lexio/bufwriter.hpp index 4d96699..c554886 100644 --- a/include/lexio/bufwriter.hpp +++ b/include/lexio/bufwriter.hpp @@ -61,11 +61,20 @@ class FixedBufWriter WRITER &&Writer() && { return std::move(m_wrapped); } - size_t LexRead(uint8_t *outDest, const size_t count) { return Read(m_wrapped, outDest, count); } + std::enable_if_t, size_t> LexRead(uint8_t *outDest, const size_t count) + { + return Read(m_wrapped, outDest, count); + } - BufferView LexFillBuffer(const size_t count) { return FillBuffer(m_wrapped, count); } + std::enable_if_t, BufferView> LexFillBuffer(const size_t count) + { + return FillBuffer(m_wrapped, count); + } - void LexConsumeBuffer(const size_t count) { ConsumeBuffer(m_wrapped, count); } + std::enable_if_t, void> LexConsumeBuffer(const size_t count) + { + ConsumeBuffer(m_wrapped, count); + } size_t LexWrite(const uint8_t *src, const size_t count) { @@ -99,8 +108,7 @@ class FixedBufWriter Flush(m_wrapped); } - template >> - size_t LexSeek(const SeekPos pos) + std::enable_if_t, size_t> LexSeek(const SeekPos pos) { LexFlush(); return Seek(m_wrapped, pos); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e25b42e..d49238a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -59,14 +59,8 @@ if(WERROR_CXX20_EXTENSIONS) target_compile_options(lexio_test PRIVATE "-Werror=c++20-extensions") endif() -add_sanitizers(Catch2) -if(MSVC AND SANITIZE_ADDRESS) - target_compile_definitions(Catch2 PUBLIC "_DISABLE_VECTOR_ANNOTATION") - target_compile_definitions(Catch2 PUBLIC "_DISABLE_STRING_ANNOTATION") -endif() - if(MSVC) - target_compile_options(lexio_test PUBLIC /W4 /D_DISABLE_VECTOR_ANNOTATION) + target_compile_options(lexio_test PUBLIC /W4 /permissive-) else() target_compile_options(lexio_test PUBLIC -Wall -Wextra -Wno-unknown-pragmas) endif()