Issues With Warnings

Issues With Warnings

Hi,I've encoundered two issues with Intel Composer XE 2011 Update 10 integrated with Visual Studio 2010 SP1.I compile the following code with /W4 and /WX:#include #pragma warning( push )#pragma warning (disable: 2415)static const char * Label= "LABEL"; //warning #2415: variable "Label" of static storage duration was declared but never referenced#pragma warning( pop )int main(void){ unsigned count=10; for(int i=0;i { printf("%d\\n",i); } return 0;}A warning is trigged for the "const char * Label" line even though it has been disabled betwen a push and pop. Much more seriously, the /WX flag has no effect and the file is compiled without the warnings being treated as errors. The 'for' line produces a warning as expected but it is not trated as an error.By comparison, the Microsoft (v10) compiler produces a "warning treated as error - no 'object' file generated with the /WX flag enabled.Thank you,Scott

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

As for the first issue (why the 2415 is not disabled). You'll notice if you remove the #pragma warning (pop) the warning is disabled. The compiler does not actually issue the warning until the end of the file (when it can actually tell the Label was never referenced). At that point the warning stack has been popped by the #pragma warning (pop). So unfortunately this specific warning cannot be disabled by putting push/pop around the declaration.

As for the second issueit looks like you need to use /Werror-all instead of /WX if you want the remarks that come out with the /W4 option to be treated as errors.

This is what the help says:

/WX force warnings to be reported as errors

/Werror-all
force warnings and currently enabled remarks to be reported as errors

Judy

Makes sense, thanks getting back to me.Scott

Hi,I added "/Werror-all" and build the sample code above. The warnings are still not reported as errors. Is there something else I need to do?Scott

For me warnings and remarks are reported as errors.

------------------------------------

c:\forum\U106251>type tstcase.cpp

#include

#pragma warning( push )

#pragma warning (disable: 2415)

static const char * Label= "LABEL"; //warning #2415: variable "Label" of static

storage duration was declared but never referenced

#pragma warning( pop )

int main(void)

{

unsigned count=10;

for(int i=0;i

gned operands

{

printf("%d\n",i);

}

return 0;

}

------------------

c:\forum\U106251>icl -c -W4 -Werror-all tstcase.cpp

Intel C++ Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

tstcase.cpp

tstcase.cpp(9): error #2557: comparison between signed and unsigned operands

for(int i=0;i

^

tstcase.cpp(4): error #2415: variable "Label" of static storage duration was declared but never referenced

static const char * Label= "LABEL"; //warning #2415: variable "Label" of static storage duration was declared but never referenced

^

compilation aborted for tstcase.cpp (code 2)

c:\forum\U106251>icl -V

Intel C++ Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

icl: command line warning #10155: ignoring option '/V'; argument required

icl: command line error: no files specified; for help type "icl /help"

I think I see. I mixed /WX-Werror-all. The /WX option seems to override /Werror-all.

Login to leave a comment.