Disable compiler warnings with pragma GCC diagnostic in LTO builds

243 Views Asked by At

I'm having troubles disabling GCC warnings with LTO-enabled builds:

Some warnings (-Wstrict-overflow, -Wmaybe-uninitialized, ...) are specified on the command line using the -W option switch for compiling all files within a project. However, I'd like to disable them just on some specific code locations.

Without LTO mode, "#pragma GCC diagnostic ignored" (along with #pragma push & pop) works smoothly. However, those pragma declarations seem to be ignored when the compiler is invoked back at link stage (LTO build).

Is there a workaround, or a better way to disable specific warning in specific code locations?

Many thanks in advance :)

0

There are 0 best solutions below