Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

conditionally compile GCC pragmas

Commit
d5fbe2ec5dcc2382afcd44a09cd4cb93c7464dd0
Author
Phil Nash ·
Parents
5bc030ddd7e6

Files · Download .tar.gz

Changes

 projects/SelfTest/ConditionTests.cpp | 5 ++++-
 projects/SelfTest/ExceptionTests.cpp | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp
index 0d1389eb..17de55f7 100644
--- a/projects/SelfTest/ConditionTests.cpp
+++ b/projects/SelfTest/ConditionTests.cpp
@@ -213,9 +213,11 @@ TEST_CASE(  "./succeeding/conditions/int literals",
 // Disable warnings about sign conversions for the next two tests
 // (as we are deliberately invoking them)
 // - Current only disabled for GCC/ LLVM. Should add VC++ too
+#ifdef  __GNUC__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wsign-compare"
 #pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
 
 TEST_CASE(  "./succeeding/conditions//long_to_unsigned_x",
             "comparisons between int variables" )
@@ -261,8 +263,9 @@ TEST_CASE(  "./succeeding/conditions/computed ints",
      CHECK( 54 == 6*9 );
 }
 
+#ifdef  __GNUC__
 #pragma GCC diagnostic pop
-
+#endif
 
 inline const char* returnsConstNull(){ return NULL; }
 inline char* returnsNull(){ return NULL; }
diff --git a/projects/SelfTest/ExceptionTests.cpp b/projects/SelfTest/ExceptionTests.cpp
index 6165decf..bf02e2dd 100644
--- a/projects/SelfTest/ExceptionTests.cpp
+++ b/projects/SelfTest/ExceptionTests.cpp
@@ -113,8 +113,10 @@ TEST_CASE_NORETURN( "./failing/exceptions/custom/double", "Unexpected custom exc
     throw double( 3.14 );
 }
 
+#ifdef  __GNUC__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
 
 TEST_CASE( "./failing/exceptions/in-section", "Exceptions thrown from sections report file/ line or section" )
 {
@@ -127,7 +129,9 @@ TEST_CASE( "./failing/exceptions/in-section", "Exceptions thrown from sections r
     }
 }
 
+#ifdef  __GNUC__
 #pragma GCC diagnostic pop
+#endif
 
 TEST_CASE( "./succeeding/exceptions/error messages", "The error messages produced by exceptions caught by Catch matched the expected form" )
 {