compiler warnings

What could be included in further releases, or for the forum.
Post Reply
User avatar
Rick Kimball
Posts: 951
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

compiler warnings

Post by Rick Kimball » Wed May 06, 2015 4:48 pm

@RogerClark So I'm not sure if you want suggestions here on the forum or in the issues feature of github.com. I'll put this one here and you can let us know.

There is a feature I just noticed (not sure when it got added I'm using Arduino 1.6.4 compiled from source) in preference box:

Compiler warnings: "None|Default|More|All"

If you add this to the platform.txt before the compiler section:

Code: Select all

# compiler warning variables
# ----------------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
And then change the "-w" in the c and cpp flags to:

Code: Select all

compiler.c.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
and

Code: Select all

compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
Once that change is made, the user can select different levels of compiler warnings. Just testing on a few example sketches reveals a lot of warnings that probably should be addressed. If nothing else, it shows more friendly warnings and errors without having to resort to the "Show verbose output during compilation" option.

-rick
-rick

User avatar
RogerClark
Posts: 6397
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: compiler warnings

Post by RogerClark » Thu May 07, 2015 11:21 am

Rick,

Sounds like a good idea, but I'll initially put it in a branch for people to test.

I can't do it now, as its getting late'ish and I've only just fixed an issue with Maple RET6 and also updated all the board.cpp files for the PIN_MAP change

But I will look at it tomorrow.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest