Example 2 Sample wrapper script
$ cat cadvise_cc #!/bin/sh
#
#wrapper script to invoke cadvise
exec /opt/cadvise/bin/cadvise
Now cadvise_cc can be used instead of cc in the build line to invoke cadvise analysis in addition to the compilation process.
NOTE: You need not create separate dependency rules for cadvise in the makefiles. Cadvise must be invoked only when the existing dependency rules in the makefile lead to a compile.
The addition of cadvise analysis to the build process increases the total build time. You can either invoke cadvise automatically whenever compiled, or launch cadvise as a separate build process by invoking it explicitly. For large projects where a lot of
2.6 Enabling different categories of diagnostic messages
By default, a limited number of diagnostic messages are enabled in cadvise.
Additionally, the following options can be used to enable various types of diagnostic messages.
+w | Enables all the warnings about potentially questionable constructs in the |
| compiler. |
+wall | Enables all the compile time checks. |
“+wendian” (page 51) | Detects code fragments which are endian dependent. |
“+wlint” (page 45) | Provides |
| code. |
“+wlock” (page 53) | Detects |
“+wsecurity[=1234]” (page 52) Enables compile time diagnostic messages for potential security vulnerabilities.
“+w64bit ” (page 51) | Enables warnings that help detection of potential problems in converting |
| applications to |
“+wperfadvice[=1234] | Generates performance advisory diagnostics. |
” (page 54) |
|
The best method is to use +wall to enable all possible diagnostic messages. Then, use the cadvise report
2.7 Generating code complexity metrics
Cadvise can generate code complexity metrics to gauge the complexity of the code being developed or migrated. The +metrics option generates program complexity metrics.
Syntax:
$cadvise +metrics[=ict][:out=pdb]
OR
$cadvise +metrics[=ict][:out=[+]<filename>]
Following command shows the examples for generating code complexity metrics.
2.6 Enabling different categories of diagnostic messages | 13 |