- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am looking for the official documentation of how to suppress specific warnings for ICL, for Windows and for Linux.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you look up diag-disable either in the index to on-line documentation or under ICL -help ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In fact I want to disable them more locally than a whole compilation unit.
I am looking for something similiar to
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icc -help-pragma filename
will list all the supported pragmas and their syntax.
They are also described here:
https://software.intel.com/en-us/node/524492
I think the one you are looking for is
#pragma warning (push)
#pragma warning (disable:number)
...
#pragma warning (pop)
More details in the Microsoft documentation:
https://msdn.microsoft.com/en-us/library/2c8f766e.aspx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note that I am looking for a solution for Linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The above pragmas work on Linux with our compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW, the link https://software.intel.com/en-us/intel-software-technical-documentation provides documentation access to compiler component and all the other supported SW products.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
@Kittur: A top level link is not really helpful for a precise question.
@Judith: What works for us is:
#pragma warning disable 1017
WITHOUT a ":" between "disable" and the number.
The compiler is
Compiler version: Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.1.150 Build 20151021
push and pop do NOT work.
Best regards,
andreas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Andreas, I just added the general link as an add on info to what Judy had already provided for the question. Also, I'll pass on your feedback on push/pop not working and will try that out. If an issue I'll file with developers as well - appreciate much.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes you are right the syntax is a bit different on Linux.
Could you provide an example that shows that push/pop is not working properly?
Here is an example which shows it is working:
sptxl15-37> cat foo.cpp
struct C {
void f();
};
template <class T>
void foo() {
C* c = new C;
#pragma warning(push)
#pragma warning disable 1017
c->template f(); // warning disabled here
#pragma warning(pop)
c->template f(); // but not here
}
sptxl15-38> icpc -c -strict_ansi foo.cpp
foo.cpp(13): warning #1017: name following "template" must be a template
c->template f(); // but not here
^
sptxl15-39>'
thanks again
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Andreas, the push/pop works for me as well and I couldn't reproduce the problem. A reproducer would come in handy, thanks.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Andreas, can you provide a reproducer for the push/pop issue? Appreciate much for your help.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Andreas, any update on the reproducer for the push/pop issue you mentioned (as it works on our systems and couldn't reproduce as communicated to you earlier)?
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a reproducer:
#include <iostream>
template<typename T>
struct S1 {
void func() { std::cout<< "Creates no warning, is inlined" << std::endl;}
};
#pragma warning push
#pragma warning disable 2196
template<typename T>
struct S2 {
__attribute__((noinline)) void func() {
std::cout<< "Creates warning, is not inlined" << std::endl;
}
};
#pragma warning pop
template<typename T>
struct S3 {
__attribute__((noinline)) void func();
};
template<typename T>
void S3<T>::func() { std::cout<< "Creates no warning, is not inlined" << std::endl;}
int main(int nargs, char** args) {
S1<int> s1;
s1.func();
S2<int> s2;
s2.func();
S3<int> s3;
s3.func();
}
Tested with intel 2020 and 2019. When the pop is removed, then the warning is suppressed.
Output is:
intelExample.cpp(36): warning #2196: routine is both "inline" and "noinline"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank for the test case. You can use -diag-disable=2196 to suppress the warning.

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