This chapter contains the following sections:
Diagnostic Messages
Termination Messages
Response to Signals
Return Values
Diagnostic messages have an associated severity, as follows:
By default, --tsw_diagnostics, diagnostics are written to stderr with a form like the following:
test.cc 5: break; E 116: a break statement may only be used within a loop or switch
With the command line option --no_tsw_diagnostics the message appear in the following form:
"test.cc", line 5: a break statement may only be used within a loop or switch break; ^
Note that the message identifies the file and line involved, and that the source line itself (with position indicated by the ^) follows the message. If there are several diagnostics in one source line, each diagnostic will have the form above, with the result that the text of the source line will be displayed several times, with an appropriate position each time.
Long messages are wrapped to additional lines when necessary.
A configuration flag controls whether or not the string error: appears, i.e., the C++ compiler can be configured so that the severity string is omitted when the severity is error.
The command line option --brief_diagnostics may be used to request a shorter form of the diagnostic output in which the original source line is not displayed and the error message text is not wrapped when too long to fit on a single line.
The command line option --display_error_number may be used to request that the error number be included in the diagnostic message. When displayed, the error number also indicates whether the error may have its severity overridden on the command line (with one of the --diag_severity options). If the severity may be overridden, the error number will include the suffix -D (for discretionary); otherwise no suffix will be present.
"Test_name.cc", line 7: error #64-D: declaration does not declare anything struct ; ^
"Test_name.cc", line 9: error #77: this declaration has no storage class or type specifier xxxxx; ^
Because an error is determined to be discretionary based on the error severity associated with a specific context, a given error may be discretionary in some cases and not in others.
For some messages, a list of entities is useful; they are listed following the initial error message:
"test.cc", line 4: error: more than one instance of overloaded function "f" matches the argument list: function "f(int)" function "f(float)" argument types are: (double) f(1.5); ^
In some cases, some additional context information is provided; specifically, such context information is useful when the C++ compiler issues a diagnostic while doing a template instantiation or while generating a constructor, destructor, or assignment operator function. For example:
"test.cc", line 7: error: "A::A()" is inaccessible B x; ^ detected during implicit generation of "B::B()" at line 7
Without the context information, it is very hard to figure out what the error refers to.
For a list of error messages and error
numbers, see Appendix Error Messages.
cp563 writes sign-off messages to stderr if errors are detected. For example, one of the following forms of message
n errors detected in the compilation of "ifile". 1 catastrophic error detected in the compilation of "ifile". n errors and 1 catastrophic error detected in the compilation of "ifile".
is written to indicate the detection of errors in the compilation. No message is written if no errors were detected. The following message
Error limit reached.
is written when the count of errors reaches the error limit (see the -e option); compilation is then terminated. The message
Compilation terminated.
is written at the end of a compilation that was prematurely terminated because of a catastrophic error. The message
Compilation aborted
is written at the end of a compilation that was prematurely terminated because of an internal error. Such an error indicates an internal problem in the compiler. If such an internal error appears, please report the occurrence to TASKING, using a Problem Report form. Please include a diskette or tape, containing a small C++ program causing the error.
The signals SIGINT (caused by a user interrupt, like ^C) and SIGTERM (caused by a kill command) are trapped by the C++ compiler and cause abnormal termination.
cp563 returns an exit status to the operating system environment for testing.
in a PC BATCH-file you can examine the exit status of the program executed with ERRORLEVEL:
cp563 %1.cc IF ERRORLEVEL 1 GOTO STOP_BATCH
In a Bourne shell script, the exit status can be found in the $? variable, for example:
cp563 $* case $? in 0) echo ok ;; 2|4) echo error ;; esac
The exit status of cp563 indicates the highest severity diagnostic detected and is one of the numbers of the following list: