plint - a C syntax checker


plint [-Dsymbol1] [-Dsymbol2 ...] file1.c [file2.c ...]
plint [-i] [-Dsymbol1] [-Dsymbol2 ...] file1.c [file2.c ...]
plint [-Dsymbol1] [-Dsymbol2 ...] file1.ln [file2.ln ...]


"Thou shalt run lint frequently and study its pronouncements with care, for verily its perception and judgement oft exceeed thine"

Henry Spencer, The Ten Commandments for C Programmers

plint attempts to detect features of C programs which, although perhaps legal, are likely to be bugs. plint checks type usage more strictly than the parasite cross-compiler. Questionable constructs that plint can sometimes find include functions called with varying numbers of arguments, variables and functions that are declared but not used, statements that cannot [logically] be reached, and logical expressions whose value is constant.


Define name as if by a #define directive. -DDEBUG is the classic usage.

Support for incremental linting. Produces a .ln file for every .c file on the command line. These .ln files are to plint what .o files are to the parasite cross-compiler.


For complete information on using lint, see Checking C Programs with lint by Ian Darwin. The following covers the most common usage of plint -- incremental linting via makefiles.

Just as only modified source files need be re-compiled, only modified source files need be re-linted. An appropriately structured makefile facilitates both goals. The net result is that plint never need be invoked manually -- it can happen automatically (and efficiently) as an opening act for the compiler. Given the expense of finding and correcting bugs in parasite programs, incremental/continual linting is highly reccomended. Here's an example makefile:

SRCS=stim.c  data.c  main.c  runtr.c  disp.c  feedbk.c  misc.c  error.c
OBJS=stim.o  data.o  main.o  runtr.o  disp.o  feedbk.o  misc.o  error.o
LNTS=stim.ln data.ln main.ln runtr.ln disp.ln feedbk.ln misc.ln error.ln

$(EXP):		$(OBJS)
		$(CC) -s $(OBJS) -o $@

$(OBJS):	$(INCS)

clean:		#no pre-reqs
		rm -f $(OBJS) $(EXP) $(LNTS)

		$(LINT) -i $(CFLAGS) $<
		$(CC) -c $(CFLAGS) $<
Note that when used incrementally plint creates .ln files e.g. runtr.ln. These .ln files are to plint as .o files are to qcc. make clean (with the above makefile) removes .o and .ln files.


The shell script that is plint. This script calls the host operating system's lint.

The SunOS lint executable.

The standard lint library for parasite, lint-compiled form.

The standard lint library for parasite, lint-source form.


The parasite lint library does not include all parasite library functions. However, all the library functions I've used in the last four years are now included.


Checking C Programs with lint by Ian F. Darwin.