Warning on compilation


I'm using samr21-xpro and I tried to add same warning options than Atmel Studio for RIOT:

-pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500

I got long list of warnings. Why RIOT does not used all the warning options?


Hi Baptiste,

using '-Wall -Wextra' by default was finally added just two days ago https://github.com/RIOT-OS/RIOT/pull/7919/. But maybe other warnings could be interesting to add you are right. I like statically checking as many things as possible.

"All the warnings options", depends on the compiler version of each target, and gcc or clang, so may not all be available. Also, some warnings may be problematic for us if they are often just false positive.

If you found warnings that could be a good idea to fix, you can propose a PR with them, this way its easier to review with the CI build output.

In the list, not all are adding warnings, like '-pipe' or '-std=gnu99', -ffunctions-sections (which is already used). And also -fno-strict-aliasing which removes important check.

Cheers, Gaƫtan