Suppressing Build Warnings

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Suppressing Build Warnings

Post by devnull » Wed Jan 19, 2022 2:00 am

How can I prevent my screen from filling up with warnings such as:

Code: Select all

warning: unused variable 'ret' [-Wunused-variable]
warning: variable 'r' set but not used [-Wunused-but-set-variable]
I have checked the ESP32 idf cmake config:

Code: Select all

idf/tools/cmake/build.cmake

list(APPEND compile_options     "-ffunction-sections"
                                "-fdata-sections"
                                "-fstrict-volatile-bitfields"
                                # warning-related flags
                                "-Wall"
                                "-Werror=all"
                                "-Wno-error=unused-function"
                                "-Wno-error=unused-but-set-variable"
                                "-Wno-error=unused-variable"
                                "-Wno-error=deprecated-declarations"
                                "-Wextra"
                                "-Wno-unused-parameter"
                                "-Wno-sign-compare"
                                # always generate debug symbols (even in release mode, these don't
                                # go into the final binary so have no impact on size
                                "-ggdb")
And it seems that these errors should be surpassed, however they are not.

Is it possible to add to the MAKE command so that I can suppress all warnings that are not errors ??

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: Suppressing Build Warnings

Post by stijn » Wed Jan 19, 2022 7:14 am

And it seems that these errors should be surpassed, however they are not.
They are: -Wno-error means 'do not make this warning an error', not 'do not show this warning'.
Is it possible to add to the MAKE command so that I can suppress all warnings that are not errors ??
Not that I know off but you can suppress individual warnings with -Wno-...

http://gcc.gnu.org/onlinedocs/gcc-4.1.2 ... tions.html

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Suppressing Build Warnings

Post by dhylands » Wed Jan 19, 2022 6:25 pm

The -Werror=all turns all warnings into errors, so turning that off will allow the build to continue despite there being warnings.

-Wall enables a ton of warnings. You could try removing that to reduce the amount of warnings produced.

Post Reply