HP Code Advisor
Example 6-18 Generating detailed diff report in the warnings greater than or equal to any particular
severity
$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -severity 1
Report generated using "HP Code Advisor C.XX.XX [Release Date]" on <Machine Name> at <Time>
Report command line: "Report Command Line"
New Pdb: tmp.pdb
Base Pdb: tmp1.pdb
Regressions: 2 =>2549
Improvements: 4 =>2938(1), 20119(2), 20200(1)
=======================[ REGRESSIONS ]===========================
"/home/solankib/TESTING/b.c", line 6: warning #2549-D: variable "a" is used before its value is set
c = a;
^
"/home/solankib/TESTING/b.c", line 9: warning #2549-D: variable "b" is used before its value is set
a = b;
^
=======================[ IMPROVEMENTS ]===========================
"/home/solankib/TESTING/a1.c", line 11, procedure main: warning #20119-D: (SECURITY) Unsafe API 'strcpy' ...
"/home/solankib/TESTING/a1.c", line 11, procedure main: warning #20200-D: Potential null pointer dereference
...
"/home/solankib/TESTING/a1.c", line 3: remark #2938-D: return type "int" omitted in declaration of function
"main"
main()
^
"/home/solankib/TESTING/a1.c", line 9, procedure main: warning #20119-D: (SECURITY) Unsafe API 'strcpy' is
used...
6.16 Report Options File
All the options that you want to use to generate the report can be consolidated in a single
configuration file using the +opts <file> option. This reduces the clutter on the command
line and provides a single place to specify the customized options. Comment lines can also be
inserted in the +opts configuration file. This option is used for reading reporting options from
the specified <file>. The following example shows the reading of report options from a specific
file.
Example 6-19 Report options file
$ cat my_opts
-diag 3348
$ cadvise report -pdb test.pdb +opts my_opts
"test.c", line 1320: remark #3348-D: declaration hides variable "ifd" (declared at line 237)
int ifd; /* input file descriptor */
^
"test.c", line 1321: remark #3348-D: declaration hides variable "method" (declared at line 216)
int method; /* compression method */
^
"unlzw.c", line 337: remark #3348-D: declaration hides variable "i" (declared at line 247)
REG1 int i;
^
"unzip.c", line 130: remark #3348-D: declaration hides variable "n" (declared at line 104)
register ulg n = LG(inbuf + LOCLEN);
^
6.17 Recommended Process for Analyzing the Diagnostic Messages
The recommended process for analyzing the diagnostic messages is as mentioned below:
6.16 Report Options File 47