Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

3 Useful Porting Tools
By using the proper tools, you can significantly reduce the time and cost of porting programs written
in the C or C++ language from one computing platform to another. Some tools check for the
compatibility of C language source statements with the ISO/ANSI C standard, while others are
useful for determining which routines used by the program are not available on the platform to
which the program is being ported.
Because standards requirements are complicated and quite extensive, use an automated porting
checker for the following purposes:
To consistently demonstrate that your programs conform to standards and are available on
new platforms
To ensure that consistent results can be obtained in secure and sensitive environments
To bring products to market quickly and within moderate operating margins
To reduce maintenance costs of existing products and quickly debug new code
The following subsections provide an overview of popular porting tools available for the UNIX
workstation:
“lint Tool” (page 48)
“findcalls Tool” (page 49)
“CodeCheck Tool” (page 49)
“Open Systems Portability Checker (OSPC) Tool” (page 50)
The Code Coverage Tool is a utility program that you can use either to evaluate the code coverage
provided by test cases or to understand what parts of an application are used, or most heavily
used, under a representative workload. This tool runs on a Windows platform and is supported
on H-series and J-series RVUs only. See “Code Coverage Tool” (page 51).
The purpose of This chapter is to provide an introduction to the concepts involved when using
porting tools to enhance the efficiency of porting applications and other programs. For more
information about using or obtaining these and other porting tools, and how to use them when
porting code to the OSS environment, contact your service provider.
lint Tool
The lint tool is very important to portable C programming. lint examines C language source
programs, detecting bugs, inconsistencies, and poor constructs. lint helps you follow a number
of portability rules when moving programs from one platform to another or between different
operating systems. lint accepts multiple input files and library specifications and checks them
for consistency.
Although lint is very helpful for writing portable code, its importance is becoming more of a
historic one. It was one of the first porting tools available, and is still a standard tool on UNIX
machines. Today, there are more powerful porting tools available, such as CodeCheck and OSPC
(both discussed later in This chapter). lint is not available on NonStop systems.
In addition, C compilers today perform most of the checking done by lint; this includes the HP
C compiler, which does stricter checking than many conventional compilers. Refer to the C/C++
Programmer’s Guide for more information on using the HP C compiler.
The lint tool detects wasteful or error-prone constructions, which in some cases are actually valid
coding practices. By default, lint checks your programs against a standard library file that
contains descriptions of the programs normally loaded when a C program is run. You have the
option of suppressing various checking operations, as well as generating various types of messages
printed by lint.
48 Useful Porting Tools