1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Tests: tuktest.h: Treat Clang separately from GCC.

Don't assume that Clang defines __GNUC__ as the extensions
are available in clang-cl as well (and possibly in some other
Clang variants?).
This commit is contained in:
Lasse Collin 2024-02-14 21:11:49 +02:00
parent cce7330b9f
commit 5394a1665b

View file

@ -4,7 +4,7 @@
// //
/// \file tuktest.h /// \file tuktest.h
/// \brief Helper macros for writing simple test programs /// \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 /// Some inspiration was taken from Seatest by Keith Nicholas and
/// from STest which is a fork of Seatest by Jia Tan. /// from STest which is a fork of Seatest by Jia Tan.
@ -155,14 +155,14 @@
// This is silencing warnings about unused functions. Not all test programs // This is silencing warnings about unused functions. Not all test programs
// need all functions from this header. // 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__)) # define tuktest_maybe_unused __attribute__((__unused__))
#else #else
# define tuktest_maybe_unused # define tuktest_maybe_unused
#endif #endif
// We need printf("") so silence the warning about empty format string. // 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" # pragma GCC diagnostic ignored "-Wformat-zero-length"
#endif #endif