Skip to content

Commit

Permalink
Check for C standard version >= 23 for [[__fallthrough__]]
Browse files Browse the repository at this point in the history
This avoids warnings with clang-18+ e.g.

pprintint.h:256:6: error: [[]] attributes are a C23 extension [-Werror,-Wc23-extensions]

Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj committed Feb 2, 2024
1 parent 1653ec9 commit 7c199e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/flatcc/portable/pattributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C" {


/* https://en.cppreference.com/w/c/language/attributes/fallthrough */
#if PORTABLE_HAS_C_ATTRIBUTE(__fallthrough__)
#if PORTABLE_HAS_C_ATTRIBUTE(__fallthrough__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
# define pattribute_fallthrough [[__fallthrough__]]
#elif PORTABLE_HAS_ATTRIBUTE(__fallthrough__)
# define pattribute_fallthrough __attribute__((__fallthrough__))
Expand Down

0 comments on commit 7c199e3

Please sign in to comment.