airbus-seclab / c-compiler-security

Security-related flags and options for C compilers
https://airbus-seclab.github.io/c-compiler-security/
Creative Commons Attribution Share Alike 4.0 International
184 stars 16 forks source link

Invalid -Wlogical-op option for clang #17

Closed egirault closed 3 years ago

egirault commented 3 years ago

Hello, Thanks for this repo, it's great! I think there is a small error in the clang TL;DR section of the README; it seems that the -Wlogical-op option is GCC only and is not supported by clang. It is not listed in the reference. This is what I get with clang-12 -Wlogical-op foo.c -o foo:

warning: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Wunknown-warning-option]
trou commented 3 years ago

Indeed, thanks for spotting it! For reference, it was due to a bad grep, clang supports -Wlogical-op-parentheses, which is enabled by -Wparentheses (the equivalent of -Wlogical-op for GCC), whic is included in -Wall.