Commit Graph

279 Commits

Author SHA1 Message Date
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