Go Down

Topic: Warning Levels (Read 1 time) previous topic - next topic

SerafinaPekkala

I use the Arduino IDE 1.6.12 and I wrote some code like this:

Code: [Select]

void myfunc()
{
  // do something
  return(1);
}


And my warning levels are at Maximum, I think (from platform.txt):

Code: [Select]

compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flagsall=-Wall -Wextra


So I should get at least a warning, if not an error on compiling the code.
But my compiler is fine with the code and that worries me a lot.

Does anyone know, what I con do to get at least warnings for those conflicts?

pert

Those properties in platform.txt only define the flags for the various compiler warnings settings. You actually need to turn them on in File > Preferences > Compiler Warnings. Unfortunately that preference defaults to "None" I recommend always having that option set to "All", which will do -Wall -Wextra.

Code: [Select]

compiler.warning_flagsall=-Wall -Wextra

That should be:
Code: [Select]
compiler.warning_flags.all=-Wall -Wextra
Note yours is missing a period.

SerafinaPekkala

Thanks, I never saw that in the Preferences.
Now I set my warning level to "All" but the compiler still runs with it.

pert

By "still runs with it", do you mean that you get a warning but no compilation error? The reason for this is the -fpermissive compiler flag, which was added in Arduino AVR Boards 1.6.12 (Arduino IDE 1.6.10). The flag may have been added to some other cores, following the lead of Arduino AVR Boards. That flag was added because the compiler update done in that release upgraded some things that were previously warnings to errors. Unfortunately the flag also downgraded some things (like this) that used to be errors to warnings.

Reference:
https://github.com/arduino/ArduinoCore-avr/commit/06868f4cd39a9dba82b5014d1208feb1e1f0d750

Note that it says "It may possibly be removed in
the future after a period of transition.' so to future-proof your code you should definitely try to fix all warnings.

SerafinaPekkala

What I wanted to say is: I changed my warning level to "All".

Nevertheless I do not get a warning or a compilation error about the above mentioned function and that worries me.
And I do not get warnings of unused variables, but thats another topic.

pert

What do you have selected in the Arduino IDE's Tools > Board menu?

Go Up