1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
/* Date Stamp */ -d"_lint_co_gcc_lnt=co-gcc.lnt modified 12-Jun-2014"
/* To document usage use: -message( "Using " _lint_co_gcc_lnt ) */
// ---------------------------------------------------------------------
// This file is provided by Gimpel Software (www.gimpel.com) for use with
// its products PC-lint and FlexeLint.
//
// Redistribution and use of this file, with or without modification, is
// permitted provided that any such redistribution retains this notice.
// ---------------------------------------------------------------------
/* co-gcc.lnt: This is the seed file for configuring Lint for use with
GCC versions 2.95.3 and later.
Like all compiler options files this file is intended to be used
as follows:
lint co-gcc.lnt source-files-to-be-linted
Some of the information that co-gcc.lnt requires needs to be furnished
with the help of the gcc system itself. The easiest way to generate
this information is to use the makefile co-gcc.mak (supplied with the
Lint distribution) in an invocation of GNU Make; for details, see the
commentary at the top of co-gcc.mak.
*/
-cgnu // Notifies FlexeLint that gcc is being used.
// ===========================
// Preprocessor Configuration:
+fdi // GCC starts its #include search in the directory of the including
// file.
++fln // Allow:
// # digit-sequence " [s-char-sequence] " new-line
// as a synonym for:
// # line digit-sequence " [s-char-sequence] " new-line
// GCC additionally allows flag values to follow the
// s-char-sequence, but currently Lint ignores them.
@INCLUDES@
// Assertion directives (a feature of GCC's preprocessor) have been
// considered obsolete in GCC's documentation since version 3.0, so we do
// not use them here. If support for #assert is needed in the form of a
// lint option, one may use '-a#' like so:
// -a#machine(i386) // #assert's machine(i386) (SVR4 facility).
// File extensions:
// From the GCC man page:
//
// file.cc
// file.cp
// file.cxx
// file.cpp
// file.CPP
// file.c++
// file.C
// C++ source code that must be preprocessed. Note that in .cxx, the
// last two letters must both be literally x. Likewise, .C refers to
// a literal capital C.
//
// We emulate this with:
+cpp(.cc)
+cpp(.cp)
+cpp(.cxx)
+cpp(.cpp)
+cpp(.c++)
// Note the exceptions:
// +cpp(.CPP)
// +cpp(.C)
// These are commented out for the default config because they seem to
// cause trouble more often than not. For starters, it is problematic
// with filesystems that are case-insensitive (which has become common
// even on some POSIX systems).
// =============
// Size Options:
// +fwc // wchar_t might be builtin; if so, uncomment this option. (NOTE:
// // this option needs to be set before a size option is given for
// // wchar_t; see the documentation for -sw# in the Lint manual.)
// size-options.lnt // This .lnt file should be generated (preferrably
// by a program created by invoking GCC with the compile options that
// are used in the compilation of the project to be linted). This
// happens automatically when 'make -f co-gcc.mak' is invoked.
// ===========================================
// +rw and -d options to cope with GNU syntax:
+ppw(ident) // Tolerate #ident
+ppw(warning)
// GCC provides alternative spellings of certain keywords:
+rw(__inline)
-rw_asgn(__inline__,__inline)
-rw_asgn(__header_always_inline,__inline)
-rw_asgn(__header_inline,__inline)
-rw_asgn(__signed__,signed)
-rw_asgn(__signed,signed)
-rw_asgn( __volatile__, volatile )
-rw_asgn( __volatile, volatile )
+rw(restrict)
-rw_asgn(__restrict,restrict)
-rw_asgn(__restrict__,restrict)
++d"__const=const" // gconv.h uses __const rather than const
++d"const=const" // ensure const expands to const.
-rw_asgn( asm, _up_to_brackets )
-rw_asgn( __asm, _up_to_brackets )
-rw_asgn( __asm__, _up_to_brackets )
// This re-definition of the various spellings of the asm keyword enables
// Lint to pass gracefully over expression-statements like:
// __asm __volatile ("fsqrt" : "=t" (__result) : "0" (__x));
// But it may be necessary to suppress certain error messages that are
// triggered by tokens that are part of an assembly declaration or
// statement. For example:
-d"__asm__(p...)=/*lint -e{19}*/ __asm__(p)"
// ...causes Lint to be quiet about the semicolon that follows an
// __asm__() declaration. Note, the -e{N} form of suppression takes
// effect only for the forward-declaration, definition or
// [possibly-compound] statement that immediately follows. Because a
// semicolon is seen as a declaration-terminator, Error 19 will be
// re-enabled immediately after the semicolon in '__asm__(...);'.
// (The elipsis after the macro parameter p allows zero or more commas to
// appear in the operand.)
//
// If you encounter other diagnostics that appear to need suppression in
// or near assembly regions, please let us know!
//
-esym(123,__asm__)
++d"_Static_assert(...)=/*lint -e{19}*/"
-rw_asgn(__alignof__,__alignof)
// "__extension__" is GCC's way of allowing the use of non-standard
// constructs in a strict Standard-conforming mode. We don't currently
// have explicit support for it, but we can use local suppressions. For
// example, we can use -e(160) so that we will not see any Errors about
// GNU statement-expressions wrapped in __extension__().
++d"__extension__=/*lint -e(160) */"
++d"__null=0"
+rw(_to_semi) // needed for the two macros above.
+rw(__typeof__) // activate __typeof__ keyword
-d"__typeof=__typeof__" // an alternative to using __typeof__
-rw(__except) // This MS reserved word is used as an identifier
+rw( __complex__, __real__, __imag__ ) // reserved words that can be ignored.
++d"__builtin_strchr=(char*)" // permits the inline definition ...
++d"__builtin_strpbrk=(char*)" // of these functions to be linted ...
++d"__builtin_strrchr=(char*)" // without drawing a complaint
++d"__builtin_strstr=(char*)" // about the use of a non-standard name
++d"__PRETTY_FUNCTION__=___function___" // lint defines ___function___ internally
++d"__FUNCTION__=___function___" // lint defines ___function___ internally
++d"__func__=___function___" // Some C++ modes suport the implicit __func__
// identifier.
-ident($)
// =========================================================
// Other options supporting GNU C/C++ syntax:
+fld // enables the processing of _L_abel _D_esignators E.g.:
// union { double d; int i; } u = { d: 3.141 };
// =========================================================
// Generally useful suppressions:
-wlib(1) // sets the warning level within library headers to 1
// (no warnings, just syntax errors). Comment out if you
// are actually linting library headers.
-elib(123) // 123 is really a warning, but it's in the "Error" range.
-elib(93) // allow newlines within quoted string arguments to macros
-elib(46) // allow bit fields to have integral types other than
// '_Bool' and 'int'.
-elibsym(628) // Suppress 628 for __builtin symbols.
-esym(528,__huge_val,__nan,__qnan,__qnanf,__snan,__snanf)
// We don't care if we don't reference some GNU functions
-esym(528,__gnu_malloc,__gnu_calloc)
// The following functions exhibit variable return modes.
// That is, they may equally-usefully be called for a value
// as called just for their effects. Accordingly we inhibit
// Warning 534 for these functions.
// Feel free to add to or subtract from this list.
-esym(534,close,creat,fclose,fprintf,fputc)
-esym(534,fputs,fscanf,fseek,fwrite,lseek,memcpy,memmove,memset)
-esym(534,printf,puts,scanf,sprintf,sscanf,strcat,strcpy)
-esym(534,strncat,strncpy,unlink,write)
// For non-ANSI compilers we suppress messages 515 and 516
// for functions known to have variable argument lists.
// For ANSI compilers, header files should take care of this.
-esym(515,fprintf,printf,sprintf,fscanf,scanf,sscanf)
-esym(516,fprintf,printf,sprintf,fscanf,scanf,sscanf)
-esym(1702,*operator<<,*operator>>)
-esym(534,*operator<<,*operator>>)
-esym(1055,*__builtin*)
-esym(718,*__builtin*) // The compiler does not need these ...
-esym(746,*__builtin*) // declared and it knows their prototypes.
-rw_asgn(__attribute__,__gcc_attribute__)
-rw_asgn(__attribute,__gcc_attribute__)
--u"__attribute__"
--u"__attribute"
+linebuf
+linebuf
//-esym(507, MII_readRegister)
-e507
-sp4
-e755
-e756
-e768
-e526
-e793
|