Skip to content

Commit

Permalink
[nrf fromlist] lib: os: cbprintf: Prevent using _Generic in C++
Browse files Browse the repository at this point in the history
Add guard to not use C11 specific feature when in C++.

Upstream PR: zephyrproject-rtos/zephyr#34516

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit eadf2fe8f4906d30400f6f8178c4593cac34852d)
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
  • Loading branch information
nordic-krch authored and trond-snekvik committed Apr 27, 2021
1 parent 97cb292 commit 466fb1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/sys/cbprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 466fb1f

Please sign in to comment.