Home | History | Annotate | Download | only in lint1
History log of /src/usr.bin/xlint/lint1/Makefile
RevisionDateAuthorComments
 1.106  08-Jun-2024  rillig tests/lint: reorganize tests

Tests for a single working language construct don't usually need a
separate file, they can be grouped together, like in expr.c or gcc.c.
 1.105  08-Jun-2024  rillig tests/lint: remove unused lint1-skip-if selector
 1.104  01-Mar-2024  rillig lint: test format strings from snprintb calls

The functions snprintb and snprintb_m are specific to NetBSD, and their
format strings are tricky to get correct. Provide some assistance in
catching the most common mistakes.
 1.103  06-Feb-2024  rillig lint: tab-align message numbers in err.c

By replacing block comments with end-of-line comments, the comments take
up less space and thus no longer require to be indented by 6 spaces.

The messages and their comments are used in 3 places: the manual page
lint.7, the err-msgs.h header for debug mode, and check-msgs.lua to
verify that the comments above the message IDs correspond to the actual
messages.

No functional change.
 1.102  29-Jul-2023  rillig lint1: remove option -m

The list of lint messages is only needed for generating the manual page
lint.7. Since 2022-07-06, that list is extracted from the source code
instead of compiling and then running lint1.
 1.101  29-Jul-2023  rillig lint: only generate err-msgs.h in debug mode
 1.100  21-Jul-2023  lukem lint: use TOOL_SED instead of sed

Use ${TOOL_SED} instead of (the host) sed, as the
latter doesn't necessarily support the non-POSIX -E.

PR bin/57533
 1.99  15-Jul-2023  rillig lint: fix use-after-free bug in GCC statement expressions
 1.98  11-Jul-2023  rillig lint: in debug mode, don't generate empty message texts

Most of these messages have an /* unused */ comment in err.c, but some
don't.
 1.97  08-Jul-2023  rillig lint: enable more lint warnings for its own source code
 1.96  05-Jul-2023  rillig tests/lint: spell platform identifiers for 'long double' consistently

The test file names don't have a hyphen, so the identifiers shouldn't
have one either.
 1.95  28-Mar-2023  rillig lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
 1.94  27-Feb-2023  rillig lint: split platform-specific test for loss of accuracy

Lint distinguishes between platforms where size_t is unsigned int and
platforms where size_t is unsigned long.
 1.93  06-Feb-2023  rillig lint: inline separate Makefile
 1.92  05-Jul-2022  rillig lint: add additional queries that are not enabled by default

In the last 18 months, several lint warnings have been made adjusted to
allow common usage patterns. For example, lint no longer warns about a
constant condition in the statement 'do { ... } while (false)' (message
161), as this pattern is well-known in statement-like macros, making it
unlikely that the 'false' is a mistake. Another example is casts
between unequal pointer types (message 247) for a few well-known
patterns that are unlikely to be bugs.

Occasionally, it is useful to query the code for patterns or events that
would not justify a warning. These patterns are modeled as predefined
queries that can be selected individually, in addition to and
independently of the existing warnings and errors.

New queries can be added as needed, in the same way as new warnings.
Queries that are deemed no longer used can be deactivated in the same
way as warnings that are no longer used.

As long as none of the queries is enabled, they produce a minimal
overhead of querying a single global variable. Computations that are
more expensive than a few machine instructions should be guarded by
any_query_enabled.

https://mail-index.netbsd.org/source-changes-d/2022/06/28/msg013716.html

ok christos@
 1.91  17-Jun-2022  rillig tests/lint: remove .exp files, as they have become redundant

Now that each lint1 test lists all generated diagnostics as 'expect'
comments, the information from the .exp files is no longer needed. The
only information that gets lost is the order of the diagnostics, which
is mostly relevant for paired messages like 'inconsistent definition' +
'previous definition was here'.
 1.90  09-Apr-2022  rillig lint: disambiguate sym_t.s_value

Having a single variable for 4 different purposes with different types
makes the code unnecessarily hard to follow.

No functional change.
 1.89  09-Apr-2022  rillig lint: split CTCONST into BOOL_CONST and ENUM_CONST

Having a unified compile-time constant "storage class" made the code
more difficult to understand.

No functional change.
 1.88  21-Dec-2021  roy Fix build of xlint/line1 with OBJDIR set.
 1.87  05-Sep-2021  rillig lint: do not warn about comparison 'unsigned <= 0'

Seen in scanners generated by Flex, and about 50 occurrences in the
NetBSD src and xsrc tree, all of which are not suspicious of being bugs.
 1.86  05-Sep-2021  rillig lint: suppress remaining lint warnings in generated scan.c

Warning 162 about 'unsigned <= 0' feels too ambitious, it may be
restricted to the clearly wrong 'unsigned < 0' in the future.

Warnings 192 and 214 are a result of the strict bool check, but the
error messages are suppressed, which makes it hard to see why lint says
the local variable were unused and the function would not return a
value.

Warning 307 about unused static variables is OK for generated code.
 1.85  05-Sep-2021  rillig lint: generate date of lint.7 from err.c
 1.84  22-Aug-2021  rillig usr.bin: enable lint checks for most programs in /usr/bin

Previously, lint was only activated for the libraries, but not for the
kernel or userland programs. Activate lint for the programs in /usr/bin
for now, more will follow later.

This only affects builds that set MKLINT=yes.
 1.83  07-Aug-2021  rillig lint: clean gcov files for lint2 and xlint as well
 1.82  31-Jul-2021  rillig lint: extract debug logging to separate file

Lint currently has several different kinds of debug log:

* The -DDEBUG log is controlled at compile time.
* The -d command line options enables some other debug logging.
* The -DYYDEBUG log for parsing is controlled at compile time.
* The -y command line option only has an effect in -DYYDEBUG mode.

Extracting the logging into a separate file is a first step towards
unifying these logs and making the code for debug logging stand out less
than the current #ifdef DEBUG.

No functional change.
 1.81  31-Jul-2021  rillig lint: add debugging output for the grammar tokens

No functional change outside debug mode.
 1.80  25-Jul-2021  rillig lint: move scl_name from print.c to decl.c

It is only needed there.
 1.79  10-Jul-2021  rillig tests/lint: when adding a new test, set an invalid option

This forces the test author to think about whether any custom options
are really needed. While here, mention the other possible
customizations as well.
 1.78  05-Jul-2021  hgutch GCC git commit 91f66e78cc141da77ff9e0e3c8519e1af3f26c07[1] introduced
a regression in sh. In addition to the intended change (based on the
commit message), an apparently unintended change was made, inverting a
comparison. This broke sh builds and our workaround (so far) was to
compile xlint/lint1 with -O0.

Revert the comparison to what it was before and remove the -O0 hack
from xlint/lint1.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=91f66e78cc141da77ff9e0e3c8519e1af3f26c07
 1.77  04-Jul-2021  rillig lint: in strict bool mode, allow mixed types in generated C code

This allows flex lexers to be run through lint in strict bool mode.
 1.76  04-Jul-2021  rillig lint: include scan.c in 'make lint'

This theoretically enables strict bool mode for the few remaining code
in scan.l. Since scan.l is not yet detected as generated code, all
interesting errors have to be suppressed though.
 1.75  29-Jun-2021  rillig tests/lint: do not modify t_integration on "make add-test"

The test names are no longer listed individually.
 1.74  28-Jun-2021  mrg apply sh3 vs lex.c fix for GCC >= 9. use shorter idiom.

fixes build issue reported by jdbaker in private email.
 1.73  25-Jun-2021  tnn ensure defined(HAVE_GCC) before use of ${HAVE_GCC}
 1.72  23-Jun-2021  rillig lint1: add bug report for internal GCC compiler error
 1.71  22-Jun-2021  martin Hack to avoid gcc 9 internal compiler error for sh3.
 1.70  18-Apr-2021  rillig lint: remove WARNS=3, falling back to the default WARNS=5

It's strange that GCC does not warn about the nonliteral format strings
in lint1/err.c, lint2/msg.c and lint2/read.c, despite -Wformat=2, but
Clang does.
 1.69  18-Apr-2021  rillig lint: fix strict bool mode errors in cgram.y

The code generated by yacc already adheres to strict bool mode, in
default mode as well as in debug mode.

Running lint on the generated cgram.c as well avoids most of the
"declared but not used" warnings from lint2.

The code generated by lex does not adhere to strict bool mode though.
Suppressing the errors from strict bool mode works, but then lint1 runs
into an assertion failure:

assertion "tn != NULL || nerr != 0" failed
in expr at tree.c:3610 near scan.c:822

This leaves several warnings about "declared but not used" for the
functions from lex.c.
 1.68  17-Apr-2021  rillig lint1: remove redundant dependency

This is already handled by "make depend".
 1.67  10-Apr-2021  rillig lint: use distinct struct tags for type_t in lint1 and lint2

Having two similar but still different definitions of 'struct type' is
unnecessarily confusing. Exchange this confusion for 8 lines of
straight-forward preprocessing code.
 1.66  06-Apr-2021  rillig lint: move check for strict bool mode into separate file

No functional change.
 1.65  05-Apr-2021  rillig lint: warn about for wrong type cast in argument to ctype.h functions

The argument to most of the functions from <ctype.h> "shall either be
representable as an 'unsigned char' or shall equal the value of the
macro EOF".

When confronted with the infamous warning 'array subscript has type
char', there are enough programmers who don't know the background of
that warning and thus fix it in a wrong way. Neither GCC nor Clang
explain its warning to target these programmers.

Both GCC and Clang warn about 'array subscript has type char', but they
ignore the other requirements of the <ctype.h> functions, even though
these are in the C standard library.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177
https://stackoverflow.com/a/60696378
 1.64  21-Mar-2021  rillig lint: add missing space when adding a new test case
 1.63  20-Mar-2021  rillig lint: make lint's own code pass the strict bool mode

No functional change.
 1.62  20-Feb-2021  rillig lint: document how to compile lint1 in debug mode
 1.61  19-Feb-2021  rillig lint: remove gcov results on "make clean"
 1.60  19-Feb-2021  rillig lint: warn about mismatch in getopt handling
 1.59  23-Jan-2021  rillig lint: move lexer code from scan.l to lex.c

Previously, the generated scan.c was not included when running "make
lint". Similarly, cgram.c is still not included.
 1.58  10-Jan-2021  rillig lint: automate adding a test for lint1
 1.57  09-Jan-2021  rillig lint: rename ops.c to oper.c

The file ops.c had previously been autogenerated. This meant that in a
NetBSD build, it was generated in OBJDIR, and a build that had just
updated src/usr.bin would fail. For a build that last ran on
2020-12-01, and again today, it looks like this:

# link lint1/lint1
cc ... -o lint1 cgram.lo ... ops.lo ... tyname.lo
/usr/bin/ld: ops.lo: in function `initmtab':
ops.c:(.text+0x63): undefined reference to `STRUCT_ASSIGN'

This is caused by ops.c existing in OBJDIR, so the new version in
NETBSDSRCDIR is not looked at. To prevent this, use oper.c instead as
the filename, which has not been used before.

https://mail-index.netbsd.org/source-changes-d/2021/01/09/msg013096.html
 1.56  05-Jan-2021  rillig lint: clean up generation of the operator tables

Instead of running a shell program that runs an AWK program that
generates the two files ops.c and ops.h, just define the operator tables
once in ops.def and use these definitions flexibly in ops.c and op.h.
 1.55  03-Jan-2021  rillig lint: in DEBUG mode, verify printf parameters for messages

Since several years GCC validates printf-style strings, and there is no
reason not to let GCC do that work. This prevents bugs like the
segmentation fault that was fixed in tree.c 1.109 from 2021-01-01.

By default, lint is compiled with DEBUG off, but it's easy enough to
compile it in debug mode once in a while.
 1.54  01-Jan-2021  rillig lint: remove custom LINTFLAGS

These flags are missing the options -g (GNUisms) and -S (C9X mode).
Without these flags, NetBSD's system headers cannot be compiled as they
make heavy use of __inline and __attribute__.
 1.53  11-Nov-2019  joerg Update LLVM to 10.0.0git (01f3a59fb3e2542fce74c768718f594d0debd0da)
 1.52  04-Apr-2015  christos branches: 1.52.16;
build ops.h first, because trying to build dependencies and ops.h at the
same time leads to spurious failures.
 1.51  20-Nov-2014  christos add LDEBUG
 1.50  10-May-2013  christos commit test
 1.49  10-May-2013  christos cvs test
 1.48  10-May-2013  christos sort
 1.47  25-Dec-2011  christos branches: 1.47.6;
correct debugging flags.
 1.46  04-Feb-2011  christos branches: 1.46.4;
generate ops table dynamically. Will move the other table from tree.c there
too.
 1.45  11-Jul-2010  mrg branches: 1.45.2;
remove the remaining non-ELF code.
 1.44  06-Jul-2010  mrg remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.

this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.

i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.


some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
 1.43  01-May-2009  christos add variable declarations in for loops for c99
 1.42  14-Apr-2009  lukem Compile lint with WARNS=3.
Currently there are too many -Wsign-compare issues for WARNS=4.
 1.41  14-Feb-2009  uebayasi Comment out CFLAGS+=-g.
 1.40  13-Feb-2009  lukem this code isn't -Wsign-compare friendly -- drop the WARNS to 3.
 1.39  16-Nov-2008  dholland branches: 1.39.2;
WARNS=4
 1.38  25-Apr-2008  christos branches: 1.38.6;
preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
 1.37  14-Oct-2006  christos branches: 1.37.16;
Fix c99 initialization issues. Now the regression tests work.
 1.36  08-Oct-2006  peter WFORMAT is no more...
 1.35  07-Apr-2005  christos 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.
 1.34  21-Oct-2003  lukem 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.
 1.33  19-Oct-2003  lukem support MAKEVERBOSE and use ${HOST_SH}
 1.32  01-Aug-2003  lukem 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".
 1.31  30-May-2003  christos Back out debugging Makefile.
 1.30  30-May-2003  christos PR/21706: Krister Walfridsson: CVT nodes not handled in ?: expressions.
 1.29  24-May-2003  christos handle void ({ })
 1.28  18-May-2003  lukem 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.
 1.27  14-May-2003  dbj remove dependencies on ${LIBC} ${LIBM} and ${LIBTERMCAP} static libraries
from host tool targets. Commits fix from PR toolchain/21495
 1.26  01-Feb-2002  lukem need -lm in the HOSTPROG case too...
 1.25  01-Feb-2002  ross now needs -lm for finite(3)
 1.24  31-Jan-2002  tv 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.
 1.23  18-Jan-2002  thorpej Centralize the initialization/declaration of the ttab.
 1.22  19-Dec-2001  tv 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.
 1.21  12-Nov-2001  tv 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.
 1.20  25-Oct-2001  thorpej Give host tool builds better control over the HOST_CPPFLAGS.
 1.19  24-Oct-2001  thorpej 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.
 1.18  24-Oct-2001  tv 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.)
 1.17  24-Oct-2001  thorpej 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.
 1.16  24-Oct-2001  tv 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.
 1.15  22-Oct-2001  jmc Move CPPFLAGS addition for lint1/arch to Makefile.inc so each subdir will
pick them up
 1.14  21-Oct-2001  thorpej 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.
 1.13  14-Aug-2001  tv Add hooks to allow toolchain bits to be reachover-built at the top level.
 1.12  11-Oct-2000  is More format string cleanup by sommerfeld.
 1.11  23-Jul-2000  mycroft Fix problem building lint.7.
 1.10  06-Jul-2000  christos better way to handle lint.7
 1.9  06-Jul-2000  christos build lint.7 man page
 1.8  03-Jul-2000  matt 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
 1.7  13-Feb-1999  lukem branches: 1.7.2; 1.7.10;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.6  09-Apr-1998  tv .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.
 1.5  24-Oct-1997  lukem use CPPFLAGS instead of CFLAGS
 1.4  12-Mar-1997  mycroft branches: 1.4.2;
Remove hack for (very old) GCC bug on i386.
 1.3  04-Jul-1995  cgd hack around a bug in our gcc.
 1.2  03-Jul-1995  cgd RCS id cleanup
 1.1  03-Jul-1995  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  03-Jul-1995  cgd lint(1) implementation, by Jochen Pohl. named 'xlint' for a similar
reason to why 'install' is named 'xinstall'.
 1.4.2.1  04-Nov-1997  thorpej Pull up from trunk: make renaming work and other minor fixes.
 1.7.10.1  18-Oct-2000  tv Pullup usr.bin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.7.2.1  19-Oct-2000  he Pull up revision 1.12 (requested by he):
Format string cleanup.
 1.37.16.1  18-May-2008  yamt sync with head.
 1.38.6.1  08-Dec-2010  riz Pull up following revision(s) (requested by uwe in ticket #1491):
usr.bin/xlint/lint1/Makefile: revision 1.41
Comment out CFLAGS+=-g.
 1.39.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.45.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.46.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.4.1  17-Apr-2012  yamt sync with head
 1.47.6.1  23-Jun-2013  tls resync from head
 1.52.16.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed