Hi, I'm new to the Intel compiler having previously used Visual Studio C++ compiler. With VS we would use a #pragma to disable various warnings just before including third party headers but then re-enable them after inclusion (there's no way we can fix those warnings and we don't want our output flooded with things we can't change as it makes it harder to see things we are doing wrong ourselves).
I'm looking for a similar way to temporarily disable remarks/warnings/numbered messages around header includes, but leave them enabled for our own code so we can avoid making those mistakes? I've only seen compiler options that disable them for the entire compilation unit.
We find this genuinely useful but if it's not considered good practise I'm happy to hear why.
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Parallel Computing
You can use #pragma warning push/pop to surround the #include to suppress most warnings. There are some warnings that can't be suppressed this way due to compiler scope issues.
#pragma warning push
#pragma warning disable M N P ... // M N P are the warning numbers that you want to suppress
#pragma warning pop