JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: C User's Guide
search filter icon
search icon

Document Information


1.  Introduction to the C Compiler

2.  C-Compiler Implementation-Specific Information

3.  Parallelizing C Code

4.  lint Source Code Checker

4.1 Basic and Enhanced lint Modes

4.2 Using lint

4.3 The lint Options

4.3.1 -#

4.3.2 -###

4.3.3 -a

4.3.4 -b

4.3.5 -C filename

4.3.6 -c

4.3.7 -dirout=dir

4.3.8 -err=warn

4.3.9 -errchk=l(, l)

4.3.10 -errfmt=f

4.3.11 -errhdr=h

4.3.12 -erroff=tag(, tag)

4.3.13 -errsecurity=v

4.3.14 -errtags=a

4.3.15 -errwarn=t

4.3.16 -F

4.3.17 -fd

4.3.18 -flagsrc=file

4.3.19 -h

4.3.20 -Idir

4.3.21 -k

4.3.22 -Ldir

4.3.23 -lx

4.3.24 -m

4.3.25 -m32|-m64

4.3.26 -Ncheck=c

4.3.27 -Nlevel=n -Nlevel=1 -Nlevel=2 -Nlevel=3 -Nlevel=4

4.3.28 -n

4.3.29 -ox

4.3.30 -p

4.3.31 -Rfile

4.3.32 -s

4.3.33 -u

4.3.34 -V

4.3.35 -v

4.3.36 -Wfile

4.3.37 -XCC=a

4.3.38 -Xalias_level[=l]

4.3.39 -Xarch=amd64

4.3.40 -Xarch=v9

4.3.41 -Xc99[=o]

4.3.42 -Xkeeptmp=a

4.3.43 -Xtemp=dir

4.3.44 -Xtime=a

4.3.45 -Xtransition=a

4.3.46 -Xustr={ascii_utf16_ushort|no}

4.3.47 -x

4.3.48 -y

4.4 lint Messages

4.4.1 Options to Suppress Messages

4.4.2 lint Message Formats

4.5 lint Directives

4.5.1 Predefined Values

4.5.2 Directives

4.6 lint Reference and Examples

4.6.1 Diagnostics Performed by lint Consistency Checks Portability Checks Questionable Constructs

4.6.2 lint Libraries

4.6.3 lint Filters

5.  Type-Based Alias Analysis

6.  Transitioning to ISO C

7.  Converting Applications for a 64-Bit Environment

8.  cscope: Interactively Examining a C Program

A.  Compiler Options Grouped by Functionality

B.  C Compiler Options Reference

C.  Implementation-Defined ISO/IEC C99 Behavior

D.  Supported Features of C99

E.  Implementation-Defined ISO/IEC C90 Behavior

F.  ISO C Data Representations

G.  Performance Tuning

H.  The Differences Between K&R Solaris Studio C and Solaris Studio ISO C


4.2 Using lint

Invoke the lint program and its options from the command line. To invoke lint in the basic mode, use the following command:

% lint file1.c file2.c

Enhanced lint is invoked with the -Nlevel or -Ncheck option. For example, you can invoke enhanced lint as follows:

% lint -Nlevel=3 file1.c file2.c

lint examines code in two passes. In the first pass, lint checks for error conditions within C source files; in the second pass, it checks for inconsistencies across C source files. This process is invisible to the user unless lint is invoked with -c:

% lint -c file1.c file2.c

That command directs lint to execute the first pass only and collect information relevant to the second—about inconsistencies in definition and use across file1.c and file2.c—in intermediate files named file1.ln and file2.ln:

% ls

This way, the -c option to lint is analogous to the -c option to cc, which suppresses the link editing phase of compilation. Generally speaking, lint’s command-line syntax closely follows cc’s.

When the .ln files are linted:

% lint file1.ln file2.ln

the second pass is executed. lint processes any number of .c or .ln files in their command-line order. Thus,

% lint file1.ln file2.ln file3.c

directs lint to check file3.c for errors internal to it and all three files for consistency.

lint searches directories for included header files in the same order as cc. You can use the -I option to lint as you would the -I option to cc. See 2.16 How to Specify Include Files.

You can specify multiple options to lint on the same command line. Options can be concatenated unless one of the options takes an argument or if the option has more than one letter:

% lint -cp -Idir1 -Idir2 file1.c file2.c

That command directs lint to:

lint has many options you can use to direct lint to perform certain tasks and report on certain conditions.