Manuals
/
HP
/
Computer Equipment
/
Software
HP
UX Web Development Tools
manual
HP Code Advisor C.02.20 User Guide
Models:
UX Web Development Tools
1
1
59
59
Download
59 pages
40.35 Kb
1
2
3
4
5
6
7
8
Symbols
Example 55 Out of bound access
Features
Using Cadvise
Page 1
Image 1
HP Code Advisor C.02.20 User Guide
HP-UX
11i on HP Integrity and HP 9000 Systems
HP Part Number:
5900-1864
Published: July 2011
Edition: 2
Page 1
Page 2
Page 1
Image 1
Page 1
Page 2
Contents
HP Code Advisor C.02.20 User Guide
Page
Contents
Contents
About this document
Document conventions and symbols
Intended audience
Related information
Cadvise-help@lists.hp.com
HP encourages your comments
Cadvise user interface Features
Features
Introduction
Cadvise user interface
$ cadvise cc -c hello.c
Advanced static code analysis
$ cadvise -pdb ./mypdb +wlint aCC hello.cpp
Supported compilers
Steps in using cadvise
Using Cadvise
Supported platforms Installing Cadvise
Getting started
Invoking Cadvise
For information on PDB, see Using the Program Database PDB
Using Cadvise as a wrapper around Compiler or Linker
See the following makefile content
Integrating Cadvise with the makefiles and build process
Generating code complexity metrics
Enabling different categories of diagnostic messages
Example 2 Sample wrapper script
Objfile.metrics
Example 3 Generating code complexity metrics
Generating code complexity metrics
$ cat /tmp/example.c
Example 4 Code complexity metrics
+wcodeguide=rules-library
Example 5 Writing a rule to enforce naming convention
Source structure in the rules library
Using the Program Database PDB
Specifying the PDB location
PDB options table
Deleting PDB
Disabling locks in PDB operations
Displaying PDB version
Creating a PDB snapshot at a specified location
Example 8 Removing object file information from the PDB
Example 9 Creating a PDB snapshot
Usage
Using cross-file analysis
Cross-file analysis options
Crossfile=auto
Example 15 Specifying the location of object files
Diagnostic configuration options table
Configuring diagnostic messages
Suppressing warnings selectively
Enabling warnings selectively
Disabling warnings in a macro
Interpreting selective warnings as errors
Managing warnings in a source file
Report generation options table
Generating reports
Cadvise report report-options -pdb pdbdir
Cadvise report report-options logfile
Generating file summary report
Generating summary reports
Generating detailed report
$cadvise report -summary -pdb testpdb -noheader
Generating Html report
To save reports, run the following command
Example 23 Generating detailed report
$ cadvise report -pdb testpdb -all
Following example shows the command to generate XML report
Printing diagnostics with specific diagnostic numbers
Generating XML report
Example 24 Generating an XML report
Generating reports based on severity
Suppressing diagnostics for specific files
$ cadvise report -pdb testpdb -diag
Example 26 Generating reports based on severity
Reporting program complexity metrics
Reporting diagnostics from specific files
$ cadvise report -pdb test.pdb -summary -exclude inflate.c
$ cadvise report -pdb test.pdb -summary -include inflate.c
Example 29 Reporting program complexity metrics
Generating report for a module
$ cadvise report -pdb gzip.pdb +metrics -include inflate.c
Suppressing report header
Modifying the default severity level of a diagnostic
Generating PDB comparison report
$ cadvise report -pdb test.pdb -summary -module test1
$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -all
Example 34 Generating detailed diff report with the header
$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -diag
Example 35 Generating diff report for any particular warning
$ cadvise -pdb pdb1 cc one.c two.c
$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -severity
$ cadvise report -pdb new.pdb -basepdb old.pdb -all
Report options file
Generate report for migration related warnings
Example 42 Generating a report using -migration option
Generating consolidated report from multiple PDBs
Example 41 Report options file
Generating PDB diffs with multiple PDBs
Recommended process for analyzing the diagnostic messages
Report options interoperability
$ cadvise report -pdb 1.pdb2.pdb3.pdb4.pdb -all
$ cadvise report -pdb test.pdb -diag 2549 -exclude b.c
Example 44 Reporting options interoperability
Example 45 Ignoring the -includeoption
$ cadvise report -pdb test.pdb -summary -include a.cb.c
Miscellaneous driver options
Example 48 Using -noabort
Help-h-H
Example 47 Displaying the list of cadvise options
Following command creates the file cadvdir/foo.cad
Example 49 Using -nobuild option
Example 51 Using -tee option
Following example shows the usage of -nobuildoption
Line generates the following messages
Example 52 Using +opts filename option
Categories of diagnostics table
Categories of diagnostics with examples
Detecting generic programming errors
Categories of diagnostics with examples
Such cases, cadvise generates the following warning
Example 53 Null pointer dereference check
Such cases, cadvise generates the following warnings
Example 54 Potential memory leak check
Example 56 Out of scope access
Example 55 Out of bound access
Example 57 Use of pointer after free
Such cases, cadvise generates the following error
Example 58 Allocator/deallocator mismatch
Detecting endianness migration issues
Detecting 32-bit to 64-bit migraton issues
Example 60 Detecting 32-bit to 64-bit migraton issues
Example 59 Signed bit field of length
Example 61 Detecting endian dependent code fragments
Detecting potential security vulnerabilities
Consider the following code fragment
This case, cadvise generates the following error
Detecting multi-threaded programming issues
Running cadvise generates the following error
Example 63 Detecting multi-threaded programming issues
Detecting potential performance improvement opportunities
Detecting potential performance improvement opportunities
Fixing the warnings by source change
AC++ standard conformance and compatibility changes
Incompatibilities on PA-RISC based systems
Index
Symbols
Top
Page
Image
Contents