Example 38 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.15.2.1Using -approot option for detailed diff report

Using the -approotoption, you can get the difference of warnings from two PDBs by ignoring differences in file paths. This option helps you to filter those warnings which are common to both PDBs, but having different source files paths from which they get emitted.

For example, consider an application with two files one.c and two.c in the path /tmp/path1. Compile and analyze the code using the command:

$ cadvise -pdb pdb1 cc one.c two.c

When the same application is copied to /tmp/path2 and one of the diagnostics fixed, a PDB diff with detailed report, between the two PDBs shows multiple improvements and regression because of the change in basepath.

This problem can be fixed with the -approotoption, as follows:

$ cadvise report -pdb pdb2 -basepdb /tmp/path1/pdb1 -approot /tmp/path1:/tmp/path2 -all

The -approotoption ignores the variable part of the path when comparing diagnostics and allows correct comparison reports to be generated.

The following example demonstrates the usage of -approotoption while generating a detailed diff report.

6.15 Generating PDB comparison report 37