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