- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having a few problems with the intel compiler XE 12.1. When I compile using boost I get some 20000 warnings from within the boost headers, even though at every location I have included boost I disabled warnings like so:
#pragma warning(push, 0)
#include
#pragma warning(pop)
I'm also getting warnings from Ogre3D where I did the same thing so I assume this approach isn't working at all. Does the intel compiler use its own comparable method of disabling warnings temporarily?
Note that I don't want to disable all warnings, just the ones coming from external headers.
Thanks
#pragma warning(push, 0)
#include
#pragma warning(pop)
I'm also getting warnings from Ogre3D where I did the same thing so I assume this approach isn't working at all. Does the intel compiler use its own comparable method of disabling warnings temporarily?
Note that I don't want to disable all warnings, just the ones coming from external headers.
Thanks
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...For real system headers there exist other approaches, but they are limited and won't work with arbitrary 3rd party headers...
What exactly do you mean?
Best regards,
Sergey
Link Copied
22 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can I get some kind of response here, please? I can only find information on how to disable warnings completely- not what I'm looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the only solution coming close to this is the following:
For each unwanted warning by #XXX do...
#pragma warning(disable:XXX)
...before including. You already combined this with #pragma push/pop which would make sense here to restrict the filter to just the included source/header.
Even if you have thousands of warnings to filter out, most of them share the same warning #'s. In reality you'll only need some of the #pragma warning filters to silence the include directive because of lot's of duplicate warnings.
Neither ICC nor GCC allow you to disable all warnings at once for just some sections of a compilation unit.
ICC offers to disable warnings by #'s. Newer GCC versions (AFAIK 4.6.2+) implement a #pragma GCC diagnostic that's working similar.
In both cases, however, there's no wild-card for all warnings. Hence you always have to specify exactly what warnings are not desired, either by section, using #pragma push/pop & warning, or globally by using compiler options.
Best regards,
Georg Zitzlsberger
the only solution coming close to this is the following:
For each unwanted warning by #XXX do...
#pragma warning(disable:XXX)
...before including. You already combined this with #pragma push/pop which would make sense here to restrict the filter to just the included source/header.
Even if you have thousands of warnings to filter out, most of them share the same warning #'s. In reality you'll only need some of the #pragma warning filters to silence the include directive because of lot's of duplicate warnings.
Neither ICC nor GCC allow you to disable all warnings at once for just some sections of a compilation unit.
ICC offers to disable warnings by #'s. Newer GCC versions (AFAIK 4.6.2+) implement a #pragma GCC diagnostic that's working similar.
In both cases, however, there's no wild-card for all warnings. Hence you always have to specify exactly what warnings are not desired, either by section, using #pragma push/pop & warning, or globally by using compiler options.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Warnings are normally suppressed if they occur in "system" headers, so if you could convince icpc that
this was a system header, either by including the directory with -Isys instead of -I or putting a
#pragma system_header
before the inclusion that might work for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...#pragma system_header
This is a C/C++ compiler specific directive. For example, VS C/C++ compilerdoesn't support it:
Warning C4068: Unknown pragma
Just verified with VS 2005.
The Boost is a large library with hundreds ofh\cpp filesand ifa software developer decides tofollow your
way the directiveshould bemanually addedto every header file. Then, situation escalates when updates for
Boost are need to be done.
This is a C/C++ compiler specific directive. For example, VS C/C++ compilerdoesn't support it:
Warning C4068: Unknown pragma
Just verified with VS 2005.
The Boost is a large library with hundreds ofh\cpp filesand ifa software developer decides tofollow your
way the directiveshould bemanually addedto every header file. Then, situation escalates when updates for
Boost are need to be done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The other option I mentioned is to get our driver to recognize the Boost include directories as system include directories. Unfortunately Microsoft/icl doesn't have a "-isystem" option like GNU/icc but you can
add the Boost include directories toyour INCLUDE environment variable (instead of using -I)to accomplish the same thing. The header files need to have been included with angle brackets not quotes.
We have done a lot of work in the last release to try to downgrade warnings to be compatible with Microsoft. If you give us some examples of the warnings you are seeing that would be helpful in making us more compatible.
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...The other option I mentioned is to get our driver to recognize the Boost include directories as system
>>include directories.
Could you provide more technicaldetails regarding your statement about some driver, please?
>>include directories.
Could you provide more technicaldetails regarding your statement about some driver, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sergey,
Judy is talking about the compiler driver which is what you invoke as user in first place (icl/icc/icpc/ifort etc.). It handles and checks all the arguments/options you provide and finally kicks-off compilation.
It also manages what tools to use, e.g. GNU linker after compilation or managing IPO phases.
Best regards,
Georg Zitzlsberger
Judy is talking about the compiler driver which is what you invoke as user in first place (icl/icc/icpc/ifort etc.). It handles and checks all the arguments/options you provide and finally kicks-off compilation.
It also manages what tools to use, e.g. GNU linker after compilation or managing IPO phases.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
Best regards,
Sergey
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FWIW
I was having problems with Boost 1.46. Found a reference on Krill's Blog suggesting retrograding to Boost 1.42. This works for me.
Jim Dempsey
I was having problems with Boost 1.46. Found a reference on Krill's Blog suggesting retrograding to Boost 1.42. This works for me.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are there any other solutions that could allow us to solve this in code? The INCLUDE env var solution is pretty cumbersome and hard to maintain in a production environment. We get large numbers of warnings when #including Windows.h from the Windows SDK and some other headers we have no control over. Every other commercial compiler can do this (e.g. GCC, Green Hills, VC++, Code Warrior, clang, RVCT, SN, and all other EDG variants we're aware of).
Thanks.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using the following cmd to get all the supported diagnostic control options supported by Intel C++:
>> icl /? diagnostics
You'll see the following that can be used to disable the warnings at compile time:
Windows:
/Qdiag-disable:w1,w2,w3
Linux:
-diag-disable:w1,w2,w3
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I probably wasn't clear enough in what I was asking. I was asking what the original poster was asking: for a way to disable (and re-enable) all warnings in code.
The reason why is we need to #include some third party code (which may or may not be system headers) which generates an unknowable and potentially changing-over-time set of warnings. The only practical solution I can think of is to do this, as silly as it seems:
#if defined(_INTEL_COMPILER)
#pragma warning(disable:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...) and list nearly every warning of significance there is.
#endif
#include
#if defined(_INTEL_COMPILER)
what do I do here?
I can't find documentation for how to restore the original set of warnings.
#pragma warning(enable) doesn't work because it could enable something that wasn't originally set.
#endif
Thanks.
The reason why is we need to #include some third party code (which may or may not be system headers) which generates an unknowable and potentially changing-over-time set of warnings. The only practical solution I can think of is to do this, as silly as it seems:
#if defined(_INTEL_COMPILER)
#pragma warning(disable:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...) and list nearly every warning of significance there is.
#endif
#include
#if defined(_INTEL_COMPILER)
what do I do here?
I can't find documentation for how to restore the original set of warnings.
#pragma warning(enable) doesn't work because it could enable something that wasn't originally set.
#endif
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try experimenting with the following:
#if defined(_INTEL_COMPILER)
#pragma warning(suppress:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...)
{
#endif
#include
#if defined(_INTEL_COMPILER)
}
#endif
--------------------------------------------
#if defined(_INTEL_COMPILER)
#pragma warning(disable:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...) and list nearly every warning of significance there is.
#endif
#include
#if defined(_INTEL_COMPILER)
#pragma warning(default:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...)
#endif
--------------------
default may not be what you want.
It would be nice if there were a push/pop. Since the compiler supports "suppress", push and pop are already there - but you do not have keywords directives to access them.
Jim Dempsey
#if defined(_INTEL_COMPILER)
#pragma warning(suppress:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...)
{
#endif
#include
#if defined(_INTEL_COMPILER)
}
#endif
--------------------------------------------
#if defined(_INTEL_COMPILER)
#pragma warning(disable:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...) and list nearly every warning of significance there is.
#endif
#include
#if defined(_INTEL_COMPILER)
#pragma warning(default:1, 2, 3, 4, 5, ... 1000, 1001, 1002, ...)
#endif
--------------------
default may not be what you want.
It would be nice if there were a push/pop. Since the compiler supports "suppress", push and pop are already there - but you do not have keywords directives to access them.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are there any other solutions that could allow us to solve this in code?...
I think the best solution is to fix all these warnings at the root.However, I really don't understand why do you get
a large number of warnings from Windows.h header file.
I also use Windows.h all over the projects ( almost 50 ),a default "Warnings Level" is 4 ( the highest ) and a number of
warnings is always 0.
Could you be more specific regarding thesewarning messages?
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, but I can't fix Microsoft's warnings nor warnings from other third party code. The highest warning level is actually not 4 but rather something like (-W4 -Wall -diag-error warn,remark) or -W5, and that's partly why we get so many. See http://software.intel.com/en-us/articles/how-to-handle-warnings-message-in-compiler/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, but I can't fix Microsoft's warnings nor warnings from other third party code...
Please attach a C++ compiler output with as many as possible warning messages.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Paul Pedriana
Thanks for the link.
The article is good but, unfortunately, it misses a very important part, that is how to control warnings and remarks in sources. For example, how could I disable in a source file (!) a warning:
...
Warning #673: the initial sequence of preprocessing directives is not compatible with those of precompiled header file "Debug\
...
The same question is for Intel C++ compilerremarks...
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
from top of my head neither GCC* nor Microsoft Visual Studio* compiler allow wild-cards for ignoring all warnings. In any case you need to specify exactly what you want to ignore.
We follow this convention and the proposed model is the following, for Intel Compiler on both Linux* and Windows*:
#pragma warning(push)
#pragma warning(disable : 1 2 3 4)
#include "3rdparty.h" // ignores warnings #1, #2, #3 & #4
#pragma warning(pop)
#include "mine.h"
The first pragma (push) stores the current warning setup and the last one (pop) restores it. In between you can freely disable (or otherwise change) the warnings.
If you know of any other patterns from other compilers that would work better here, let me know so we can ask for implementing them as well.
Up to now I think the solution above is the best approach, provided you also want to silence non-system headers. For real system headers there exist other approaches, but they are limited and won't work with arbitrary 3rd party headers.
Best regards,
Georg Zitzlsberger
from top of my head neither GCC* nor Microsoft Visual Studio* compiler allow wild-cards for ignoring all warnings. In any case you need to specify exactly what you want to ignore.
We follow this convention and the proposed model is the following, for Intel Compiler on both Linux* and Windows*:
#pragma warning(push)
#pragma warning(disable : 1 2 3 4)
#include "3rdparty.h" // ignores warnings #1, #2, #3 & #4
#pragma warning(pop)
#include "mine.h"
The first pragma (push) stores the current warning setup and the last one (pop) restores it. In between you can freely disable (or otherwise change) the warnings.
If you know of any other patterns from other compilers that would work better here, let me know so we can ask for implementing them as well.
Up to now I think the solution above is the best approach, provided you also want to silence non-system headers. For real system headers there exist other approaches, but they are limited and won't work with arbitrary 3rd party headers.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"from top of my head neither GCC* nor Microsoft Visual Studio*
compiler allow wild-cards for ignoring all warnings."
Here's how you do it with major compilers:
Microsoft:
#pragma warning(push, 0) // Set warning level 0 henceforth
GCC:
#pragma GCC system_header // Report no warnings henceforth
EDG (covers various vendors):
#pragma diag no_warnings
CodeWarrior:
#pragma warning off
compiler allow wild-cards for ignoring all warnings."
Here's how you do it with major compilers:
Microsoft:
#pragma warning(push, 0) // Set warning level 0 henceforth
GCC:
#pragma GCC system_header // Report no warnings henceforth
EDG (covers various vendors):
#pragma diag no_warnings
CodeWarrior:
#pragma warning off
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...For real system headers there exist other approaches, but they are limited and won't work with arbitrary 3rd party headers...
What exactly do you mean?
Best regards,
Sergey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page