Remarks, Warnings, and Errors

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.

Remarks

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:

Warnings

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:

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
Warn when a return statement is used in a void function

Errors

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:

Option Summary

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


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.