HP Code Advisor
5 Configuring Diagnostic Messages
You may want to limit the cadvise diagnostic messages depending on the need, such as the
following cases:
• Generate all possible messages to ensure that you get the maximum information about
potential problems detected by cadvise.
• Reduce the number of messages so that you are not overwhelmed by the sheer magnitude
of the warnings.
• Eliminate or reduce the number of benign or misleading messages.
Your requirement may vary depending on the size of the application, resources allotted to
eliminate warnings by changing source code, total number of messages generated, new or ported
code, coding standards, and so on. The recommended way is to use options like, +wlint,
+w64bit and +w to enable only the required warnings, and then use the options to disable
specific warnings that are not of interest or that are too arbitrary. Each distinct type of diagnostic
message generated by cadvise has a number associated with it. You can generate separate reports
of diagnostics messages for each of these numbers. This allows you to ignore warnings that you
do not want and focus on those you want.
5.1 Diagnostic Configuration Options Table
The following options and pragmas help you to manage the diagnostics:
Suppresses diagnostics from specific files.-exclude <string1:string2:...:stringn>
Emits diagnostics from specific files.-include <string1:string2:...:stringn>
Selectively suppresses warnings.+Warg1[,arg2,...,argn]
Selectively enables warnings.+Wwarg1[,arg2,..,argn]
Selectively interprets warnings as errors.+Wearg1[,arg2,..,argn]
Disables warnings in a macro.+Wmacro:MACRONAME:d1,d2,d3,..dn
5.2 Suppressing Diagnostics from Specific File(s)
The -exclude option helps you to eliminate diagnostics for files that have any of the specified
strings in the filename path.
Following is the syntax for suppressing diagnostics from specific file(s).
$cadvise report -pdb <pdbname> –summary -exclude <filename1:filename2:...:filenamen>
Following is an example for suppressing diagnostics from a specific file.
Example 5-1 Suppressing diagnostics from specific file(s)
$cadvise report -pdb test.pdb –summary -exclude file1.c
5.3 Emitting Diagnostics from Specific File(s)
The -include option causes emission of diagnostics only from files that contain any of the
specified strings in the filename path.
NOTE: The -include and -exclude options do not lead to a reduction in analysis time. They
are useful options to filter diagnostics for users who do not use cadvise report option.
Following is the syntax for emitting diagnostics from specific file(s).
$cadvise report -pdb <pdbname> –summary -include <filename1:filename2:...:filenamen>
5.1 Diagnostic Configuration Options Table 33