Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

#pragma warning format changed?

gary-oberbrunner
Beginner
901 Views

I had this code for years:
[bash]# pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:69) /* integer conversion resulted in truncation */ [/bash] but sometime, maybe when we started using v11, these stopped suppressing the error. I found on a board somewhere this syntax:[bash]#pragma warning disable 810 /* conversion ... may lose significant bits */ #pragma warning disable 69 /* integer conversion resulted in truncation */ [/bash] which now works fine. Did something change somewhere? This is on Windows, icl 11.1.060.

0 Kudos
5 Replies
Judith_W_Intel
Employee
901 Views

Could you please give usa complete example, i.e. a test case and your compilation command?

I tried this simpletest case which disables warning 1079 (return type of function main must be int)with 11.1 and it works as expected:

#pragma warning (disable:1079)

void main() {}

thanks,
Judy

0 Kudos
Matt_Clarkson
Beginner
901 Views
I'm finding problems with 13.0 in disabling and restoring warnings. I can't find any documentation on it #pragma warning disable 304 // this works #pragma warning restore 304 // this doesn't work #pragma (push) // this #pragma warning(disable:304) // doesn't #pragma (pop) // work
0 Kudos
Matt_Clarkson
Beginner
901 Views
What I really want to do is disable all warnings for a small section. On MSVC you can do #pragma warning(push, 0) #pragma warning(pop) Which works great - no such luck with Intel compiler.
0 Kudos
Judith_W_Intel
Employee
901 Views

 

Please show a complete example where you think these pragmas are not working.

I created this example which works as expected:

!% cat t.cpp

struct Base {};

#pragma warning push
#pragma warning(disable:304)
struct Derived: Base {};  // remark is disabled here
#pragma warning pop

struct Derived2: Base {}; // but not here

!% icl -c -W5 t.cpp
Intel(R) C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Mar 17 2013 16:26:48 by jward4 on JWARD4-DESK in D:/workspaces/46cfe/dev
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

t.cpp
t.cpp(9): remark #304: access control not specified ("public" by default)
  struct Derived2: Base {}; // but not here
                   ^

!%

thanks!

Judy

P.S. If the class is a template class you need to have the diagnostic disabled at the point of the instantiation.

0 Kudos
SergeyKostrov
Valued Contributor II
901 Views
I'm currently using three versions of Intel C++ compiler ( versions 8.x, 12.x, and 13.x ) on a project and there is a set of warnings which I could never was able to disable in sources. Here is a list of these warnings and they are disabled in a Visual Studio project files using option /Qwd: .../Qwd 111,114,174,177,181,279,304,424,444,593,673,810,869,981,1011,1418,1572... I consider it as a problem ( a bug ) and it needs to be fixed. Judith, I'll try to provide more details for 304 and 810 warnings some time next week.
0 Kudos
Reply