Following the recent addition of the -Wfloat-conversion compiler flag, I wanted to find out which other compiler checks are available. Obtaining all of the ones not covered by "-Wall -Wextra -Wpedantic" is not easy given that new compiler versions add new flags. So I used the list from https://kuczma.dev/articles/gcc-wall/ and checked whether the warnings could be useful for us.
I think the -Wmissing-declarations option is useful for us to detect which functions are missing the "static" keyword. (With this keyword, they are invisible to other compilation units.) I created a PR that enables this flag, adds the missing "static" declarations and also removes an unused (static) function: https://github.com/aibasel/downward/pull/171
The -Wswitch-default flag could be useful for us: we're missing the default case in many switch statements over enums and could abort with a warning in the default case. Hitting the default case can happen if we add a value to the enum option, but forget to adapt the switch statement. If someone wants to tackle this, go ahead :)
The other warnings and why I wouldn't argue for their addition:
-Wshadow: we shadow variable names in very many places.
-Wdouble-promotion: only useful for old systems.
-Wfloat-equal: we have many comparisons to infinity or 0.
-Wformat-nonliteral -Wformat-security -Wformat-signedness: we don't use printf.
Do you agree that the -Wmissing-declarations flag is useful? Can someone have a look at the pull request, please?
|