Commit Graph

488 Commits

Author SHA1 Message Date
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
christos
edf98457e5 sync with reality. 2005-01-26 09:04:49 +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
yamt
496bd8a26d recognize C99 array initializer designators. PR/18896. 2004-08-03 12:11:54 +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
wiz
5ad6c16fa8 Bump date for previous. 2004-01-26 21:59:42 +00:00
dsl
c08c3c342b Pass -MD through to cpp so that it can generate a depend file.
(Actually pass any -M <arg> through, but -MD is most useful.)
2004-01-26 21:51:11 +00:00
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
christos
2a2701085e - keep the fd to /dev/zero open
- take advantage of MAP_ANONYMOUS
2003-10-22 16:10:03 +00:00
christos
58507d43c3 PR/23219: Dan McMahill: Make this compile on system that don't have MAP_ANON.
Centralize the mmap allocations in a new function, xmapalloc() that handles
this.
2003-10-21 23:58:53 +00:00
lukem
130ab7336b Rework how MAKEVERBOSE operates:
*	Don't bother prefixing commands with a line of  ${_MKCMD}\
	and instead rely upon "make -s".  This is less intrusive on
	all the Makefiles than the former.  Idea from David Laight.

    *	Rename the variables use to print messages.  The scheme now is:
	    _MKMSG_FOO		Run  _MKMSG 'foo'
	    _MKTARGET_FOO	Run  _MKMSG_FOO ${.TARGET}
	From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00
lukem
c545cc169d support MAKEVERBOSE 2003-10-19 04:30:30 +00:00
lukem
a694177df5 support MAKEVERBOSE and use ${HOST_SH} 2003-10-19 04:25:00 +00:00
itojun
d5250e4ec9 safer use of realloc 2003-10-16 06:34:19 +00:00
martin
c88a5e7be4 Lint is a host tool - leave the sparc64 hack in place if compiling with
an old compiler.
2003-09-21 17:06:40 +00:00
martin
cee04f319f No need to avoid long double on sparc64 any more. 2003-09-19 16:37:59 +00:00
lukem
a93ea220fc Rework how dependency generation is performed:
* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
  This is a change of behaviour.  If a Makefile wants the clean semantics
  it must specifically append to CLEANFILES.
  Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
  that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d  depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
2003-08-01 17:03:41 +00:00
christos
fb6b32b11b Back out debugging Makefile. 2003-05-30 13:38:09 +00:00
christos
e3071c679b PR/21706: Krister Walfridsson: CVT nodes not handled in ?: expressions. 2003-05-30 13:37:49 +00:00
christos
7d2c2eeaea - make all targparam.h files consistent with the arch includes
- add a new INTPTR_IS_LONG define and use it.

- XXX: the PTRDIFF, SIZEOF, INTPTR defines really make lint more relaxed
  in some platforms than others. We should really be looking for the
  particular tokens to enable this kind of checking. I.e.
  now:

	char *p;
	int foo = (int)p;

  does not produce a warning on INTPTR_IS_LONG == 0 platformas.
  In reality it should only elide the warning if:

	char *p;
	int foo = (intptr_t)p;

  but it is not that smart (yet).
2003-05-29 18:12:13 +00:00
christos
0fe2b9e22b handle void ({ }) 2003-05-24 22:17:46 +00:00
simonb
f7ed8a7482 Move one group of #define's so this looks more like ilp32.h. 2003-05-21 12:09:39 +00:00
christos
1a57478e96 Better implementation of ({}) gcc extension. 2003-05-20 13:59:32 +00:00
kristerw
8e46e7bae0 Prevent use of stale pointer for determining return type of ({ })
expressions.

Details:
lint did fail on constructs like

   struct foo *x;
   x = ({ struct foo *y; /* do stuff */; y;});

since it gave the whole ({ }) the same structure representing the
type as y, but that structure is reclaimed when y goes out of scope.
2003-05-18 23:30:00 +00:00
lukem
826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
wiz
de87ca793d constant usually has two n. 2003-05-14 12:45:06 +00:00
dbj
f1e0ecadf7 remove dependencies on ${LIBC} ${LIBM} and ${LIBTERMCAP} static libraries
from host tool targets.  Commits fix from PR toolchain/21495
2003-05-14 00:24:06 +00:00
lukem
ef83aa34d9 clear errno before strto(u)l() if we're going to test it for ERANGE afterwards 2003-04-18 03:21:00 +00:00
wiz
0aa9f9348a Fix part of last. 2003-04-08 21:09:40 +00:00
jmmv
d20b88e377 Homogenize paragraphs to begin with capital letter. Fixes my own PR misc/18773. 2003-04-08 17:25:15 +00:00
wiz
990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
simonb
276fd1665c The Double-Semi-Colon Police. 2003-01-20 05:29:53 +00:00
wiz
c6f1277bfa synchronous, not syncronous. 2003-01-06 13:10:25 +00:00
thorpej
8fb0e9f9e9 Include <string.h> for prototypes. 2002-12-06 03:27:39 +00:00
thorpej
7d013a7ef5 Skip passing -$ to the preprocessor, for now. 2002-11-24 20:24:54 +00:00
christos
67dc335c98 PR/18896: Jason Thorpe: C99 structure member initializers broken for arrays.
XXX: The checking done does not work, but the code passes.
2002-11-13 21:50:57 +00:00
perry
5f042d3d69 add a comment on c99ism noting that the logic might be wrong but we
haven't yet decided on what combinations of -s and -S really are
intended to mean yet.
2002-11-02 20:14:10 +00:00
perry
22f5530a1a Make long long a c99ism, not a gnuism. 2002-11-02 20:10:16 +00:00
perry
cca1626bfa add c99ism(), by analogy to gnuism(), for c99 construct (un)warnings 2002-11-02 20:09:27 +00:00
perry
ab74747a8d 1) // is only for c99 or gcc
2) inline is acceptable in c99 -- create a new c99 keyword class.

XXX The handling of sflag and Sflag is utterly bogus throughout this
pass. I think I have to make some adjustments.
2002-11-02 01:42:22 +00:00
christos
c7e6cd9edb mention what is wrong with the ({}) productions. 2002-10-23 13:01:16 +00:00
christos
fa292fcfa7 forgot to commit those. 2002-10-23 00:36:36 +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
e6e5ec1d1b fix spelling in comment. 2002-10-22 13:30:23 +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
18a706cc53 fix typo 2002-10-21 22:44:08 +00:00
christos
8638e1a5b8 add -S flag for c99 support. 2002-10-21 21:16:12 +00:00
christos
66cab14e3e support for c99 style and gnu style structure and union named initializers. 2002-10-21 21:14:51 +00:00
wiz
44f2153f1e Ispell. Begin new sentences on a new line. 2002-09-26 01:09:46 +00:00
lukem
5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +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
grant
eda9e509bb sweep of errx/warnx, remove unnecessary trailing \n 2002-07-20 08:40:16 +00:00
scw
caf50cac16 SH5 lint target params. 2002-07-11 18:55:13 +00:00
jmc
855a0649f3 Change xgetblk to detect cases where the requested size is more than mblklen.
(generally it's 20k). Adjust mblklen temporarily to the size of the block
required and allocate one. This avoids coredumps when mapping in identifiers
that have huge values. (In my example it was a char[] for a 640k pixmap).
2002-06-28 05:03:55 +00:00
simonb
4feaf5241d Use findcc() from ../mkdep so ${CC} can contain multiple tokens instead
of trying to exec the whole contents of ${CC}.
2002-06-14 23:20:42 +00:00
wiz
8a965ad2f1 Remove some __STDC__ tests. 2002-06-13 23:00:16 +00:00
wiz
3bab7054f4 Remove some unnecessary Ns. 2002-06-13 22:59:02 +00:00
fredette
5b01583a40 Added hppa support to xlint. 2002-06-06 20:33:33 +00:00
tv
6057928f1a Rename basename' as lbasename' so as not to confuse with the libgen.h
prototyped function of the same name.
2002-03-07 20:17:37 +00:00
tv
1d5b3f55ff Revert previous; <inttypes.h> is auto-generated-empty now. 2002-03-07 19:19:14 +00:00
tv
37ef6828bc Autoconf bracket #include <inttypes.h>. 2002-03-07 18:29:56 +00:00
thorpej
b6d2afdc45 Add constants that describe the target's max/min INT, UINT, LONG, ULONG,
QUAD, and UQUAD values.
2002-02-20 16:10:34 +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
thorpej
b985fb5f23 Need <bsd.own.mk> to use ${MACHINE_CPU}. 2002-02-04 08:37:37 +00:00
thorpej
a53ece1b64 On m68000, we need different target parameters than on m68k,
because "long double" is a different size on m68000.
2002-02-04 00:18:32 +00:00
lukem
9c3323249d need -lm in the HOSTPROG case too... 2002-02-01 05:44:40 +00:00
ross
4ecd3ab001 now needs -lm for finite(3) 2002-02-01 01:32:20 +00:00
he
1bf20079aa Typo correction. 2002-01-31 23:31:34 +00:00
tv
9fbd88883c Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
  sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
2002-01-31 22:43:33 +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
tv
6980d8094a Use setprogname() in main(). 2002-01-31 19:33:50 +00:00
tv
dd39a6001e Provide a placebo default for ALIGN() for hosts which don't have this. 2002-01-31 19:33:27 +00:00
tv
084822fde7 * Use setprogname() in main().
* Don't grossly abuse getopt(); allow only -l and -L after filenames are
  encountered, and do the parsing of these options manually.
2002-01-31 19:09:33 +00:00
thorpej
1e27695917 Define FLOAT_SIZE, DOUBLE_SIZE, LDOUBLE_SIZE, and ENUM_SIZE in
target-specific headers, and use the definitions when initializing
the type table.
2002-01-30 06:54:56 +00:00
thorpej
65260ae99b Add a missing "static" on a function decl. 2002-01-30 06:48:32 +00:00
tv
1ae7d35cc2 Remove #include <err.h> (now in lint.h). 2002-01-29 02:43:38 +00:00
thorpej
6e4e75cdae Add a missing "break;" statement so that this actually works again. 2002-01-22 01:14:03 +00:00
tv
44fbde6015 Add hooks for compiling on non-NetBSD hosts. 2002-01-21 19:49:51 +00:00
thorpej
81a86a8f72 Centralize the initialization/declaration of the ttab. 2002-01-18 21:01:38 +00:00
thorpej
41d48940fa * Move stuff shared between lint1 and lint2 to the new common/ directory.
* Move the arch/ directory out of lint1/ into the top-level.
2002-01-18 20:39:17 +00:00
thorpej
55e9ae94b2 Initialize the type table with the correct type sizes for the target. 2002-01-18 20:14:32 +00:00
tron
a86fbba5c1 Add "case" statements for "NTSPEC" to fix "gcc" warnings. 2002-01-03 18:50:54 +00:00
thorpej
c5e919f6c9 Make sure the tspec_t enum starts at 0, and declare NTSPEC in
the enum proper.
2002-01-03 05:37:39 +00:00
thorpej
c73e79666d Simplify test for integer types in the BITFIELDTYPE handling path. 2002-01-03 05:26:53 +00:00
thorpej
9971ed0315 * Add header files (ilp32.h and lp64.h) that describe the two
models of type sizes that we currently support, and include
  the appropriate one in each arch's targparam.h.
* Use the type size constants provided by targparam.h in the
  type table, rather than using "sizeof(type) * CHAR_BIT" (which
  would get the host's type size, not the target's).  XXX Not
  yet done for floating point types.
* Add a new BITFIELDTYPE lint comment that suppresses illegal
  bitfield type errors if the type is an integer type (e.g.
  long, long long), and also suppresses non-portable bitfield
  type warnings.
2002-01-03 04:25:14 +00:00
wiz
eeb870f152 Fix typo. 2001-12-24 20:52:09 +00:00
tv
b8cee5e237 If USETOOLS=yes, as in a cross build or standard tool-based build, create
lint1.7 using the host lint1 tool.  Otherwise run lint1 from here, as has
been done historically.

Should fix toolchain/15001.
2001-12-19 18:10:40 +00:00
augustss
a30c07720a Don't use fd_set to keep track of errors to ignore. Doing so relies on
overriding FD_SETSIZE.  Not overriding it makes it stomp all over memory
(which caused the debug outputs we've seen lately).
It used to work, but toolification of lint broke it.
2001-12-13 23:56:00 +00:00
tv
8e6f7afb5b MKfoo=no -> NOfoo 2001-12-12 01:48:43 +00:00
wiz
a775ffcd09 Punctuation nits. 2001-12-08 19:27:56 +00:00
wiz
b4371d47f5 Replace some misuses of "then" with "than". 2001-12-04 17:56:30 +00:00
wiz
1fd7eeefcd "than" instead of "then". 2001-11-21 19:14:19 +00:00
wiz
55e6492076 Explicitly write explicitly without a second e. 2001-11-21 17:33:26 +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
tv
b5cd2489b2 Major overhaul of src/tools and host toolchain. Summary of changes:
* Rewrite src/tools Make logic to work like the rest of the tree wrt
  "dependall" and "install".  The old "make build" hack is gone.

* Remove the MKTOOLS logic.  This was linked to the "make build" hack,
  and was only needed because TOOLDIR originally had no writable default.

* Redo the GNU configure/make logic to make it fit reasonably in a
  BSD make wrapper.  Use new ${.ALLTARGETS} variable to scan for
  targets in $(srcdir), and mark them with .MADE: to prevent rebuilding.

* Only build cross tools in src/tools; remove some messy logic in
  src/usr.* and src/gnu/usr.* that would do target filename rewriting
  (improves consistency and readability).

* Add the ability to build cross gdb at tool build time by setting
  MKCROSSGDB (default no) to "yes" in mk.conf.

* Add src/tools/groff and set up paths to work with this cross groff.
2001-11-12 23:16:17 +00:00
yamt
9ab12a24fa our wchar_t is int, not short. 2001-10-28 05:24:37 +00:00
thorpej
5f0a22902a Give host tool builds better control over the HOST_CPPFLAGS. 2001-10-25 02:22:55 +00:00
thorpej
75f45f0ffb Add support for putting prefixes on the name of lint(1)'s front
and back ends.  This means that it can be built as a cross tool.
Part of the fix for bin/14280.
2001-10-24 02:31:09 +00:00
tv
d3c2262c8b Back out part of rev. 1.16 (my build didn't pick up the -I from
../Makefile.inc the first time around, for some reason.)
2001-10-24 01:12:45 +00:00
thorpej
20d4cc1a5a Set a CPP define on the command line to indicate which object
format lint(1) is being targeted at, and use this knowledge
as appropriate in the target param headers.
2001-10-24 00:42:35 +00:00
tv
b96cc8c40e Let lint.7 get auto-built by the bsd.man.mk logic (don't explicitly depend
on it via "realall:").  Fixes lint.7 problem in src/tools reported by mrg.

While here, actually -I the arch subdir to pull in the correct targparam.h.
2001-10-24 00:07:39 +00:00
jmc
d63596f307 Move CPPFLAGS addition for lint1/arch to Makefile.inc so each subdir will
pick them up
2001-10-22 05:19:31 +00:00
thorpej
62f88da44c Split out target parameters into separate header files, and
pull the correct one in based on the MACHINE_CPU variable.
MACHINE_CPU will be set according to the target system we are
building for by <bsd.own.mk>.

One component of addressing bin/14280.
2001-10-21 21:39:49 +00:00
bjh21
67fe54beb4 On ARM ELF platforms, size_t and ptrdiff_t are u_long and long respectively.
See <arm/ansi.h>.
2001-10-06 12:25:56 +00:00
wiz
9fa0b17629 Give initiali[sz]e all the "i"s it deserves. 2001-09-18 18:15:49 +00:00
wiz
456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
wiz
1e378c4c12 precede, not preceed. 2001-08-20 12:00:46 +00:00
eeh
7cac6218f0 Don't use long double on sparc64 since the compiler is borked. 2001-08-17 05:49:43 +00:00
tv
dba5d44670 Add hooks to allow toolchain bits to be reachover-built at the top level. 2001-08-14 10:18:26 +00:00
wiz
30b2bf87ed Various typos in comments (neccessary, sceme, choise, ...). 2001-07-26 15:05:07 +00:00
wiz
878e08cf00 Nits. 2001-06-05 11:56:28 +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
lukem
905f1ba6a0 support // comments if -g is given 2001-05-24 12:10:39 +00:00
lukem
2179a14315 oops! delint previous 2001-05-24 12:05:28 +00:00
lukem
c33b2caa30 allow trailing , in enum if -g 2001-05-24 11:58:09 +00:00
lukem
67252d9cad minor whitespace/knf 2001-05-24 11:56:36 +00:00
lukem
18dddf4476 allow trailing , in enum if -g 2001-05-24 11:56:03 +00:00
sommerfeld
3cdcf0dfc6 Change type of anonymous bitfield pads so that lint -p no longer generates a
portability warning.
2001-05-19 17:19:00 +00:00
lukem
42f4b2cf45 only error on a newline in a string if -t (traditional) mode is enabled, since
ansi c supports multi-line strings without the trailing \n\ ...
2001-05-07 09:02:55 +00:00
lukem
b1e062a80e s/refferd/referred/ 2001-04-29 12:02:45 +00:00
simonb
a69a3cc5ec Spell occurred correctly. 2001-04-25 02:19:48 +00:00
cgd
fd8d16c72f fix broken NetBSD RCS id tags 2001-02-24 00:43:50 +00:00
cgd
c2bdafab79 use getprogname() 2001-02-20 23:51:59 +00:00
cgd
a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00
bjh21
422a592092 __arm26__ || __arm32__ -> __arm__ 2001-02-10 19:15:24 +00:00
enami
b25b640d38 No space is allowed before comma in optarg for -X option. 2001-01-23 23:06:11 +00:00
wiz
18f3d66238 Handle arguments in a slightly more standard way (avoid resetting optind). 2000-11-27 00:54:25 +00:00
mrg
f81973bb8f sparc & sparc64 use `long' for ptrdiff_t. 2000-11-08 02:30:22 +00:00
is
135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
cgd
b653335cf3 don't build lint libs if MKLINT == no 2000-07-27 03:29:28 +00:00
mycroft
6ea1997e79 Fix problem building lint.7. 2000-07-23 22:17:14 +00:00
christos
6fa36b3bb7 better way to handle lint.7 2000-07-06 01:21:46 +00:00
christos
b28978bb69 document new flags. 2000-07-06 01:17:18 +00:00
christos
17ac48f4b1 pass -X <id>[,<id>]... and -w to lint1 2000-07-06 01:12:24 +00:00
christos
ab89a2b0b0 build lint.7 man page 2000-07-06 01:11:23 +00:00
christos
4017aef2ee add 3 new flags:
-m print message list
-X <id>[,<id>]... suppress error messages with give ids.
-w treat warnings as errors.
2000-07-06 01:10:51 +00:00
christos
86cf133f3b new function and new flag... 2000-07-06 01:09:56 +00:00
christos
2e6af79a57 - support for -X flag
- support for -m flag
- print the error number in each message
2000-07-06 01:09:20 +00:00
christos
3c68257297 new script to generate a man page of error messages that lint generates 2000-07-06 01:08:10 +00:00
christos
5c2e510661 Prevent lint1 from coredumping on invalid c code such as:
foo((sockaddr *(void *))0);

This fix is imperfect, because right now we just check the subtype
chains for NULL and we return to the caller when the loop ends, leaving
the upper layers to cope with the syntax error. Ideally we should:

	a.) return an error to the upper layer, or
	b.) not call the type analysis routines in the presence of a syntax
	    error.

That would require a significant re-write which would take much more time
than I have...
2000-07-05 22:50:59 +00:00
matt
fcd0fb118f Make gcc 2.96 (and maybe earlier) happier. Include <stdlib.h>,<string.>,
etc. as appropriate to get exit,srncmp,abs,abort,etc.
Add -I${.CURDIR} to a few Makefiles
2000-07-03 02:51:12 +00:00
wrstuden
0e530441c1 Use execvp() instead of execv(). Deals with the case where CC, the compiler,
is not a full path. For instance, "cc".
2000-06-29 02:56:47 +00:00
matt
60dec93655 change lint to ${LINT} ${LINTFLAGS} so that includes in ${DESTDIR} are used. 2000-06-14 20:22:19 +00:00
cgd
d220ca5ba3 fix up NetBSD RCS Ids to match the standard, and the leading comment as
to match as well.  No functional changes.
2000-06-14 06:48:47 +00:00
simonb
659b78955d Don't need local extern declaration of strtouq() - it's in <stdlib.h>. 2000-05-10 05:09:17 +00:00
bjh21
6c97e2bd78 Initial commit of arm26 port 2000-05-09 21:55:44 +00:00
bad
dc38443eae Catch up with changing size_t to ulong on sparc 10 months ago. 2000-04-09 01:08:17 +00:00
garbled
86e14c4a11 Add parsing of the CC env variable, and a -Bpath flag (for /usr/libexec)
so cross-building of lint libraries can be made possible.  Tested
building a powerpc libc via make build on an alpha.
2000-03-22 01:09:34 +00:00
soren
89c5a767f8 Fix doubled 'the's. 2000-03-13 22:55:05 +00:00
mycroft
c2c3950608 More .mk file fallout. *sigh* 2000-01-23 20:59:11 +00:00
itojun
bb41dd1eaa add "#ifdef __sh3__" section.
(part of NetBSD/sh3 patches)
1999-09-12 16:10:45 +00:00
kleink
938ac456e0 Define __LINT__, per XCU5. 1999-09-09 09:34:25 +00:00
jwise
75eb9e11a9 Slight improvement to last fix: don't need to reset the cpp tempfile for
files which don't need to be run through cpp.  Also, use vfork() instead of
fork().

Both from Anders Hjalmarsson (Anders.Hjalmarsson@economics.gu.se)
1999-09-07 02:36:57 +00:00
jwise
6c0498c892 Apply fix from PR bin/8328 by Anders Hjalmarsson (Anders.Hjalmarsson@economics.gu.se):
work properly again when passwd multiple files on the command line.
1999-09-06 06:45:20 +00:00
christos
f53f008dfb More cosmetics in the usage message... 1999-05-03 15:45:01 +00:00
christos
5cb75fd417 Now that we use cc -E, -U__GNUC__ to avoid gnu extensions. Nuke the
__attribute__ and __extension__ workarounds.
Our invariant is: No gcc extensions if __GNUC__ is not defined, so lint
should not be playing around trying to pretend it is gcc.
1999-05-03 15:23:27 +00:00
christos
e782f12df1 Deal with gcc __extension__({ }). We assume that it returns a value 0, and
we prepend a /*NOSTRICT*/ comment to avoid constant in conditional context
warning.
1999-04-29 12:40:39 +00:00
mrg
b30d0fe7ba use "cc -E" not cpp directly. this allows lint(1) to be unaware of any
machine-dependant defines that cc(1) may normally define, and also
means that the mips ports work again.
1999-04-22 04:40:58 +00:00
garbled
9e44e9b578 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:16:34 +00:00
ross
7f8e818918 Missing .El. 1999-03-09 03:19:28 +00:00
mycroft
a1c657fe56 Clean up SYNOPSIS formatting. 1999-03-07 11:29:58 +00:00
lukem
dcab0210a0 convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
1999-02-13 02:54:17 +00:00
christos
487c013c51 char -> unsigned char 1998-12-20 19:05:19 +00:00
christos
8f9762f2e2 pass -CC instead of -C to cpp so that we preserve macro comments in place. 1998-12-09 12:28:36 +00:00
christos
d79deccee9 Unfortunately lint uses c-style comments as directives and these get parsed
at the lexical analysis stage not at the syntax parsing stage. The upshot
is that:
	if (expr) {
		stmt1;
	}
	/* LINTED */
	stmt2;

stmt2 is the look-ahead token for the parser to choose between and if-then-else
statement as opposed to an if-then statement. Unfortunately the side effect
is that the LINTED directive gets reset before stmt2 gets parsed. We fix this,
by remembering the the linted directive during the if statement parsing and
restoring it at the appropriate time.
1998-11-23 14:37:08 +00:00
christos
e79f03e595 Fix problems with LINTED comment:
if (a) b;
	/*LINTED*/
	c;

	if (a) { b; }
	/*LINTED*/
	c;

	do { b; }
	/*LINTED*/
	while (c);

Produced warnings for c.
1998-11-13 16:48:01 +00:00
itohy
a42010baf2 Eliminate memory leaks at case labels. 1998-10-10 20:51:48 +00:00
itohy
edb019abaf Eliminate memory leaks.
Use  xrealloc()  rather than  xmalloc/memcpy/free  trio.
1998-10-08 08:20:37 +00:00
wsanchez
9e44eb8cc1 Add __ppc__ test 1998-10-08 01:30:50 +00:00
mycroft
49b1e89cfe If the return value is sometimes discarded, output `sometimes ignored' rather
than `always ignored'.
1998-07-28 05:12:00 +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
tv
c3932dd723 Fix __RCSID() macro 1998-04-07 19:27:24 +00:00
sommerfe
bf7d5c8de3 Add -d option, so lint can be used safely when we're not building "in
place" (e.g., when DESTDIR is set).  This causes the lint driver to
pass -nostdinc -idirafter <dir> to cpp, causing it to ignore
/usr/include and look somewhere else instead..
1998-03-24 23:25:31 +00:00
christos
a06495e3c4 WARNSify 1998-02-22 15:40:39 +00:00
cjs
8b57d60845 I do wish people would start including <string.h> when they use memcpy. 1997-11-06 15:47:23 +00:00
cgd
f9356d1960 implement (hack in) symbol (function and variable) renaming, so that
the function renaming tricks currently needed by libc can be tolerated
by lint.  This needs some cleanup, but it appears to work.
1997-11-03 22:36:31 +00:00
cgd
206f92eed6 in chkdnud(), don't warn if the defined-but-not-used object is a function.
chkdnud() is used (only) to implement the -x option, which is supposed to
warn for variables only.
1997-11-03 22:33:53 +00:00
veego
aea22d6b9c Don't use " inside an '.if exists()' 1997-10-24 12:14:57 +00:00
lukem
8ba07ab0b3 use CPPFLAGS instead of CFLAGS 1997-10-24 09:00:17 +00:00
lukem
9ae9df9346 add Makefile.inc to turn off WARNS, and use it 1997-10-20 04:28:24 +00:00
mycroft
004f255040 Use S_IS*(), not S_IF*. 1997-10-19 19:27:40 +00:00
mikel
3f0dbdf761 xref exit(3) not exit(2) 1997-07-10 07:57:07 +00:00
veego
cb2070d1b6 Replace the clean target with a CLEANFILES+= line 1997-05-15 10:08:47 +00:00