1.指定显示等级
//lint -w2
在源代码第一行加,//和lint之间不能有空格。
the warning level to 3 (the default) and a richer set of diagnostic messages will issue forth.
2.检查源码是C++还是C
For example:
lin -u alpha.cpp
comments:
Often it is better to first do a unit checkout (using the -u option) on separate modules.
3.Extents for C++ Modules
lin +fcp a1.c a2.c a3.c -fcp a4.c a5.cpp
will treat a1.c, a2.c and a3.c as C++ modules, a4.c as a C module and a5.cpp as a C++ module.
comments:
+fcp indicates that the next module(and subsequent modules) will be a C++ module. This will remain in effect until turned off with -fcp.
4.
co-....lnt Compiler options file(s)
env-....lnt Environment options files
lib-....lnt Library options files
lib-....h Headers referenced by lib-....lnt files.
au-....lnt Options files for author recommended checks
*.cpp(*.c) source code
5.The option +cpp(extension) can be used to add to the list of C++ extensions. Thus
lin +cpp(cc) a1.cc a2.cc a3.c a4.cpp
will process a1.cc, a2.cc and a4.cpp as C++ modules and a3.c as a C module.
6.suppress lint's message
Messages may also be suppressed by message number.
example:
lin -e547 gamma.c
to suppress Warning 547
7.Indirect files can contain embedded environment variable names (Section 4.1
Indirect (.lnt) Files.
8.
We have added a number of files of the form env-....lnt that assist in the process of integration with particular
IDE's. At this writing this list includes:
File Environment
env-BC5.lnt Borland's 5.0 IDE
env-bwin.lnt Borland's 4.0 IDE under Windows
env-cw.lnt Premia Codewright
env-pwb.lnt Microsoft's Programmer's Work Bench
env-si.lnt Source Insight Editor
env-sled.lnt Visual Slick Edit
env-tide.lnt Turbo/Borland IDE under DOS
env-vc.lnt Microsoft's Visual C/C++, Version 1
env-vc2.lnt Microsoft's Visual C/C++, Version 2
env-vc4.lnt Microsoft's Visual C/C++, Version 4
env-vc5.lnt Microsoft's Visual C/C++, Version 5
Instructions for using these .lnt files appear as comments within the files themselves. Simply print them
out and follow the directions.
9.create a lint project file from a .dsp file.(.dsp file:DeveloperStudio Project,visual studio's project file)
lint-nt project.dsp >project.lnt
10. use the verbosity option to trigger a message for each line
example:
lint-nt -v1 project.dsp >project.lnt
使用v*(*代表数字)选项,则每过*行,就显示verbosity message 。
11. allows the user to define preprocessor variables (and even function-like macros) from the command line
form:
-d"name=value"
+d"name=value"
An option of the form +d... behaves like -d... except that the definition is locked in and will be resistant to change even though a subsequent #define of the same name is encountered.
12.
For unit checkout, you may want the list of options but not the list of modules. For this purpose, use the --u option (as opposed to -u). For example:
lin --u project.lnt alpha.cpp
This will do a unit check using all the options within project.lnt but none of the modules. Only alpha.cpp will be processed.
99.examples:
lin -u -w2 alpha
the command line
form:
lint options file1 [ file2 file3 ... ]