• Aucun résultat trouvé

COMPILER OPTIONS

Dans le document Chapter 4. THE OBJECT AND MATH LIBRARIES (Page 122-129)

All options recognized by the cc command are listed below:

Option Argument Description

-# none Display without executing each

command that cc generates.

-c none Suppress the link-editing phase

of compilation and force an object file to be produced even if only one file is compiled.

-p none Arrange for the compiler to produce

code which counts the number of times each routine is called;

also, if link editing takes place, replace the standard startoff routine by one which automatically calls monitor(3C) at the start and arrange to write out a mon.out file at normal termination of execution of the object program.

An execution profile can be generated by use of prof(l).

- f none Link the object program with the floating-point interpreter

for systems without hard ware £loa ting-poin t.

-g none Cause the compiler to generate

additional information needed for the use of sdb(l).

-0 none optimizer. This flag and -g (described above) are mutually

corresponding files suffixed .i.

Construct pathnames

-w

compiler first pass, compiler second pass, optimizer, assembler, or link editor, respectively.

This option is no longer

allowed because of a conflict of

meaning. The - W option must be used to specify precisely its destination.

To indicate the -dn option for the VAX assembler use -Wa, -dn. To indicate the -d option for the link editor, use -WI,-d.

This part provides additional information for those options not completely described above.

By using appropriate options, compilation can be terminated early to produce one of several intermediate translations such as relocatable object files (-c option), assembly source expansions for C code (-8 option), or the output of the preprocessor (-P option). In general, the intermediate files may be saved and later resubmitted to the cc command, with other files or libraries included as necessary.

When compiling C source files, the most common practice is to use the -c option to save relocatable files. Subsequent changes

to one file do not then require that the others be recompiled. A separate call to cc without the -c option then creates the linked executable a.out file. A relocatable object file created under the -c option is named by adding a .0 suffix to the source file name.

The -W option provides the mechanism to specify options for each step that is normally invoked from the cc command line.

These steps are preprocessing, the first pass of the compiler, the second pass of the compiler, optimization, assembly, and link editing. At this time, only assembler and link editor options can be used with the -W option.

When the -P option is used, the compilation process stops after only preprocessing, with output left on file. i. This file will be unsuitable for subsequent processing by cc.

The -0 option decreases the size and increases the execution speed of programs by moving, merging, and deleting code.

The -g option produces information for a symbolic debugger.

The SGS currently supports the SDB symbolic debugger.

A C PROGRAM CHECKER-"lint"

PAGE

GENERAL... 6-1

Usage . . . " . . . . .. . . 6-1 TYPES OF MESSAGES . . . 6-3 Unused Variables and Functions. . . . . . . . 6-4 Set/U sed Information. . . . . . 6-5 Flow of Control. . . . . . , 6-6 Function Values. . . . . . 6-7 Type Checking. . . . . . 6-8 Type Casts. . . . . . .. 6-10 Nonportable Character Use. . . . . . . . .. 6-10 Strange Constructions . . . . . . . . .. 6-11 Old Syntax. . . . . . .. 6-13 Pointer Alignment. . . . . . . . .. 6-14 Multiple Uses and Side Effects . . . 6-14

A C PROGRAM CHECKER-"lint"

GENERAL

The lint program examines C language source programs detecting a number of bugs and obscurities. It enforces the type rules of C language more strictly than the C compiler. It may also be used to enforce a number of portability restrictions involved in moving programs between different machines and/ or operating systems. Another option detects a number of wasteful or error prone constructions which nevertheless are legal. The lint program accepts multiple input files and library specifications and checks them for consistency.

Usage

The lint command has the form:

lint [options] files '" library-descriptors ...

where options are optional flags to control lint checking and messages; files are the files to be checked which end with .c or .In; and library-descriptors are the names of libraries to be used in checking the program.

The options that are currently supported by the lint command are:

-a

-b

Suppress messages about assignments of long values to variables that are not long.

Suppress messages about break statements that cannot be reached.

-c information in files suffixed with .In.

Do not apply heuristics (which attempt to detect bugs, improve style, and reduce waste).

Do not check for compatibility with either the standard or the portable lint library.

Create a lint library from input files named llib-lname.ln.

Attempt to check portability to other dialects of C language.

Suppress messages about function and external variables used and not defined or defined and not used.

Suppress messages about unused arguments in functions.

The lint program accepts certain arguments, such as:

-ly

These arguments specify libraries that contain functions used in the C language program. The source code is tested for

compatibility with these libraries. This is done by accessing library description files whose names are constructed from the library arguments. These files all begin with the comment:

/* LINTLIBRARY * /

which is followed by a series of dummy function definitions.

The critical parts of these definitions are the declaration of the function return type, whether the dummy function returns a value, and the number and types of arguments to the function.

The V ARARGS and ARGSUSED comments can be used to specify features of the library functions.

The lint library files are processed almost exactly like ordinary source files. The only difference is that functions which are defined on a library file but are not used on a source file do not result in messages. The lint program does not simulate a full library search algorithm and will print messages if the source files contain a redefinition of a library routine.

By default, lint checks the programs it is given against a standard library file which contains descriptions of the programs which are normally loaded when a C language program is run. When the -p option is used, another file is checked containing descriptions of the standard library routines which are expected to be portable across various machines. The -n option can be used to suppress all library checking.

Dans le document Chapter 4. THE OBJECT AND MATH LIBRARIES (Page 122-129)

Documents relatifs