Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More compiler warnings #431

Open
katajakasa opened this issue Dec 29, 2021 · 0 comments
Open

More compiler warnings #431

katajakasa opened this issue Dec 29, 2021 · 0 comments

Comments

@katajakasa
Copy link
Member

katajakasa commented Dec 29, 2021

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).

Any other flags ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant