dvidelabs / flatcc

FlatBuffers Compiler and Library in C for C
Apache License 2.0
631 stars 180 forks source link

Check for C standard version >= 23 for [[__fallthrough__]] #273

Closed kraj closed 5 months ago

kraj commented 5 months ago

This avoids warnings with clang-18+ e.g.

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

mikkelfj commented 5 months ago

Thanks. I wonder if it is better to check for __has_c_attribute ? https://clang.llvm.org/docs/LanguageExtensions.html#has-c-attribute https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fc_005fattribute.html

kraj commented 5 months ago

Thanks. I wonder if it is better to check for __has_c_attribute ? https://clang.llvm.org/docs/LanguageExtensions.html#has-c-attribute https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fc_005fattribute.html

it will still warn because the check will pass as clang extension even for pre c23 standard case