Commit Graph

383 Commits

Author SHA1 Message Date
christos 876a5b04b7 compute sizes by the new tsize() function. 2009-10-02 21:04:03 +00:00
christos 19f30f4ea2 fix typedef struct __packed 2009-10-02 20:45:06 +00:00
christos 2144a69bda remove debugging 2009-10-02 19:02:16 +00:00
christos 872e317461 recognize struct __packed x { }; in addition to struct x { } __packed; 2009-10-02 19:01:13 +00:00
christos f07e30ff20 change initialization from non const of regular variables to c99 instead of
gnu since c99 now has it.
2009-10-02 18:17:16 +00:00
christos bb531790dc understand __attribute__((__packed__)) and __packed. 2009-10-02 15:03:45 +00:00
wiz 8356afb2c1 Fix typos in comment. 2009-08-05 19:08:28 +00:00
christos 1a90c89fed Add __alignof__. 2009-05-02 16:10:49 +00:00
christos 6892362adf add variable declarations in for loops for c99 2009-05-01 22:03:36 +00:00
ginsbach 5fabed93f9 Print left and right type and not left type twice. (Hi Christos!) 2009-04-27 15:08:10 +00:00
christos 7f812cd511 Lukemify (WARNS=4) 2009-04-15 01:20:57 +00:00
lukem ae780f8105 Compile lint with WARNS=3.
Currently there are too many -Wsign-compare issues for WARNS=4.
2009-04-14 09:09:59 +00:00
lukem e54a1dbe60 fix -Wcast-qual issues 2009-04-14 09:08:39 +00:00
lukem 4bfb0e2161 Fix -Wshadow and -Wcast-qual issues 2009-04-14 09:06:25 +00:00
lukem 4c61b31086 Fix -Wshadow issues 2009-04-14 09:03:45 +00:00
lukem 4c213f3e71 Fix -Wcast-qual issue 2009-04-14 08:59:45 +00:00
christos 3f7bbc73e3 since we know the types, print what they are in error messages. 2009-04-13 21:17:37 +00:00
joerg fda71aab5e Remove use of .Xo/.Xc to workaround argument number limit. 2009-03-10 13:44:02 +00:00
christos 7c8a9296cc Don't produce type mismatch warnings if one side of ?: is "[qual] void *"
and the other side is "[qual] pointer".
2009-03-02 20:53:10 +00:00
uebayasi febab96b71 Comment out CFLAGS+=-g. 2009-02-14 14:05:58 +00:00
lukem 998789a8d9 this code isn't -Wsign-compare friendly -- drop the WARNS to 3. 2009-02-13 01:27:43 +00:00
joerg 7d8b9145a5 Ignore restrict in the contexts where const and volatile is allowed.
No validation for the use (e.g. that it is used on a pointer), but
enough to not stop valid C99 programs.
2008-12-10 16:12:39 +00:00
dholland 3c6470e287 WARNS=4 2008-11-16 07:06:37 +00:00
dholland 96ee89a3c5 Fix wrong memset; PR bin/39733 from Henning Petersen. 2008-10-13 14:00:37 +00:00
dholland c92bbe4462 Don't accidentally treat "long double" as "long". PR bin/39639. 2008-09-27 20:04:24 +00:00
matt c58ed3675c Add the complex types to the floating point promotion rules. 2008-09-27 02:30:46 +00:00
matt 2ded04cde2 Add a missing label for LCOMPLEX 2008-09-26 23:51:04 +00:00
matt 9364aa71ae Teach lint about long double _Complex (C99) 2008-09-26 22:52:24 +00:00
joerg 8a89a3dc54 Check value range of ULONG and UQUAD values. On 32 bit platforms like
i386 "unsigned long x = 0x800000000UL;" passed lint and gcc complains
(rightfully). Validate quad as well to allow using a potentially larger
type to store the value.
2008-09-10 14:05:00 +00:00
gmcgarry 15631ee3b4 Undefine __PCC__ the same as __GNUC__ inside lint. 2008-08-29 00:44:48 +00:00
apb 4e07a05b2d Lint predefines the following symbols: "__LINT__", "lint", "__lint", and
"__lint__"; not only "lint" as the man page previously claimed.
2008-08-02 12:05:48 +00:00
christos 2703aa2d0d enable -P 2008-07-31 15:25:18 +00:00
christos 8bba9bd7b0 document P 2008-07-31 15:24:09 +00:00
christos 3457928c2a Add Picky flag; this produces more warnings:
1. long a; int i; a = i * i;
   suggests casting i to long, so that we gain precision in the multiplication.
2. warns about magnitude comparisons in enums.
3. warns about possible sign extension issues when integer types become widened.
2008-07-31 15:21:34 +00:00
dsl d4d6980a4b Add a check for 'continue' inside a 'do ... while (0)' loop.
'continue' has the same effect as 'break' - as that probably isn't
what the writer had in mind!
2008-07-25 18:33:53 +00:00
christos 26acf9f9d6 don't check for NaN if fpe. 2008-05-03 16:28:56 +00:00
christos 00c6e78061 Since we cannot guarantee that all machines do ieee math, or that they have
the proper math setup deal with SIGFPE directly.
2008-05-02 15:10:05 +00:00
christos ee5dd5c8d7 fix const and volatile printing in types. 2008-05-01 21:52:19 +00:00
christos 1347903131 PR/38543: Valery Ushakov: Don't crash printing anonymous unions. XXX: Type
printing is phase2 is buggy since it does not print the qualifiers, but this
is for another day.
2008-05-01 15:39:33 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos cb68ac0e9c print the types involved in an error. 2008-04-27 01:45:04 +00:00
christos acfccdf2a5 reorder a couple of error messages. 2008-04-27 00:13:58 +00:00
christos 3123c3e08f Fix complex double to be '\0' instead of 'u', from Nicolas Joly. 2008-04-26 23:34:55 +00:00
christos 0ab7d1a4f5 same change: double is emitted as '\0' 2008-04-26 20:31:45 +00:00
christos 93cd306a8f make the complex float/double annotated consistently with regular float/double. 2008-04-26 20:11:09 +00:00
christos 67cf388a2b print the types involved in the mismatch. 2008-04-26 19:38:30 +00:00
christos b965d925d7 - simplify logic in getting the filename index.
- fix an allocation botch.
2008-04-26 17:11:52 +00:00
christos fec2a3517e fix "long double" type recognition which broke with the complex changes. 2008-04-26 16:14:23 +00:00
christos e92259d4ee handle lintlibrary output of _Complex types. 2008-04-25 22:22:28 +00:00
christos 69ade9fd6e preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
2008-04-25 22:18:34 +00:00
christos 5f562aba67 handle case C1 ... C2: 2008-04-25 17:18:24 +00:00
dholland e93a5674cc Add a little const. 2008-03-30 22:28:41 +00:00
christos a23f0e5f81 PR/38142: YAMAMOTO Takashi: lint -S complains on variable length arrays 2008-03-04 02:41:46 +00:00
lukem cd2d88332f Don't bring in -lutil for tools. 2008-01-11 00:38:10 +00:00
simonb ccab3b34ce Remove support for NetBSD/pc532. 2008-01-10 13:40:36 +00:00
lukem d7382668ef Convert to using raise_default_signal(3). 2008-01-10 05:15:07 +00:00
uwe 17bb5b2554 tlst[inptype(...)] is bad C code because inptype() can realloc tlst
and there's no intermediate sequence point!  We actually hit this on
sh3 with -O2 where gcc4 caches tlst in a register prior to recursive
call to inptype() and if you are unlucky the recursive call needs to
realloc tlst.

Introduce a temp variable to force a sequence point.
2007-09-28 21:53:50 +00:00
scw 5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +00:00
hubertf 6df5e55489 Remove unused ctype.h header.
Contributed by Slava Semushin <slava.semushin@gmail.com> in private mail.
2007-02-07 14:20:58 +00:00
he 3da5bad40a Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.

Discussed with and suggested by christos
2007-02-06 00:08:31 +00:00
christos e903e46b14 deal with hex doubles. 2007-02-02 20:02:18 +00:00
ad c89ec7afee pushinit(): fix a use-after-free bug. 2007-01-20 21:16:23 +00:00
wiz 6c0754a434 Drop trailing whitespace. 2006-12-19 19:06:44 +00:00
christos 4ad17e5702 No need to leave a lot of space between the error number and the message. 2006-12-19 19:02:49 +00:00
christos c613b70040 Xr lint 7; noticed by Anon Ymous 2006-12-19 19:00:20 +00:00
christos f44d03be78 - add debugging to track nowarns
- make /*LINTED*/ take effect on unused functions
2006-11-08 18:31:15 +00:00
christos 39a6c2fdf2 allow 0 sized structs in c9x 2006-10-23 00:15:58 +00:00
christos 5ffa3fb1be add zero sized array handling. It is a little too chatty now. 2006-10-23 00:10:29 +00:00
scw 321742a838 Stick with unsigned long for _BSD_SIZE_T_ regardless of LP64/ILP32. 2006-10-22 11:20:44 +00:00
he f0947b3081 The symbol to define to 1 if a pointer to an int fits in a long is
INTPTR_IS_LONG, not INTPTR_IS_ULONG -- the latter is unused in
other parts of lint's code.  This stops vax's lint from complaining
about conversion of integer constants to 'unsigned long' in function
argument lists, via a proper define of INT_RSIZE in common/inittyp.c.
sh3 defined this to 0, so was actually not affected, but better to
eradicate the typo there as well.
2006-10-20 12:51:12 +00:00
he e02c317333 Simplify the previous change. There's actually no need to treat constants
specially in ptconv(), the constants will be checked in convert() anyway.
2006-10-18 21:34:39 +00:00
he 4228dd3afb Partly redo when to emit warnings for argument type conversions.
Remove the apparently always true "styp(nt) != SHORT" part of the
innermost test.  Allow atomatic conversion of literals as long as
they fit into the target type.

This should fix some of the lint issues in proplib on some of our
platforms.

Approved by christos.
2006-10-18 00:01:19 +00:00
he 081971a032 Use __inline instead of inline, to allow linting of ourselves... 2006-10-17 23:53:30 +00:00
he 62e8b0f3fa Make a minimal attempt at distinguishing between the hosts and the
targets integer data type value ranges.   For now we just use the
hosts uint64_t for parsing & storing integers constants, and test
against the targets limits and assign appropriately, instead of
sometimes (inappropriately) going via the hosts u_long type.  As
long as none of our architectures have target long or quad data
types strictly larger than 64 bits, we should be fine with this
fix.

Furthermore, as they stand at the moment, we can't use the current
TARG_INT_MAX and TARG_LONG_MAX constants in C preprocessor expressions,
so remove the conditional on them being equal.  Yes, this will
produce dead code for some targets.

This allows an ilp32 host to lint for an lp64 target which uses
e.g. the targets ULONG_MAX constant without triggering an "integer
constant out of range" warning.

OK'ed by christos.
2006-10-16 13:33:57 +00:00
christos 2bd08fcc54 in the same way that we need an extra level for arrays, do the same for struct. 2006-10-15 18:18:54 +00:00
christos 3e006796cf previous fix broke array initializers. 2006-10-15 15:08:20 +00:00
dogcow 37bb4f935a do the #ifndef lint dance for __RCSID; also, include the appropriate
headers if cross-building the program in tools/.
2006-10-15 01:16:31 +00:00
christos e578e35910 Fix c99 initialization issues. Now the regression tests work. 2006-10-14 21:08:50 +00:00
peter e263dfd62f WFORMAT is no more... 2006-10-08 17:52:28 +00:00
matt 9e051a8002 Add enough configury glue so that src/tools can build a N64 mips toolchain. 2006-08-25 23:35:04 +00:00
christos eb251235c6 flex arrays are a c9x feature. 2006-07-13 17:49:29 +00:00
christos 692e9c49f5 PR/33984: YAMAMOTO Takashi: lint complains about typedef
The grammar for c99 initializers only looked for name tokens, so if there
was a typedef'ed name it failed. Fixed by looking at all identifier tokens.
2006-07-12 20:03:48 +00:00
mrg d1b9a6c456 allow powerpc64 lint to build (not really tested yet though.) 2006-06-29 23:41:28 +00:00
skrll 683ccd8e40 Add RCSId. 2006-04-17 06:53:06 +00:00
cherry fb4fa95282 xlint for ia64 2006-04-01 09:39:47 +00:00
christos a6ee606509 gcc says case is missing, coverity says case not reached. Appease both. 2006-03-22 16:16:59 +00:00
christos ec4e36f798 Coverity CID 46: Remove dead code. 2006-03-22 02:17:52 +00:00
christos 4b41923ad3 Coverity CID 198: Remove dead code if INT_MAX == LONG_MAX 2006-03-22 02:14:03 +00:00
christos ec166aba55 Coverity CID 199: make sure that rtp is not NULL before dereferencing. 2006-03-22 02:08:55 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
perry cb4a630e29 in several comments:
implizit -> implicit
  explizit -> explicit
2005-09-24 15:30:35 +00:00
christos ddee551034 Handle C99 array range initializers:
type a[] = { [lo ... hi] = c }:
2005-07-17 19:35:48 +00:00
christos fd2a8295bb - make input errors print the lint source line number they are called from.
- simplify a conditional.
2005-07-16 19:54:00 +00:00
skd 14834f0865 Deal with void * types. Approved by Christos. 2005-06-14 03:40:31 +00:00
matt fe3f7b90ff Can't use _LP64 because xlint is a host tool. We need a new define for
when building as a host tool.
2005-06-12 16:56:59 +00:00
lukem 829384f829 appease gcc -Wuninitialized 2005-06-02 04:34:57 +00:00
christos 8b3f9b1455 Factor out tyname() so that it can be used both by lint1 and lint2.
Since type_t is different between lint1.h and lint2.h include the
appropriate file depending on the pass. Make the argument mismatch
error print the type names of the types involved. Now that we have
a tyname() function we can fix the rest of the pass2 warnings to be
more explanatory, but not now.
2005-04-07 16:28:40 +00:00
matt f19d600803 Don't include the powerpc64 definitions in here. Since lint is a host
tool, the hosts definition of _LP64 will confuse things.
2005-02-19 17:15:56 +00:00
dsl a7126d6435 Only pass -Wtraditional to cpp for lint -t ...
Stops warnings about pre-processor constructs like #elif - which there is
no point detecting now that we've changed much of the code to require an
ANSI C compiler.
2005-02-09 21:24:48 +00:00