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 <[email protected]>
(cherry picked from commit a51eac6c073ae943fe45fd0a8b363ba1957d7347)
Signed-off-by: Trond Einar Snekvik <[email protected]>
  • Loading branch information
nordic-krch authored and trond-snekvik committed Apr 23, 2021
1 parent 9e7d05e commit c7bcf92
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 c7bcf92

Please sign in to comment.