From 09e0e70888089f7ad48d6a5b88fea6fd32701600 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 17 Mar 2022 13:45:51 -0400 Subject: [PATCH] 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 --- include/lttng/ust-compiler.h | 2 +- tests/utils/tap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 b3e94450..e628795e 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__) : \ -- 2.34.1