Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Itanium-based Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line Options

Error Handling

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Use the following options to control how potential errors in your code are detected and handled. You can also use the cadvise report feature of the HP Code Advisor tool to help analyze compiler errors and warnings.

+p

The +p option disallows all anachronistic constructs.

Ordinarily, the compiler gives warnings about anachronistic constructs. Using the +p option, the compiler gives errors for anachronistic constructs.

Example:

The following command compiles file.C and gives errors for all anachronistic constructs rather than just giving warnings.

aCC +p file.C

-w

The -w option disables all warnings except those that are explicitly enabled with a +Wwargs option or a subsequent +w-prefix option. By default, the compiler reports all errors and warnings.

HP recommends against using the -w option. In addition to disabling messages currently output by the compiler, it will also disable any new messages added to the compiler in the future that could identify problem areas in user code. HP recommends using the +Wargs option to disable a message. Although it can often take a long list of +Warg options to disable all desired warnings, this list can be included in an options file and referenced using the +opts option to avoid listing them all directly on the command line.

Example:

The following command compiles file.C and reports errors but does not report any warnings.

aCC -w file.C

+w

The +w option warns you about all questionable constructs and gives pedantic warnings. +w enables all checks except for the +wsecurity and +wendian warnings. Those need to be enabled explicitly if needed. The default is to warn only about constructs that are almost certainly problems.

For example, this option warns you when calls to inline functions cannot be expanded inline.

The following command compiles file.C and warns about both questionable and problematic constructs:

aCC +w file.C

NOTE: This option is equivalent to the +w1 option of legacy HP C.

+wn

The +wn option specifies the level of the warnings messages.

+w{1|2|3}

The value of n can be one of the following:

1

All warnings are issued. This includes low level warnings that may not indicate anything wrong with the program.

2

Only warnings indicating that code generation might be affected are issued. This is equivalent to the compiler default without the -w options.

3

No warnings are issued. This is equivalent to the -w option. This option is the same as -W c and-wn.

+Wargs

+Warg1[,arg2,..argn]

The +Wargs option selectively suppresses any specified warning messages.

Arguments arg1 through argn are valid compiler warning message numbers.

Example:

aCC +W600 app.C

+Wcontext_limit

+Wcontext_limit=num

The +Wcontext_limit option limits the number of instantiation contexts output by the compiler for diagnostics involving template instantiations. At most num outermost contexts and num innermost contexts are shown. If there are more than 2*num relevant contexts, the additional contexts are omitted.

Omitted contexts are replaced by a single line separating the outermost num contexts from the innermost num contexts, and indicating the number of contexts omitted. The default value for num is 5. A value of 0 removes the limit.

+We

+We

The +We option interprets all warning and future error messages as errors.

Alternatively you can also use +We[arg1,...argn] option, where arg is a valid compiler warning message number. Use of arg is optional.

+Weargs

+Wearg1[,arg2,..,argn]

The +Weargs option selectively interprets any specified warning or future error messages as errors. arg1 through argn are valid compiler warning message numbers.

Example:

aCC +We 600,829 app.C

+Wv

+Wv[d1,d2,..,dn]

The +Wv option displays the description for diagnostic message numbers d1 through dn.

Specifying this option causes the compiler to emit the descriptive text for the specified dianostics to stderr. This option must not be used with any other compiler options.

If the description for a diagnostic is not available, the compiler emits only the diagnostic with a note that the description is not available.

+Wwargs

+Wwarg1[,arg2,..,argn]

The +Wwargs option selectively treats compiler remarks or discretionary errors as warnings. arg1 through argn are valid compiler message numbers. Conflicts between +W, +Ww and +We are resolved based on their severity. +We is the highest and +W is the lowest.

+wlint

This option enables several warnings in the compiler that provide lint like functionality. Checks are made for memory leaks, out-of-scope memory access, null pointer dereference, and out-of-bounds access. These compile time diagnostics can be very useful in detecting potential problems in the source code. To disable a specific warning introduced by +wlint, a +Wargs option can be used after the +wlint option.

NOTE: The +wlint option is only supported on Itanium-based systems.

+Wmacro

+Wmacro:MACRONAME:d1,d2,...,dn

The +Wmacro option disables warning diagnostics d1,d2,...,dn in the expansion of macro MACRONAME. If -1 is given as the warning number, then all warnings are suppressed. This option is not applicable to warning numbers greater than 20000. +Wmacro gets higher priority than the other diagnostic-control command-line options that are applicable to the whole source. Diagnostic control pragmas take priority based on where they are placed.

+wperfadvice

+wperfadvice[={1|2|3|4}]

The +wperfadvice option enables performance advisory messages.

The optional level 1, 2, 3,or 4 controls how verbosely the performance advisory messages are emitted. The higher the level, the more messages generated. Level 1 emits only the most important messages, while level 4 emits all the messages.

If the optional level is not specified, it defaults to 2.

+wsecurity

The +wsecurity option enables compile-time diagnostics for potential security violations. Warnings are emitted for cases where untrusted (tainted) data may reach a critical reference point in the program. This is based on cross-module analysis performed by the compiler. Hence the +wsecurity option implicitly enables a limited form of cross-module analysis, even if -ipo or +O4 options are not specified. This may lead to a significant increase in the compile time compared to a build without the +wsecurity option. Using this option may result in the compiler invoking optimizations other than those that are part of the user-specified optimization level. If +wsecurity is used in addition to -ipo or +O4, the generated code is not affected and the compile time does not significantly increase.

This option can optionally take an argument to control how verbosely the security messages are emitted:

+wsecurity[={1|2|3|4}]

The higher the check level, the more warnings can be generated. Note that this may also generate more false positives.

The default level is 2.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.