Closed le91688 closed 2 years ago
was looking through cmakelists and its not apparent if theres any way to disable -pendantic , but the readme says that -pendantic is not supported for newer compilers
The GCC --pedantic compiler option is not supported as of GCC-8+ because it forces non-portable code changes and because it tends to break the code base with each new GCC release.
Yeah it looks like -pedantic is enabled for recent GCC - I'm not sure if it sneaked in, or what happened, but things seem to have been building.
It is in part these endless issues with perfectly valid fallthrough that made pedantic not worthwhile. In this case there is a perfectly valid check for the [[__fallthrough__]]
attribute before using it.
Feel free to provide a patch disabling -pendantic on GCC 8+.
Note that clang is usually sensible and that pendantic warnings are useful, but when GCC is constantly breaking code and forces code to be non-portable to silence warnings, then it stops being productive.
would it make sense to disable -pedantic with -DFLATCC_PORTABLE
perhaps?
my particular issue is with clang , and gcc has been working fine
Se my PR comment. Just because your problem is in portable does not mean it can (or should be) used to fix issues with GCC versions. Next time it may be a fully C11 compliant project with up to spec glibc (if such a thing ever exists), but GCC decides that you have to write "I really mean to return from inside a while statement" in a comment. That is unrelated to portable.
OK, based on a PR discussion it has become clear that clang raises the error and not GCC. We cannot afford to remove pendantic from clang so a fix is need in pattributes.h, likely by checking the C version.
Either the detection of PORTABLE_HAS_C_ATTRIBUTE
or
#if PORTABLE_HAS_C_ATTRIBUTE(__fallthrough__)
but it is a bit strange since clang says it is OK then complains anyway.
A quick fix might be to flag-D PORTABLE_EXPOSE_ATTRIBUTES=0
.
So an update @mikkelfj !
It appears I got some wires crossed in my logs. My issue was in fact GCC 11 . I have multiple targets being built, and GCC 10 was fine, but GCC 11 threw this error (as you mentioned earlier) . I can go ahead and implement the pedantic disable for GCC over a specified version as you had mentioned and that should do the trick.
My apologies for wasting your time hunting down a clang issue :/
Fixed in #228
the following build command fails
cmake -DFLATCC_INSTALL=on -DFLATCC_RTONLY=on -DCMAKE_BUILD_TYPE=Release && make install