Commit Graph

54 Commits

Author SHA1 Message Date
dholland
3c6470e287 WARNS=4 2008-11-16 07:06:37 +00:00
matt
c58ed3675c Add the complex types to the floating point promotion rules. 2008-09-27 02:30:46 +00:00
matt
9364aa71ae Teach lint about long double _Complex (C99) 2008-09-26 22:52:24 +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
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
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
69ade9fd6e preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
2008-04-25 22:18:34 +00:00
christos
a23f0e5f81 PR/38142: YAMAMOTO Takashi: lint -S complains on variable length arrays 2008-03-04 02:41:46 +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
christos
ec166aba55 Coverity CID 199: make sure that rtp is not NULL before dereferencing. 2006-03-22 02:08:55 +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
christos
5f325e6da0 Shift assignment operators were handled incorrectly. On 64 bit machines,
unsigned long x, y;
	x <<= y;
always produces a warning because y is casted to int. Handle them instead
the same way as regular shifts.
2005-01-02 17:59:47 +00:00
christos
2f2c6dc261 say from what type to what time we are converting. 2005-01-02 10:40:49 +00:00
yamt
2e1baea952 recognize _Bool. 2004-09-12 08:58:52 +00:00
jmc
b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
christos
e3071c679b PR/21706: Krister Walfridsson: CVT nodes not handled in ?: expressions. 2003-05-30 13:37:49 +00:00
wiz
de87ca793d constant usually has two n. 2003-05-14 12:45:06 +00:00
christos
5a3a9e9ea9 add support for ({}) gcc shit. 2002-10-22 22:50:11 +00:00
christos
899427c2e4 handle free-ing of temp symbols properly. Don't segv on bad node types. 2002-10-22 21:09:34 +00:00
christos
c5db62c0ef add C9X/GCC compound literal expressions. 2002-10-22 18:15:00 +00:00
christos
8c326659c6 add variable array dimension. 2002-10-22 13:48:50 +00:00
christos
ff5be0fa49 handle gcc __FUNCTION__ and C9X __func__ 2002-10-22 13:31:34 +00:00
christos
cb118faff0 a cast to a pointer is an l-value. 2002-10-22 00:25:29 +00:00
christos
718a2bccc8 handle cast in the rhs of a - op. 2002-10-22 00:06:46 +00:00
christos
49f5eb9bb9 Ignore cast size test in initializers; look at example in the comment.
Maybe there is a better way...
2002-10-21 22:48:13 +00:00
christos
baa7f9f49e Minimize diffs with my C99 capable version [this commit does not include
C99 support.

- turn lerror() into a macro so that the filename and the line number of the
  error are printed before we abort.
- recurse in type printing to provide the proper type name.
2002-09-13 14:59:24 +00:00
thorpej
b02b24b1d7 Replace u_quad_t with uint64_t and quad_t with int64_t, and use
<inttypes.h> to get those type definitions.  These types are more
portable, and a little more sane to do autoconf tests for.
2002-02-05 03:04:26 +00:00
tv
95407c5758 Use !finite() instead of isinf() in two places for better compatibility. 2002-01-31 22:30:20 +00:00
tv
76834aef57 Protect __RCSID and __COPYRIGHT from being invoked if not defined. 2002-01-31 19:36:47 +00:00
perry
46164f478c Fix a bug in detecting overflow in unsigned multiplication.
XXX Note that the overflow code for many cases seems to be buggy. I've
only fixed one bug that was bothering me. A set of regression tests
and extensive testing are needed.
2001-11-17 04:35:32 +00:00
wiz
456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
lukem
704847f405 cleanup (prior to more adding more features):
- convert to ANSI KNF
- remove trailing whitespace
- translate some comments from german into english

code compiles and runs clean, and tested by running "make lint" against
xlint source using previous and this lint produces same results.
2001-05-28 12:40:37 +00:00
mycroft
a65a57d7b3 Propagate the value and test contexts to the right-hand side of a
comma operator.
1998-07-28 03:39:29 +00:00
mycroft
11177fb359 Search both sides of a comma operator for side effects. 1998-07-27 19:58:43 +00:00
mycroft
defaa2bc6e Fix a recurring typo: comparision -> comparison. 1998-07-27 13:50:46 +00:00
mycroft
eb86b91807 Fix uses of uninitialized memory, and incorrect types for initializers.
From ITOH Yasufumi, PR 5861.
1998-07-27 12:10:22 +00:00
tv
482063559a .y.c <sys.mk> rule fixes. Don't create a y.tab.h file unless asked for,
and use smarter creation of the header file.
1998-04-09 00:32:31 +00:00
christos
a06495e3c4 WARNSify 1998-02-22 15:40:39 +00:00
mycroft
fd38f3efbc Remove hack for (very old) GCC bug on i386. 1997-03-12 18:28:55 +00:00
jpo
c31bb6f41c insert a conversion operator from argument type to parameter type also
if the subtypes of both argument and parameter do not match (use
eqtype() instead of comparing t_tspec fields only).
1995-10-02 17:37:57 +00:00
jpo
0c1422d6bc removed some dubious warnings about conversion of constant operands of
bitwise operators
1995-10-02 17:37:00 +00:00
jpo
e284b17305 allow register variables as left operand of POINT; fixes PR 1442 1995-10-02 17:35:57 +00:00
jpo
e5ba5db05b don't print a warning about use of unitialized variables if one of the
enclosing compound statements had already an asm statement
1995-10-02 17:35:11 +00:00
jpo
5888f3bb16 LINTED and CONSTCOND are now valid up to the next end of a
global or local declaration/definition/statement. Originally they were
valid on the current and next line, which made it hard to suppress
warnings in constructs with more then one line.

LONGLONG can now be used to suppress errors or warnings in the next
declaration, definition or statement.
1995-10-02 17:29:45 +00:00
jpo
bcb6c46ca1 some minor bug fixes 1995-10-02 17:22:46 +00:00
jpo
6910cf7927 prototypes override old style function definitions
this is a gnu extension to ansi c
1995-10-02 17:21:24 +00:00
jpo
2e332f67bf added inline keywords
"inline" is enabled by -g, "__inline" and "__inline__" are always available
1995-10-02 17:14:06 +00:00