From: Michael Jeanson Date: Thu, 17 Mar 2022 17:45:51 +0000 (-0400) Subject: fix: __STDC_VERSION__ can be undefined in C++ X-Git-Url: https://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=3615ef97a1075d302b5faad557154785135b7eb7 fix: __STDC_VERSION__ can be undefined in C++ Caught on SLES12 with g++ 4.8 when enabling '-Wundef'. Change-Id: Ib027f224a4f0ef021beb1709d8a626db62fe6d9c Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h index 51491a5f..b7fd2c1c 100644 --- a/include/lttng/ust-compiler.h +++ b/include/lttng/ust-compiler.h @@ -68,7 +68,7 @@ #ifdef __cplusplus #define lttng_ust_static_assert(predicate, msg, c_identifier_msg) \ static_assert(predicate, msg) -#elif __STDC_VERSION__ >= 201112L +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #define lttng_ust_static_assert(predicate, msg, c_identifier_msg) \ _Static_assert(predicate, msg) #else diff --git a/tests/utils/tap.h b/tests/utils/tap.h index 60455a07..f9f423ee 100644 --- a/tests/utils/tap.h +++ b/tests/utils/tap.h @@ -28,7 +28,7 @@ skip(n, fmt, ## __VA_ARGS__); \ continue; \ } -#elif __STDC_VERSION__ >= 199901L /* __GNUC__ */ +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* __GNUC__ */ # define ok(e, ...) ((e) ? \ _gen_result(1, __func__, __FILE__, __LINE__, \ __VA_ARGS__) : \