This topic describes compiler remarks, warnings, and errors. The Intel® C++ Compiler displays these messages, along with the erroneous source line, on the standard output.
Remark messages report common but sometimes unconventional use of C or C++. The compiler does not print or display remarks unless you specify the -w2 option. Remarks do not stop translation or linking. Remarks do not interfere with any output files. The following are some representative remark messages:
function declared implicitly
type qualifiers are meaningless in this declaration
controlling expression is constant
Warning messages report legal but questionable use of the C or C++. The compiler displays warnings by default. You can suppress all warning messages with the -w compiler option. Warnings do not stop translation or linking. Warnings do not interfere with any output files. The following are some representative warning messages:
declaration does not declare anything
pointless comparison of unsigned integer with zero
possible use of = where == was intended
Additional Warnings
This version of Intel C++ Compiler includes support for the following options:
Option |
Result |
---|---|
-W[no-]missing-prototypes |
Warn for missing prototypes |
-W[no-]missing-declarations | Warn for missing declarations |
-W[no-]unused-variable | Warn for unused variable |
-W[no-]pointer-arith |
Warn for questionable pointer arithmetic |
-W[no-]uninitialized |
Warn if a variable is used before being initialized |
-W[no-]deprecated |
Display warnings related to deprecated features |
-W[no-]abi |
Warn if generated code is not C++ ABI compliant |
-W[no-]unused-function |
Warn if declared function is not used |
-W[no-]unknown-pragmas |
Warn if an unknown #pragma directive is used |
-W[no-]main |
Warn if return type of main is not expected |
-W[no-]comment[s] |
Warn when /* appears in the middle of a /* */ comment |
-W[no-]return-type |
Warn when a function uses the default int return type |
These messages report syntactic or semantic misuse of C or C++. The compiler always displays error messages. Errors suppress object code for the module containing the error and prevent linking, but they allow parsing to continue to detect other possible errors. Some representative error messages are:
missing closing quote
expression must have arithmetic type
expected a ";"
Use the following compiler options to control remarks, warnings, and errors:
Option |
Result |
---|---|
-w |
Suppress all warnings |
-w0 |
Display only errors |
-w2,-Wall |
Display only errors and warnings |
-Wremarks |
Display remarks and comments |
-Wbrief |
Display brief one-line diagnostics |
-Wcheck |
Enable more strict diagnostics |
-Werror-all |
Change all warnings and remarks to errors |
-Werror |
Change all warnings to errors |
You can also control the display of diagnostic information with variations of the -diag compiler option. This compiler option accepts numerous arguments and values, allowing you wide control over displayed diagnostic messages and reports.
Some of the most common variations include the following:
Option |
Result |
---|---|
-diag-enable list |
Enables a diagnostic message or a group of messages |
-diag-disable list |
Disables a diagnostic message or a group of messages |
-diag-warning list |
Tells the compiler to change diagnostics to warnings |
-diag-error list |
Tells the compiler to change diagnostics to errors |
-diag-remark list |
Tells the compiler to change diagnostics to remarks (comments) |
The list items can be specific diagnostic IDs, one of the keywords warn, remark, or error, or a keyword specifying a certain group (par, vec, sc, driver, thread, , port-win, sc,openmp). For more information, see -diag.
Other diagnostic-related options include the following:
Option |
Result |
---|---|
-diag-dump |
Tells the compiler to print all enabled diagnostic messages and stop compilation |
-diag-file[=file] |
Causes the results of diagnostic analysis to be output to a file |
-diag-file-append[=file] |
Causes the results of diagnostic analysis to be appended to a file |
-diag-error-limit n | Specifies the maximum number of errors allowed before compilation stops |
Copyright © 1996-2011, Intel Corporation. All rights reserved.