]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Tests: tuktest.h: Treat Clang separately from GCC.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 14 Feb 2024 19:11:49 +0000 (21:11 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 14 Feb 2024 19:12:58 +0000 (21:12 +0200)
Don't assume that Clang defines __GNUC__ as the extensions
are available in clang-cl as well (and possibly in some other
Clang variants?).

tests/tuktest.h

index 5a8a916964042dcedeb6c9929d966dc0d7ac9a4c..12abd532462f45c43afb0a7cfe7655d0501f89a0 100644 (file)
@@ -4,7 +4,7 @@
 //
 /// \file       tuktest.h
 /// \brief      Helper macros for writing simple test programs
-/// \version    2023-01-08
+/// \version    2024-02-14
 ///
 /// Some inspiration was taken from Seatest by Keith Nicholas and
 /// from STest which is a fork of Seatest by Jia Tan.
 
 // This is silencing warnings about unused functions. Not all test programs
 // need all functions from this header.
-#if TUKTEST_GNUC_REQ(3, 0)
+#if TUKTEST_GNUC_REQ(3, 0) || defined(__clang__)
 #      define tuktest_maybe_unused __attribute__((__unused__))
 #else
 #      define tuktest_maybe_unused
 #endif
 
 // We need printf("") so silence the warning about empty format string.
-#if TUKTEST_GNUC_REQ(4, 2)
+#if TUKTEST_GNUC_REQ(4, 2) || defined(__clang__)
 #      pragma GCC diagnostic ignored "-Wformat-zero-length"
 #endif