Option | Description |
---|---|
-w0,-w | Displays error messages only. Both -w0 and -w display exactly the same messages. |
-w1,-w2 | Displays warnings and error messages. Both -w1 and -w2 display exactly the same messages.The compiler uses this level as the default. |
-w3 | Displays warnings and error messages. This option displays more warnings than do -w1 and -w2. |
-w4 | Displays remarks, warnings, and error messages. |
You can control the severity of some of the diagnostics returned by the compiler. The compiler returns two types of diagnostics:
Hard errors are issued for code that is definitely wrong or questionable. The severity of a hard error is not configurable. For hard errors, the message number is never printed. Remarks and warnings are never considered hard errors.
Soft diagnostics include all other diagnostics (including remarks and warnings). For soft diagnostics, the message number is always printed. The severity of a soft diagnostic is configurable by the options described below.
In the descriptions below, tag
represents the number associated
with the diagnostic. Multiple tags are permitted, separated by commas.
Option | Description |
---|---|
-wdL1[,L2,...] |
Disable the soft diagnostics that corresponds to L1 through LN. |
-wrL1[,L2,...] | Override the severity of the soft diagnostics corresponding to L1 through LN and make it a remark. |
-wwL1[,L2,...] | Override the severity of the soft diagnostics corresponding to L1 through LN and make it a warning. |
-weL1[,L2,...] | Override the severity of the soft diagnostics corresponding to L1 through LN and make it an error. |
For example, the following command line disables soft diagnostic 68 during compilation of the file a.cpp:
IA-32: prompt> icc -wd68 -c a.cpp
Itanium-based systems: prompt> ecc -wd68 -c a.cpp
The following command line changes the severity of soft diagnostics 68 and 152 to remarks during compilation of the file a.cpp.
IA-32: prompt>icc -wr68,152 -c a.cpp
Itanium-based systems: prompt>ecl -wr68,152 -c a.cpp
Assume that you have a file x.cpp that contains the following line:
extern i;
If you compile this code with warnings enabled (the default), you will receive the following response from the compiler:
x.cpp(2): warning #9: nested comment is not allowed/* This is a comment. */ x.cpp(5): warning #260: explicit type is missing ("int" assumed) extern i;
If you compile the code with the option -wd9 (to disable warning number 9), you will receive the following response from the compiler:
x.cpp(5): warning #260: explicit type is missing ("int" assumed) extern i;