From 34f60877bdb54786c62fd1bf5b44a81430aa411f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 17 Jan 2025 16:48:55 +0100 Subject: [PATCH] TinyCBOR: prevent a -Wundef warning Follow the same "pattern" as for the rest of the #if directive: first test if a macro is defined, then test the value. Otherwise the code triggers a -Wundef when building in C++. Task-number: QTBUG-132900 Change-Id: Icc838bf8dfafed1ab317ff70cb19559b72b22dc9 Reviewed-by: Thiago Macieira --- src/3rdparty/tinycbor/src/compilersupport_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/tinycbor/src/compilersupport_p.h b/src/3rdparty/tinycbor/src/compilersupport_p.h index 0879801611a..4e5c38a9ad7 100644 --- a/src/3rdparty/tinycbor/src/compilersupport_p.h +++ b/src/3rdparty/tinycbor/src/compilersupport_p.h @@ -44,14 +44,14 @@ # include #endif -#if __STDC_VERSION__ >= 201112L || (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__cpp_static_assert) && __cpp_static_assert >= 200410) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__cpp_static_assert) && __cpp_static_assert >= 200410) # define cbor_static_assert(x) static_assert(x, #x) #elif !defined(__cplusplus) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && (__STDC_VERSION__ > 199901L) # define cbor_static_assert(x) _Static_assert(x, #x) #else # define cbor_static_assert(x) ((void)sizeof(char[2*!!(x) - 1])) #endif -#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* inline is a keyword */ #else /* use the definition from cbor.h */