Turn off compiler warning certain case

In certain cases the uninitialized variable warning is unnecessary and I would like to suppress this warning like <pragma warn-off=uninitialized_variable>
Code is in c++
I tried the

build_unflags = 

in platformio.ini but it didn’t help.
Is there any opportuinity to place some inline hint like

/// <-W maybe-uninitialized>
int intentionally_not_initialized_variable;


Yes, per GCC manuals (example).

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "maybe-uninitialized"

int intentionally_not_initialized_variable;

#pragma GCC diagnostic pop

Are you sure the compiler flags had -Wmaybe-uninitialized in them to begin with? If not, this is effectless. That warning category may have been activated by something like -Wall, -Wextra, etc. If you want to supress a specific warning, you should use the -Wno-<warning type> flag instead.

build_flags = -Wno-maybe-uninitialized

Again, all of this is written in

1 Like

Thanks a lot, I’ll do that.