Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bevin_b_
Beginner
176 Views

#pragma warning( disable: 46 ) does not disable

Compiling using Parallel Studio 2017 on Windows 10, VS 2015 community edition

 

#ifdef WIN32
#pragma warning( push,    46 )
#pragma warning( disable: 46 )
#define _Pragma(text) __pragma(text)    // ignore this warning message
#pragma warning( pop )
#endif

 

1>..\..\src\./checker.h(294): warning #46: "_Pragma" is predefined; attempted redefinition ignored
1>    #define _Pragma(text) __pragma(text)
1>            ^


Why did the warning #46 not get suppressed?

 

0 Kudos
2 Replies
Michael_R_Intel5
Employee
176 Views

In the Intel Compiler #pragma warning is implemented so it is applied at the point of the next statement or declaration.  In your example there is no such declaration or statement until after the diagnostic is generated.

To workaround the problem you can add a dummy declaration after the #pragma warning like so:

#pragma warning( push,    46 )
#pragma warning( disable: 46 )
int dummy();
#define _Pragma(text) __pragma(text)    // ignore this warning message
#pragma warning( pop )

 

 

bevin_b_
Beginner
176 Views

I assume this is seen as a bug and is going to get fixed!

 

 

Reply