Use the -w or -Wn option to suppress warning messages or to enable remarks during the preprocessing and compilation phases. You can enter the option with one of the following arguments:
Option | Description |
---|---|
-w0 | Display only errors (same as -w) |
-w1 | Display warnings and errors (DEFAULT) |
-w2 | Display remarks, warnings, and errors |
For some compilations, you might not want warnings for known and benign characteristics, such as the K&R C constructs in your code. For example, the following command compiles newprog.cpp and displays compiler errors, but not warnings:
prompt>icpc -W0 newprog.cpp
Use the -ww, -we, or -wd option to indicate specific diagnostics.
Option | Description |
---|---|
-wwL1[L2,...,Ln] | Changes the severity of diagnostics L1 through Ln to warning. |
-weL1[L2,...,Ln] | Changes the severity of diagnostics L1 through Ln to error. |
-wdL1[L2,...,Ln] | Disables diagnostics L1 through Ln. |
Example
/* test.c */
int main() { int x=0; } |
If you compile test.c using the -Wall option (enable all warnings), the compiler will emit warning #177:
prompt>icc -Wall test.c
remark #177: variable 'x' was declared but never referenced
To disable warning #177, use the -wd option:
prompt>icc -Wall -wd177 test.c
Likewise, using the -we option will result in a compile-time error:
prompt>icc -Wall -we177 test.c
error #177: variable 'x' was declared but never referenced
compilation aborted for test.c