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

Silence GCC's Wunused-function firing in compilation tests

The whole GCC kinda sucks around warnings, this is yet another place
where pragmas manipulating warnings don't work properly and thus a
warning has to be disabled globally... luckily, this time it is
happening in selftest file and thus it isn't too problematic to just
turn that warning of for the entire file.
Commit
b459bb4c431670cb3031a68f4b3cf79f631d0c48
Author
Martin Hořeňovský ·
Parents
1e16be0b9e2d

Files · Download .tar.gz

Changes

 projects/SelfTest/CompilationTests.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/projects/SelfTest/CompilationTests.cpp b/projects/SelfTest/CompilationTests.cpp
index 06d361fb..3298c79e 100644
--- a/projects/SelfTest/CompilationTests.cpp
+++ b/projects/SelfTest/CompilationTests.cpp
@@ -55,6 +55,11 @@ TEST_CASE("#833") {
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunused-function"
 #endif
+#ifdef __GNUC__
+// Note that because -~GCC~-, this warning cannot be silenced temporarily, by pushing diagnostic stack...
+// Luckily it is firing in test files and thus can be silenced for the whole file, without losing much.
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
 
 // Test containing example where original stream insertable check breaks compilation
 namespace {