Duplicate warnings on build

I have a project in CPP which consist of 8 source files, and 3 external libraries. My source files are pretty small, few hundreds lines in each maximum. Using the RP2040 (Pico). I seem to have two problems, or at least what I deem problems, and they may be related.

First, a full build takes FOREVER. The one I just ran was 715 seconds, which is crazy to me, as I have Visual Studio .net solutions with hundreds of source files scattered in 20 separate projects, and hundreds of thousands of lines of code which do a full build in under 60 seconds.

In the output terminal, I get a ton of warnings, but the odd thing is, the warning repeat for the same file and the same line, hundreds of times. For example, in the TFT_eSPI library, I get:

The app finally builds successfully, but I’m wondering if there’s some sort of optimization I can do to both eliminate these warnings (or at least, eliminate the duplicate warnings) and speed this up at the same time. In the end I get a total of 36 warnings from all of the libraries I’m using, as shown here:

What is your exact platformio.ini?

Sorry, should have known better!

[env:pico]
platform = raspberrypi
board = pico
framework = arduino
monitor_speed = 115200
build_type = release
lib_ldf_mode = chain+
lib_extra_dirs = C:\Projects\Microcontroller\Libraries\
lib_deps =  
	fastled/FastLED@^3.6.0
	bodmer/TFT_eSPI@^2.5.34
	https://github.com/takkaO/OpenFontRender.git

build_flags = 
	-D ENV_PICO
	-D USER_SETUP_LOADED=1
	-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup60_RP2040_ILI9341.h
	-fexceptions
	-Wvla
	-Wignored-qualifiers
build_src_flags = -Wvla -Wignored-qualifiers
build_unflags = -fno-exceptions

I’ve tried to eliminate the warnings with build flags but that seems to have no effect either

But… with these you are exactly adding those warnings. Or you like those warning to be applied to your source code, not to any library or framework depenedncies? (In which case Silence warnings for dependencies / external libraries? would be useful)

Also https://registry.platformio.org/libraries/bodmer/TFT_eSPI/versions has newer versions available, maybe you want to hard-pin a higher version (or delete the .pio folder to make PIO redownload the latest versions complying to that version string).

I would like to silence the warnings. For some reason I thought adding those build flags would silence them, not include them. The warnings happen (e.g. the Wvla) whether I have those build flags or not.

I saw that post, and now that I understand (correct me if I’m wrong) that “-Wvla” forces the compiler to INCLUDE those warnings, not exclude them, right? So I guess the question would be whether that’s the expected default behavior?

Exactly. If you wanted to supress the warning, you would have to chose the -Wno-<warning type> form, i.e.,

build_flags = 
	-D ENV_PICO
	-D USER_SETUP_LOADED=1
	-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup60_RP2040_ILI9341.h
	-fexceptions
	-Wno-vla
	-Wno-ignored-qualifiers

Ah, got it!

Any ideas on the duplicate warnings of the same line, or is that expected?

Per this the warnings occur on all different lines, these are the lines where the macro is used (even if they all lead to the same macro defined on one line). So, it’s the usages that get tagged with macros.