From c7bcf92f145966b2cf8f97ac95b43a474d611c97 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 23 Apr 2021 10:51:46 +0200 Subject: [PATCH] [nrf fromlist] lib: os: cbprintf: Prevent using _Generic in C++ Add guard to not use C11 specific feature when in C++. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/34516 Signed-off-by: Krzysztof Chruscinski (cherry picked from commit a51eac6c073ae943fe45fd0a8b363ba1957d7347) Signed-off-by: Trond Einar Snekvik --- include/sys/cbprintf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sys/cbprintf.h b/include/sys/cbprintf.h index 195089eb234..64a6fc74565 100644 --- a/include/sys/cbprintf.h +++ b/include/sys/cbprintf.h @@ -26,9 +26,9 @@ extern "C" { * - Clang 3.0 https://releases.llvm.org/3.0/docs/ClangReleaseNotes.html */ #ifndef Z_C_GENERIC -#if ((__STDC_VERSION__ >= 201112L) || \ +#if !defined(__cplusplus) && (((__STDC_VERSION__ >= 201112L) || \ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40900) || \ - ((__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) >= 30000)) + ((__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) >= 30000))) #define Z_C_GENERIC 1 #else #define Z_C_GENERIC 0