From c3fda661954922ea37e5df50df385941c681bb69 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Sat, 18 May 2024 10:03:33 +0100 Subject: [PATCH] attempt fix --- CMakeLists.txt | 3 --- unittests/CppInterOp/ScopeReflectionTest.cpp | 20 +++++++++---------- .../CppInterOp/VariableReflectionTest.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aeb996030..13fd0314b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,9 +327,6 @@ include_directories(BEFORE SYSTEM #Removes flag due to issue with Google test download when LLVM_ENABLE_WERROR=On string(REPLACE "-Wcovered-switch-default" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -#FIXME: Allows the use of [[maybe_unused]] in C++ tests -string(REPLACE "-Wc++17-attribute-extensions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - file(STRINGS "VERSION" CPPINTEROP_VERSION) string(REGEX MATCH "([0-9]*)\.([0-9]*)\.([0-9]*)" CPPINTEROP_VERSION_ONLY "${CPPINTEROP_VERSION}") set(CPPINTEROP_VERSION_MAJOR "${CMAKE_MATCH_1}") diff --git a/unittests/CppInterOp/ScopeReflectionTest.cpp b/unittests/CppInterOp/ScopeReflectionTest.cpp index 6cb7d9c0e..a00b1eeda 100644 --- a/unittests/CppInterOp/ScopeReflectionTest.cpp +++ b/unittests/CppInterOp/ScopeReflectionTest.cpp @@ -661,23 +661,23 @@ TEST(ScopeReflectionTest, IsSubclass) { TEST(ScopeReflectionTest, GetBaseClassOffset) { std::vector Decls; #ifdef _WIN32 -#define maybeunused +#define maybeunused int #elif __linux__ -#define maybeunused +#define maybeunused int #else -#define maybeunused [[maybe_unused]] +#define maybeunused [[maybe_unused]] int #endif #define Stringify(s) Stringifyx(s) #define Stringifyx(...) #__VA_ARGS__ #define CODE \ - class A { maybeunused int m_a; }; \ - class B { maybeunused int m_b; }; \ - class C : virtual A, virtual B { maybeunused int m_c; }; \ - class D : virtual A, virtual B, public C { maybeunused int m_d; }; \ - class E : public A, public B { maybeunused int m_e; }; \ - class F : public A { maybeunused int m_f; }; \ - class G : public F { maybeunused int m_g; }; + class A { maybeunused m_a; }; \ + class B { maybeunused m_b; }; \ + class C : virtual A, virtual B { maybeunused m_c; }; \ + class D : virtual A, virtual B, public C { maybeunused m_d; }; \ + class E : public A, public B { maybeunused m_e; }; \ + class F : public A { maybeunused m_f; }; \ + class G : public F { maybeunused m_g; }; CODE; diff --git a/unittests/CppInterOp/VariableReflectionTest.cpp b/unittests/CppInterOp/VariableReflectionTest.cpp index 8c8a86f9f..875871cb1 100644 --- a/unittests/CppInterOp/VariableReflectionTest.cpp +++ b/unittests/CppInterOp/VariableReflectionTest.cpp @@ -92,16 +92,16 @@ TEST(VariableReflectionTest, GetVariableType) { } #ifdef _WIN32 -#define maybeunused +#define maybeunused const int #elif __linux__ -#define maybeunused +#define maybeunused const int #else -#define maybeunused [[maybe_unused]] +#define maybeunused [[maybe_unused]] const int #endif #define CODE \ int a; \ - maybeunused const int N = 5; \ + maybeunused N = 5; \ class C { \ public: \ int a; \