Instead of bothering with coverity/sonarcloud, we should consider enabling more compiler warnings for better quality code. Currently we only use "-Wall", which enables the conservative warnings.
Try out these:
"-Wshadow" for shadowed variables (we have lots of these)
"-Wformat=2" for better printf() etc. format checks
"-Wuninitialized" for checking if something has been left uninitialized
"-Wfloat-equal" since we shouldn't really be doing equality checks on floats anyways
"-Wcast-qual" for lost qualifiers, etc. missing const.
"-Wpointer-arith" this seems to be recommended, as it helps making sure code works on other compilers than gcc too
"-Wwrite-strings" for string copy mistakes
I haven't tried any of the above yet, and some (all?) might be too zealous. These should be tested one at a time and see how much we would have to rewrite (and if they are worth it).
Instead of bothering with coverity/sonarcloud, we should consider enabling more compiler warnings for better quality code. Currently we only use "-Wall", which enables the conservative warnings.
Try out these:
I haven't tried any of the above yet, and some (all?) might be too zealous. These should be tested one at a time and see how much we would have to rewrite (and if they are worth it).
Any other flags ?