History log of /src/usr.bin/xlint/lint1 |
Revision | Date | Author | Comments |
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
|
1.5 | 06-Feb-2023 |
rillig | lint: inline separate Makefile
|
1.4 | 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.3 | 10-Apr-2021 |
rillig | lint: fix build (missing include directory)
|
1.2 | 03-Jan-2021 |
rillig | lint: fix code generation from err.c
That file does not need to be in the current directory.
|
1.1 | 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.4 | 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.3 | 05-Feb-2011 |
christos | branches: 1.3.2; better dependency handling
|
1.2 | 05-Feb-2011 |
christos | fix tools build. Why doesn't .PARSEDIR work?
|
1.1 | 04-Feb-2011 |
christos | generate ops table dynamically. Will move the other table from tree.c there too.
|
1.3.2.2 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.3.2.1 | 05-Feb-2011 |
bouyer | file Makefile.ops-c was added on branch bouyer-quota2 on 2011-02-08 16:20:13 +0000
|
1.4 | 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.3 | 05-Feb-2011 |
christos | branches: 1.3.2; better dependency handling
|
1.2 | 05-Feb-2011 |
christos | fix tools build. Why doesn't .PARSEDIR work?
|
1.1 | 04-Feb-2011 |
christos | generate ops table dynamically. Will move the other table from tree.c there too.
|
1.3.2.2 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.3.2.1 | 05-Feb-2011 |
bouyer | file Makefile.ops-h was added on branch bouyer-quota2 on 2011-02-08 16:20:13 +0000
|
1.18 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.17 | 28-Mar-2024 |
rillig | lint: clean up
|
1.16 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.15 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.14 | 14-Sep-2023 |
rillig | lint: remove preprocessor magic from definition of operators
No binary change.
|
1.13 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.12 | 22-Feb-2023 |
rillig | lint: document limitations
|
1.11 | 05-Feb-2023 |
rillig | tests/lint: update instructions for adding a new test
The redundant variable 'FILES' no longer needs up be updated.
|
1.10 | 21-Jan-2023 |
rillig | lint: extend developer documentation
|
1.9 | 08-Jul-2022 |
rillig | lint: fix query for redundant cast before assignment
Previously, 'i = (int)dbl' was marked as redundant, even though it performs a value conversion.
|
1.8 | 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.7 | 03-Jul-2022 |
rillig | lint: extend implementation documentation
|
1.6 | 17-Jun-2022 |
rillig | tests/lint: make 'expect+-' comments stricter
Previously, the expectations from these comments were already satisfied if the expectation occurred somewhere in the actual message from lint. This meant that the prefix 'error:' or 'warning:' could be omitted from the 'expect' comment. These omissions were hard to see in a manual review. Now any omissions must be visually marked with '...'.
The test msg_342 now reports its messages properly as being in the file msg_342.c, rather than msg_341.c. This had been a copy-and-paste mistake.
|
1.5 | 15-Jun-2022 |
rillig | lint: clean up an empty line and the documentation
No functional change.
|
1.4 | 16-Apr-2022 |
rillig | lint: fix instructions for adding a new test
|
1.3 | 16-Apr-2022 |
rillig | lint: extend README
|
1.2 | 13-Apr-2022 |
rillig | lint: remove trailing whitespace from README, add useful breakpoints
|
1.1 | 10-Apr-2022 |
rillig | lint: add quickstart documentation to the implementation of lint
|
1.533 | 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.532 | 16-May-2025 |
rillig | lint: clean up
|
1.531 | 16-May-2025 |
rillig | lint: allow multiple attributes in member without type
It's a syntax error anyway and helps keep the grammar small.
|
1.530 | 16-May-2025 |
rillig | lint: merge values from multiple __attributes__
No change to the test suite as the grammar rules that contain multiple attributes don't make use of the members from type_attributes.
|
1.529 | 15-May-2025 |
rillig | lint: fix build on 32-bit platforms
|
1.528 | 15-May-2025 |
rillig | lint: handle __attribute__ after a declarator
|
1.527 | 15-May-2025 |
rillig | lint: handle __attribute__ at the beginning of a declaration
|
1.526 | 14-May-2025 |
rillig | lint: extract type_attributes functions from grammar
|
1.525 | 14-May-2025 |
rillig | lint: accept '__attribute__((mode(TI)))' before 'unsigned'
|
1.524 | 08-May-2025 |
rillig | lint: fix merging type attributes
|
1.523 | 12-Apr-2025 |
rillig | lint: reword messages that apply to traditional C
|
1.522 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.521 | 05-Mar-2025 |
rillig | lint: revert accidental commit
|
1.520 | 05-Mar-2025 |
rillig | tests/lint: demonstrate missing warning about non-prototype
|
1.519 | 24-Feb-2025 |
rillig | lint: add debug logging for function calls in the grammar
|
1.518 | 20-Feb-2025 |
rillig | lint: support __attribute__((__mode__(TI)))
This fixes the wrong lint warnings about the shift amount being greater than the type size in compiler_rt/popcountti2.c.
|
1.517 | 03-Jan-2025 |
rillig | lint: add detail to message about obsolete identifier list
|
1.516 | 01-Dec-2024 |
rillig | lint: warn about function definitions that still use identifier lists
|
1.515 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.514 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.513 | 29-Oct-2024 |
rillig | lint: fix warning about null effect in GCC statement expressions
|
1.512 | 04-Oct-2024 |
rillig | lint: fix suppressed warnings after if-else-if statement
Seen in sbin/dump/main.c, the "cp = strchr" line.
The bug had been there since at least 2002.
|
1.511 | 28-Sep-2024 |
rillig | lint: treat __attribute__((__constructor__)) functions as used
Seen in jemalloc.c.
|
1.510 | 28-Sep-2024 |
rillig | lint: handle __attribute__((__unused__)) for functions and variables
Previously, lint ignored the '__unused' marker, requiring its own /* ARGSUSED */ marker instead.
Previously, attributes were interpreted as soon as the closing parenthesis was parsed. For a function definition such as '__unused static void f(void) {}', this was too early, as the attribute was not connected to the function, as the function was not parsed yet.
Now, the 'unused' attribute is passed around by the parser, until it is merged into the declarator where it belongs. Due to an inaccuracy in the grammar, the 'used' attribute has to be passed through a parameter_list, even though a parameter list is not related to attributes. Still, it's better than before.
|
1.509 | 28-Sep-2024 |
rillig | lint: allow more than one __attribute__ on a parameter declaration
|
1.508 | 28-Sep-2024 |
rillig | lint: reduce shift/reduce conflicts in grammar
In an anonymous member declaration, the type attributes are already parsed by the type specifier.
|
1.507 | 29-Aug-2024 |
rillig | lint: support GCC's __auto_type
Fixes PR toolchain/58654.
|
1.506 | 17-Jun-2024 |
rillig | branches: 1.506.2; lint: don't warn about unused C23 [[maybe_unused]] parameters
|
1.505 | 17-Jun-2024 |
rillig | lint: accept C23 [[fallthrough]] statements
Needed by bind9/getaddresses.c:137.
|
1.504 | 17-Jun-2024 |
rillig | lint: accept C23 attributes at the beginning of a type declaration
The switch to GCC 12 brings support for C23, and localtime.c uses it to mark [[maybe_unused]] parameters.
For now, accept C23 attributes independently from the language level. In the end, the whole tree with the exception of the tools should be switched to C23 mode instead of the current C99 mode.
For now, don't actually mark the argument as possibly unused, as lint currently ignores __attribute__((__unused__)) as well.
|
1.503 | 12-May-2024 |
rillig | lint: don't call memcpy with null pointer
Even copying 0 bytes from a null pointer invokes undefined behavior.
|
1.502 | 12-May-2024 |
rillig | lint: move code for parsing balanced token sequences to lex.c
To access yytext from lex.c, the lexer needs to be in %pointer mode, which was specified in IEEE Std 1003.1, 2004 Edition and thus should be old enough to be available on platforms other than NetBSD, for use in tools/lint1 where lint1 is built before yacc and lex.
|
1.501 | 11-May-2024 |
rillig | lint: clean up grammar rule name for 'type_specifier'
|
1.500 | 11-May-2024 |
rillig | lint: parse but otherwise ignore C23 attributes
The C23 attributes are only parsed before an expression in an expression statement, as a proof of concept. Other places will follow later.
|
1.499 | 09-May-2024 |
rillig | lint: in C23 mode, allow storage classes in compound literals
|
1.498 | 09-May-2024 |
rillig | lint: sync grammar rule names with C11 and C23
|
1.497 | 09-May-2024 |
rillig | lint: sort grammar rules according to the order they appear in C23
|
1.496 | 09-May-2024 |
rillig | lint: in C23 mode, support the nullptr constant
|
1.495 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.494 | 01-May-2024 |
rillig | lint: support _Alignas and __attribute__((__aligned(4)))
|
1.493 | 29-Mar-2024 |
rillig | lint: clean up
|
1.492 | 27-Mar-2024 |
rillig | lint: add missing assignment to $$ in grammar
Byacc and Bison both provide this assignment for all actions, whether default or not, but the wording in POSIX doesn't guarantee this.
|
1.491 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.490 | 09-Mar-2024 |
rillig | lint: use fewer struct keywords
|
1.489 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.488 | 08-Feb-2024 |
rillig | lint: clean up comments, add debug output for Bison
|
1.487 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.486 | 02-Feb-2024 |
rillig | lint: make newline in a string literal an error in C90 and later
|
1.485 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.484 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.483 | 13-Jan-2024 |
rillig | lint: clean up grammar for initializers
|
1.482 | 13-Jan-2024 |
rillig | lint: inline simple grammar rules
|
1.481 | 12-Jan-2024 |
rillig | lint: clean up grammar for array size
|
1.480 | 11-Jan-2024 |
rillig | lint: clean up enum constants for designators
In intializers and offsetof, both struct and union members are handled in the same way, thus there is no need to distinguish them.
|
1.479 | 11-Jan-2024 |
rillig | lint: correctly set system-header flag on cast-expression
When a cast-expression comes partly from a system header, determine at the ')' whether the whole cast-expression comes from the system header. Previously, it was based on the operand, which contradicted the documentation of tn_sys.
Mainly affects strict bool mode (where expressions from system headers are handled more leniently), as well as query 9 for parenthesized return expressions.
Discovered upon manual inspection, as calling expr_alloc_tnode should never be necessary when creating an expression node with operands; there's build_op for that purpose.
|
1.478 | 09-Jan-2024 |
rillig | lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not identifiers but designator sequences, such as in 'offsetof(struct stat, st_atim.tv_sec)', so make lint accept them as well.
|
1.477 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.476 | 17-Oct-2023 |
rillig | lint: resolve shift/reduce conflict in labels with attributes
|
1.475 | 17-Oct-2023 |
rillig | lint: fix debug output of convert/cast operators
The default name of the 'CVT' operator is 'convert', therefore the override is only needed for 'cast'.
|
1.474 | 14-Sep-2023 |
rillig | lint: remove pseudo operators INC and DEC
These operators were not used in expressions, they were only used as additional token info. Use a plain bool instead.
No functional change.
|
1.473 | 14-Sep-2023 |
rillig | lint: fix wording of diagnostics about 'C99 extension'
The term 'extension' means an extension to a C standard. C99 by itself is not an extension but a revision of the C standard.
|
1.472 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.471 | 12-Aug-2023 |
rillig | lint: clean up
|
1.470 | 03-Aug-2023 |
rillig | lint: make '_Static_assert' only available in C11 or C23 mode
|
1.469 | 02-Aug-2023 |
rillig | lint: fix handling of unnamed function parameters
|
1.468 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.467 | 01-Aug-2023 |
rillig | lint: improve debug logging for declarators
|
1.466 | 28-Jul-2023 |
rillig | lint: extract 'vararg' and 'prototype' flags from global 'dcs'
These flags are only relevant for parameter lists, so add a separate type for it.
No functional change.
|
1.465 | 15-Jul-2023 |
rillig | lint: each member declarator may have attributes, not only the last one
|
1.464 | 15-Jul-2023 |
rillig | lint: fix use-after-free bug in GCC statement expressions
|
1.463 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.462 | 15-Jul-2023 |
rillig | lint: add debug logging for memory management and the symbol table
|
1.461 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.460 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.459 | 13-Jul-2023 |
rillig | lint: reduce code size for handling lint comments
|
1.458 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.457 | 12-Jul-2023 |
rillig | lint: reject _Noreturn if it occurs in invalid places
C11 introduced _Noreturn as a function-specifier, not as a type attribute. The latter may occur in more places.
|
1.456 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.455 | 12-Jul-2023 |
rillig | lint: indent grammar using tabs instead of spaces
Manually indenting the grammar rules using two spaces was too cumbersome.
|
1.454 | 11-Jul-2023 |
rillig | lint: rename grammar rules to align with C23
|
1.453 | 11-Jul-2023 |
rillig | lint: update wording in diagnostic for C99
|
1.452 | 10-Jul-2023 |
rillig | lint: when debugging the parser, write messages on stderr
This way, all messages (regular debug, yacc debug, lint diagnostics) occur in the correct order.
|
1.451 | 10-Jul-2023 |
rillig | lint: merge duplicate code for getting the name of an operator
|
1.450 | 10-Jul-2023 |
rillig | lint: update debug logging of the parser for Bison 3.8.2
Bison 3.8.2 no longer knows YYPRINT.
|
1.449 | 10-Jul-2023 |
rillig | lint: add debug logging for symbol kinds in the parser
An identifier can refer to a variable, type, member, tag or label. Switching between these namespaces is tightly coupled with the evaluation order of the grammar rules.
|
1.448 | 10-Jul-2023 |
rillig | lint: ensure that untyped grammar rules are listed
Untyped grammar rules are suspicious because they subtly affect the order in which the grammar actions are performed. This leads to the various bugs mentioned in msg_347.c.
|
1.447 | 07-Jul-2023 |
rillig | lint: warn about function definitions without header declaration
The existing warning was only issued for function declarations, not for function definitions.
The interesting change in the tests is in msg_351.c. Many other tests use non-static functions due to their syntactic brevity. In these tests, the warning is disabled individually, to allow new functions to be added without generating warning 351.
|
1.446 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.445 | 02-Jul-2023 |
rillig | lint: allow empty statements in GCC statement expressions
|
1.444 | 02-Jul-2023 |
rillig | lint: clean up variable names relating to structure padding
|
1.443 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.442 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.441 | 30-Jun-2023 |
rillig | lint: clean up handling of declarations
No functional change.
|
1.440 | 30-Jun-2023 |
rillig | tests/lint: extend test for sizeof and offsetof
|
1.439 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.438 | 29-Jun-2023 |
rillig | lint: clean up function names
No functional change.
|
1.437 | 29-Jun-2023 |
rillig | lint: clean up completion of struct, union and enum declarations
No functional change.
|
1.436 | 22-May-2023 |
rillig | lint: clean up the name of a local variable
No binary change.
|
1.435 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.434 | 02-Apr-2023 |
rillig | lint: clean up indentation and wrapping in C parser
|
1.433 | 06-Feb-2023 |
rillig | lint: eliminate unnecessary indirection
No functional change.
|
1.432 | 29-Jan-2023 |
rillig | lint: rename functions for function definition
No functional change.
|
1.431 | 21-Jan-2023 |
rillig | lint: add support for C11 '_Atomic' as atomic-type-specifier
Following the C11 grammar, the keyword '_Atomic' needs to be a separate syntactic category, to avoid further conflicts in the grammar.
The two newly added conflicts in the grammar would come into play when mixing traditional C with C11, in a type name without an implicit 'int'. If the type '_Atomic(int)*' were parsed as '_Atomic int(int)*', the trailing '*' would be a syntax error.
|
1.430 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.429 | 21-Jan-2023 |
rillig | lint: use type_qualifier rule instead of the token directly
No functional change.
|
1.428 | 21-Jan-2023 |
rillig | lint: clean up grammar for type-qualifier
A type-qualifier by itself does not carry pointer information, so add a helper rule in the grammar for those cases where a type-qualifier is actually used in a type like 'int *const'.
This allows general type qualifier checks to be performed during parsing, for example to ensure that '_Atomic' is only used in C11 or later.
No functional change.
|
1.427 | 21-Jan-2023 |
rillig | lint: fix null pointer dereference on invalid argument to __typeof__
|
1.426 | 15-Jan-2023 |
rillig | lint: make read_until_parent easier to understand
Previously, the '--level' in the loop condition looked as if it applied more often than it really does.
No functional change.
|
1.425 | 14-Jan-2023 |
rillig | lint: use fewer abbreviations
No binary change except for line numbers in assertions in decl.c.
|
1.424 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.423 | 28-Aug-2022 |
rillig | lint: rename functions to be clearer
No need anymore to keep external identifiers at the "6 significant initial characters" mandated by C90.
|
1.422 | 28-Aug-2022 |
rillig | lint: rename dcs manipulation functions to be clearer
No functional change.
|
1.421 | 25-Aug-2022 |
rillig | lint: remove explicit list of known GCC attributes
Most GCC attributes consist of a single identifier. Up to now, it was necessary to list each of these identifiers in the grammar, even those that only apply to a single target architecture.
Instead, parse the general form of attributes, matching the few attributes that lint handles by name instead. While here, rename the grammar rules to use the GCC terms.
To avoid conflicts between the global function 'printf' and the GCC attribute of the same name, do not add GCC attributes to the symbol table, and don't make these symbols 'extern' either.
ok christos@.
|
1.420 | 20-Jun-2022 |
rillig | lint: add quotes around several placeholders in messages
|
1.419 | 26-May-2022 |
rillig | lint: rename olwarn and LWARN_BAD to be more expressive
No functional change.
|
1.418 | 26-May-2022 |
rillig | lint: merge debug and non-debug code for saving and restoring warnings
No functional change.
|
1.417 | 26-May-2022 |
rillig | lint: remove assertion about saving and restoring warning flags
The assertion only triggers in debug mode, which is generally not used as it adds lots of debug logging. In production mode, the assumption didn't hold for many years now, so remove the assertion.
|
1.416 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.415 | 12-May-2022 |
rillig | lint: merge duplicate grammar rules for __alignof__ expr
This allows expressions like '__alignof__(ptr)->member', just as with 'sizeof'.
The upper rule in the grammar was preferred over the lower rule since it shifted the T_LPAREN instead of reducing unary_expression. Its implementation invoked undefined behavior if the expression was NULL since it didn't assign anything to $$.
|
1.414 | 12-May-2022 |
rillig | lint: add message text to newly added call to gnuism
Required by check-msgs.lua.
|
1.413 | 12-May-2022 |
martin | We have 130 shift/reduce conflicts now
|
1.412 | 12-May-2022 |
christos | gcc allows __alignof__(unary-expression)
|
1.411 | 12-May-2022 |
rillig | lint: add support for __alignof__ expr, a GCC extension
Seen in lib/libc/gmon/gmon.c:153.
|
1.410 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.409 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.408 | 30-Apr-2022 |
rillig | lint: inline macro Sflag in cases of expected behavior
In the grammar rules 'enums_with_opt_comma' and 'block_item_list', checking for allow_c99 was redundant since c99ism does not warn in C99 mode.
In the grammar rule 'designator', align the two actions structurally.
No functional change.
|
1.407 | 29-Apr-2022 |
rillig | lint: make grammar compatible with Bison
Bison and BSD Yacc differ in how they translate the grammar into C code.
Bison: code above '%union' (YYDEBUG is either undefined or 1) #include "cgram.h" (which defines YYDEBUG to 0 if undefined) code from below '%union' until the first '%%' actions code below the second '%%'
BSD Yacc: code above the first '%%' (YYDEBUG is either undefined or 1) (no #include for "cgram.h") define YYDEBUG to 0 if undefined code below the second '%%' (YYDEBUG is either 0 or 1) actions
The easiest way around these differences is to remove the 'defined(...)' around the conditionals YYDEBUG, YYBISON and YYBYACC.
|
1.406 | 29-Apr-2022 |
rillig | lint: reorder grammar rule begin_type_typespec
This makes the rule structurally more similar to the other rules. The goal is that all rules whose name starts with 'begin_type_' actually start with the rule 'begin_type'. Currently, some rules parse their type attributes before 'begin_type', which feels wrong, as type attributes should be part of the type.
No functional change intended.
|
1.405 | 29-Apr-2022 |
rillig | lint: only allow GCC attribute in null statement
The only indented usage in that position is a fallthrough statement, as a replacement for a /* FALLTHROUGH */ comment. There is no point in using _Noreturn or _Alignas as a statement.
Ideally, instead of gcc_attribute, the grammar would allow gcc_attribute_list here (as always with GCC attributes), but that would have introduced a reduce/reduce conflict, due to the attributes in the middle of labeled_statement.
|
1.404 | 29-Apr-2022 |
rillig | lint: do not allow type attributes after label
After a label, the type attributes _Alignas, __packed and _Noreturn do not make sense, so don't allow them. The only kind of attributes that makes sense there syntactically is GCC __attribute__. Allow multiple such attributes, like everywhere in the GCC grammar.
|
1.403 | 28-Apr-2022 |
rillig | lint: revert resolving grammar conflicts for labeled statements
Restore the grammar rule for labeled_statement as it was before cgram.y 1.400 from 2022-04-24. This allows labels with attributes again. Fix the wrong interpretation in the tests; the attributes belong to the label, not to the statement.
Today in the morning, when I thought that the change in cgram.y 1.400 were innocent, I accidentally ran lint only with the options '-Sw' but forgot the option '-g' for GNU mode. Without that option, the token '__attribute__' is unknown, which unsurprisingly leads to lots of syntax errors, and these didn't change with that commit. The actual change was only visible in GNU mode.
|
1.402 | 24-Apr-2022 |
rillig | lint: error out on declarations with implicit int type
|
1.401 | 24-Apr-2022 |
rillig | lint: error out on missing type in declarations
|
1.400 | 24-Apr-2022 |
rillig | lint: resolve 4 shift/reduce conflicts in labeled_statement
The attributes are already parsed as part of the statement.
No functional change intended.
|
1.399 | 24-Apr-2022 |
rillig | lint: resolve 6 shift/reduce conflicts in type_direct_declarator
No functional change intended.
|
1.398 | 24-Apr-2022 |
rillig | lint: solve 6 shift/reduce conflicts in notype_direct_declarator
No functional change intended.
|
1.397 | 24-Apr-2022 |
rillig | lint: warn about anonymous struct in struct, in plain C99 mode
|
1.396 | 24-Apr-2022 |
rillig | lint: reduce shift/reduce conflicts in C grammar
Previously, direct_abstract_declarator allowed type attributes like _Noreturn to be prepended and appended to a type without specifying any order.
No functional change intended.
|
1.395 | 16-Apr-2022 |
rillig | lint: in C99 mode, allow trailing comma in enum declarations
Adjust the test to be run in C90 mode instead of traditional mode, since traditional C didn't have enums.
|
1.394 | 10-Apr-2022 |
rillig | lint: fix assertion failure on duplicate qualifiers from __typeof__
|
1.393 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.392 | 09-Apr-2022 |
rillig | lint: rename dinfo_t.d_offset to d_offset_in_bits
Most often, offsets are measured in bytes, so better embed the unit in the variable name.
No functional change.
|
1.391 | 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.390 | 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.389 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.388 | 09-Mar-2022 |
rillig | lint: fix indentation in C grammar
No functional change.
|
1.387 | 01-Mar-2022 |
rillig | lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and debug_symtab can be called as needed during a debug session.
|
1.386 | 27-Feb-2022 |
rillig | lint: concatenate string literals from left to right
Previously, the string literals "1" "2" "3" "4" were concatenated in the order "23", "234", "1234". This influenced the location of the diagnostics for traditional C (which doesn't know concatenation at all) and for mixing regular strings and wide strings.
Now the diagnostics occur exactly where they are expected. The first string literal defines whether the whole string is regular or wide, and any further string literals must match it.
In traditional C mode, there are more diagnostics than before, but that doesn't hurt since they are still correct and nobody uses lint in traditional C mode anyway.
|
1.385 | 27-Feb-2022 |
rillig | lint: C99 has been released, so refer to it by its proper name
|
1.384 | 27-Feb-2022 |
rillig | lint: unabbreviate two more members of sym_t
No functional change.
|
1.383 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.382 | 27-Feb-2022 |
rillig | lint: rename ARG to OLD_STYLE_ARG
Pre-C90 argument declarations have been old for more than 30 years now, so mention that fact in the constant name. This reduces potential confusion with other occurrences of the words 'arg' or 'argument'.
No functional change.
|
1.381 | 26-Feb-2022 |
rillig | lint: fix memory corruption in statement expressions (since 2021-12-17)
The commit that introduced the assertion failure looks innocent, it only adds a few predefined functions for GCC mode. Nevertheless, before that commit, lint consistently complained about 'error: void type illegal in expression [109]', which doesn't make sense either.
This fix also removes the creative use of the initialization stack to store the type of the statement expression. Having a separate stack for these statement expressions makes the code easier to understand.
|
1.380 | 26-Feb-2022 |
rillig | lint: extract code for handling statement expressions from the grammar
This prepares the fix of the memory corruption bug that is demonstrated in t_integration.sh, test case assertion_failures.
No functional change.
|
1.379 | 15-Jan-2022 |
rillig | lint: warn about unreachable null statements
This warning flags the second semicolon of 'return;;' as being unreachable. It does not warn about these superfluous semicolons in general though.
Seen in usr.bin/make/bmake_malloc.c.
|
1.378 | 26-Dec-2021 |
christos | Add clang's optnone attribute.
|
1.377 | 20-Dec-2021 |
rillig | lint: add grammar rule for the beginning of a designation
This will be necessary to properly implement handling of initializers and braced initializer-lists.
No functional change for now since the designation is already reset after each expression and '}'. To handle initializations properly, the designation must not be reset after each expression, it must advance to the next member instead.
|
1.376 | 18-Dec-2021 |
rillig | lint: format grammar consistently
No binary change.
|
1.375 | 16-Dec-2021 |
rillig | lint: narrow down parameter of build_name
Passing an arbitrary tokenizer symbol left too much freedom and uncertainty to the caller, and 0 was a magic number in this context.
No functional change.
|
1.374 | 15-Dec-2021 |
christos | Add more attributes
|
1.373 | 14-Dec-2021 |
christos | Improve restrict handling.
|
1.372 | 28-Nov-2021 |
rillig | lint: allow Bison debug functions to be unused
The grammar is only compiled using Bison during development time. In the official builds, it is built with byacc.
No functional change.
|
1.371 | 27-Nov-2021 |
christos | Add target attribute
|
1.370 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.369 | 16-Nov-2021 |
rillig | lint: fix wrong error message in strict bool mode
This fix only affects the last token before a macro, as well as the last token in the expanded macro.
|
1.368 | 16-Nov-2021 |
rillig | lint: rename attron to in_gcc_attribute
No functional change.
|
1.367 | 26-Sep-2021 |
rillig | lint: fix Bison warnings
cgram.y:998.11-35: warning: type clash on default action: <y_sym> != <> [-Wother]
No functional change.
|
1.366 | 17-Sep-2021 |
christos | Extra commit to fix the actual wrong comment before: Add _Static_assert grammar and keyword
|
1.365 | 17-Sep-2021 |
christos | remove the lint kludges
|
1.364 | 14-Sep-2021 |
rillig | lint: allow [*] everywhere where [] and [integer] are allowed
It's a seldom used feature, but now it's at least consistent.
|
1.363 | 14-Sep-2021 |
rillig | lint: support int[*][3] from C99
No warning in pre-C99 mode since this declarator is not used in practice anyway.
|
1.362 | 13-Sep-2021 |
rillig | lint: continue analysis of wrong type in abstract declaration
No functional change.
|
1.361 | 10-Sep-2021 |
rillig | lint: replace space followed by tab with simply tab
No functional change.
|
1.360 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.359 | 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.358 | 25-Aug-2021 |
rillig | lint: add __attribute__ regparm
Seen in libexec/ld.elf_so/rtld.h.
|
1.357 | 21-Aug-2021 |
rillig | lint: add missing newlines to grammar debug output
|
1.356 | 19-Aug-2021 |
christos | Add returns_nonnull attribute
|
1.355 | 11-Aug-2021 |
rillig | lint: allow GCC __attribute__ after array brackets
GCC accepts this, so should lint. Seen in pam_lastlog.c:115.
|
1.354 | 01-Aug-2021 |
rillig | lint: clean up debug logging in the C grammar
|
1.353 | 01-Aug-2021 |
rillig | lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault, probably related to the symbol table. To better understand this part, log insertions and deletions.
The other debug log messages do not need to mention the current file position anymore, this is what lex_next_line takes care of since scan.l 1.113 from 2021-01-05.
|
1.352 | 31-Jul-2021 |
rillig | lint: add debugging output for the grammar tokens
No functional change outside debug mode.
|
1.351 | 27-Jul-2021 |
rillig | lint: inline align_as in the grammar
This saves 500 bytes in the resulting binary.
No functional change.
|
1.350 | 27-Jul-2021 |
rillig | lint: provide a direct link to the documentation
No functional change.
|
1.349 | 26-Jul-2021 |
rillig | lint: fix parse error in conditional expression (since 2021-07-15)
|
1.348 | 26-Jul-2021 |
rillig | lint: fix parsing of chained assignments (since 2021-07-15)
The grammar rule for assignment_expression is quite different from those of the other expressions, for 2 reasons: first, its precedence is right-to-left. Second, its left-hand side must be an lvalue, which rules out all binary operators. K&R C even had a grammar rule named 'lvalue' for this purpose. Later C standards made the kinds of expressions more fine-grained and used 'unary_expression' in this place.
|
1.347 | 26-Jul-2021 |
rillig | lint: remove redundant associativity declarations
Since cgram.y 1.325 from 2021-07-15, these are not needed anymore. Strangely, neither yacc nor Bison warned about this redundancy.
No functional change, the grammar rules are the same as before.
|
1.346 | 25-Jul-2021 |
rillig | lint: revert previous commit; it didn't improve readability
No functional change.
|
1.345 | 25-Jul-2021 |
rillig | lint: merge duplicate code for abstract_declaration
No functional change; same code coverage outside of cgram.y.
|
1.344 | 25-Jul-2021 |
rillig | lint: resolve conflicts in begin_type_specifier_qualifier_list
The 9 shift/reduce conflicts were all internal to the grammar rule begin_type_specifier_qualifier_list. Previously, there were two possible ways to parse '__attribute__(()) const int':
1. '__attribute__(())' 'const int' 2. '__attribute__(()) const' 'int'
Both ways would produce the same result since __attribute__ has almost no observable effects on the resulting type.
No functional change.
|
1.343 | 25-Jul-2021 |
rillig | lint: reorder grammar rules
First the base cases, then the extensions, like in most other rules in this file.
No functional change.
|
1.342 | 25-Jul-2021 |
rillig | lint: fix parsing of enumerators with __attribute__
|
1.341 | 25-Jul-2021 |
rillig | lint: fix parsing of __attribute__ before enum tag
The __attribute__ after the enumerators will be fixed in a follow-up commit since lint exits after the 5th syntax error in a translation unit, which up to now shadowed the error messages about the enumerators.
|
1.340 | 25-Jul-2021 |
rillig | lint: add citations for a few grammar rules
No functional change.
|
1.339 | 25-Jul-2021 |
rillig | lint: fix parsing of GNU __attribute__ after __asm
GCC only accepts them in the order __asm __attribute__, not the other way round. So should lint.
|
1.338 | 25-Jul-2021 |
rillig | lint: wrap overly long lines
No functional change.
|
1.337 | 25-Jul-2021 |
rillig | lint: do not parse 'typeof(0)(void)' as function call
Previously, lint tried to parse 'typeof(0)(void)' as 'typeof' '(0)(void)', which tries to call 0 as a function.
|
1.336 | 25-Jul-2021 |
rillig | lint: fix parsing of 'typeof(double(typeof(0.0)))'
By removing the misplaced grammar rule 'abstract_declarator: T_TYPEOF', the type expression 'typeof(double(typeof(0.0)))' is no longer interpreted as a declarator, but rather as a type specifier, just as in the GCC parser.
This resolves 7 shift/reduce conflicts.
|
1.335 | 23-Jul-2021 |
rillig | lint: move single semicolon to external_declaration
This aligns more closely with the grammar from GCC's parser. The global cleanup from the grammar rule 'external_declaration: top_level_declaration' is not performed anymore, which doesn't matter since there is nothing to clean up after a single semicolon.
No functional change.
|
1.334 | 21-Jul-2021 |
rillig | lint: move assignments to $$ at the end of the action
They are closely related to return statements.
While here, add some more remarks from reviewing the grammar.
No functional change.
|
1.333 | 21-Jul-2021 |
rillig | lint: rename grammar rules for specifier-qualifier-list
No functional change.
|
1.332 | 21-Jul-2021 |
rillig | lint: remove unnecessary assertion for type qualifier
If there is any new type qualifier that lint should support (such as _Atomic from C11), the obvious place is to look in the grammar rule type_qualifier, so there is no need to have an assertion.
No functional change.
|
1.331 | 21-Jul-2021 |
rillig | lint: rename ignore_up_to_rparen to match the grammar rule
No functional change.
|
1.330 | 20-Jul-2021 |
rillig | lint: use consistent naming scheme for functions that build nodes
No functional change.
|
1.329 | 20-Jul-2021 |
rillig | lint: split 'build' into build_binary and build_unary
No functional change.
|
1.328 | 15-Jul-2021 |
rillig | lint: remove message 66 about missing semicolon in struct-declaration
|
1.327 | 15-Jul-2021 |
rillig | lint: merge duplicate code in declarations
No functional change, code coverage outside cgram.y stays the same.
|
1.326 | 15-Jul-2021 |
rillig | lint: rename grammar rule 'declaration' to 'declaration_or_error'
This prepares for merging the duplicate code from top_level_declaration. The code coverage outside cgram.y is exactly the same as before.
No functional change.
|
1.325 | 15-Jul-2021 |
rillig | lint: in the grammar, replace %prec with explicit rules
This way, in the arguments of __attribute__, where only constant expressions are expected, a '=' leads to a syntax error. Previously, this was not detected.
No noticeable change in practice since these cases are already handled by the compilers.
|
1.324 | 14-Jul-2021 |
rillig | lint: in the grammar, rename 'decl' to 'declarator'
For a casual reader, the abbreviation 'decl' was ambiguous since C has both declarations and declarators.
No functional change.
|
1.323 | 14-Jul-2021 |
rillig | lint: extract build_member_access from the grammar
No functional change.
|
1.322 | 14-Jul-2021 |
rillig | lint: rename grammar rule 'expr' to 'expression'
No functional change.
|
1.321 | 14-Jul-2021 |
rillig | lint: remove references to C18
The standard is called C17, not C18, and furthermore the section numbering didn't change between C11 and C17.
No functional change.
|
1.320 | 12-Jul-2021 |
rillig | lint: order type declarations in grammar, group by C99 section
No functional change.
|
1.319 | 12-Jul-2021 |
rillig | lint: reorder grammar rules in the same way as in C99
The code coverage before and after this change is exactly the same, except of course for cgram.y and cgram.c.
No functional change.
|
1.318 | 11-Jul-2021 |
rillig | lint: reorder grammar rules for expressions according to C18
No functional change.
|
1.317 | 11-Jul-2021 |
rillig | lint: make _Generic a primary-expression
C11 says so, and unless the _Generic expression was wrapped in parentheses, it was not possible before to use it as a function call expression.
|
1.316 | 11-Jul-2021 |
rillig | lint: rename grammar rule 'term' to 'cast_expression'
No functional change.
|
1.315 | 11-Jul-2021 |
rillig | lint: reorganize grammar rules for unary expressions
According to GCC, __builtin_offsetof is a primary-expression.
According to GCC, __real__, __imag__ and __extension__ are unary-operator, just like '!' and '~'.
According to C11, _Alignof is a unary-operator.
|
1.314 | 11-Jul-2021 |
rillig | lint: remove grammar conflict for __real__ and __imag__
The rules were redundant since a term can be parenthesized by itself, there is no need for an extra rule. The rules for '__real__(term)' and '__imag__(term)' were never reduced since these cases were handled by the rules '__real__ term' and '__imag__ term' a few lines above.
No functional change.
|
1.313 | 11-Jul-2021 |
rillig | lint: support __attribute__((hot))
The corresponding attribute 'cold' was already added in cgram.y 1.84 from 2016-12-29.
|
1.312 | 11-Jul-2021 |
rillig | lint: fix shift/reduce conflict for dangling else
The following line no longer occurs in the yacc output: 257: shift/reduce conflict (shift 427, reduce 270) on T_ELSE
No functional change.
|
1.311 | 11-Jul-2021 |
rillig | lint: resolve shift/reduce conflict in notype_direct_decl
When a notype_direct_decl was followed by a type_attribute_list, and the next token was another type_attribute, the parser could either continue the current type_attribute_list or start a new one. Either way has the same effect since type_attribute_list has no associated action.
This reduces the conflicts by 4, one for each of T_ALIGNAS, T_ATTRIBUTE, T_NORETURN, T_PACKED. There are several other conflicts involving these 4 tokens, but they are harder to fix.
No functional change.
|
1.310 | 11-Jul-2021 |
rillig | lint: use separate tokens for logical not and bitwise complement
The token T_UNARY was misleading since it only captured 2 of the 6 operators that C99 calls unary-operator. Make the grammar easier to understand by explicitly listing these 2 operators.
No functional change.
|
1.309 | 11-Jul-2021 |
rillig | lint: remove redundant %prec from the grammar
Now that the precedence of the unary operators has been modeled via separate rules, the precedence is no longer needed.
No change to the generated parser, with both yacc or Bison.
|
1.308 | 11-Jul-2021 |
rillig | lint: remove shift/reduce conflict for sizeof
According to the grammar, the expression 'sizeof(int)x' was ambiguous. Since 'sizeof(int)' is a valid term, that could have been reduced, which would have resulted in a parse error when trying to parse 'x'.
Now 'sizeof' takes a unary_expression instead of a term.
No functional change.
|
1.307 | 11-Jul-2021 |
rillig | lint: resolve shift/reduce conflicts for unary expressions
The grammar rule 'term' was ambiguous since both the prefix and postfix increment operators were listed with the same precedence. The expression '++x++' was parsed as '++ (x++)', as expected, since conflicts resolve towards shift.
Resolve these conflicts by structuring the grammar as in C99, with the GCC extension of statement-expressions. The resolved conflicts are:
134: shift/reduce conflict (shift 161, reduce 347) on T_LBRACK 134: shift/reduce conflict (shift 162, reduce 347) on T_LPAREN 134: shift/reduce conflict (shift 163, reduce 347) on T_POINT 134: shift/reduce conflict (shift 164, reduce 347) on T_ARROW 134: shift/reduce conflict (shift 165, reduce 347) on T_INCDEC state 134 term : term . T_INCDEC (335) term : term . T_LBRACK expr T_RBRACK (341) term : term . T_LPAREN T_RPAREN (342) term : term . T_LPAREN argument_expression_list T_RPAREN (343) term : term . point_or_arrow T_NAME (344) term : T_EXTENSION term . (347)
No functional change.
|
1.306 | 11-Jul-2021 |
rillig | lint: fix bug when parsing unused variable (since 2021-07-10)
Partially revert to cgram.y 1.248 from 2021-06-29.
This fixes the parse error for variables whose declaration starts with __attribute__((unused)). In the many refactorings of the last days this bug has slipped in, and since there were several refactorings in that area, there may be have been further bugs that are not caught by the current test suite. Revert for now and maybe apply them later again when there are more tests.
Things kept from the current version are:
The names of most of the rules, as they correspond more closely to C99 and do not affect the behavior in any way.
In type_direct_decl, the replacement of type_attribute_list with type_attribute since that nonterminal is already part of a repetition (saves 4 conflicts).
In block_item, the order of the rules corresponds to C99. This has no influence on the generated parser, except for the rule numbers, which are informative.
The merge of the duplicate code for struct_tag, enum_tag and enum_constant, as they all contained exactly the same code.
|
1.305 | 10-Jul-2021 |
rillig | lint: fix parsing of __attribute__ for member (since 2021-07-10)
Since cgram.y 1.280 from 2021-07-10, lint could not parse struct members that have multiple __attribute__ in front of their type.
|
1.304 | 10-Jul-2021 |
rillig | lint: inline grammar rules declmod and qualifier_or_storage_class
The rule declmod had a confusing name since declmods was not exactly a list of declmod.
Inlining the rules reduces the abstraction level. There are still some shift/reduce conflicts in that area, so make the rules as simple as possible, in order to resolve these conflicts.
No functional change.
|
1.303 | 10-Jul-2021 |
rillig | lint: merge duplicate code for struct and enum declarations
No functional change.
|
1.302 | 10-Jul-2021 |
rillig | lint: move type_attribute back into the main section
Type attributes are a standard feature since C11 and thus do not belong in the GCC-specific section. Only the GCC __attribute__ belongs there.
No functional change.
|
1.301 | 10-Jul-2021 |
rillig | lint: merge duplicate code for struct and enum tags
This is a tricky area. Inlining identifier_sym did not work because of the side-effects of getsym. In situations where two identifiers of different kinds follow each other, such as 'enum id1 id2', the timing is crucial, and inlining identifier_sym would have led to an internal error in getsym. The symbol type has to be reset from FTAG to FVFT before reading the next token.
No functional change.
|
1.300 | 10-Jul-2021 |
rillig | lint: rename grammar rules to align with C99
No functional change.
|
1.299 | 10-Jul-2021 |
rillig | lint: merge duplicate code for typespec and notype_typespec
No functional change.
|
1.298 | 10-Jul-2021 |
rillig | lint: rename func_arg_list to align with C99
No functional change.
|
1.297 | 10-Jul-2021 |
rillig | lint: rename y_sb to y_name
That buffer is only used for names of identifiers, so be more specific.
No functional change.
|
1.296 | 10-Jul-2021 |
rillig | lint: rename clrtyp/deftyp to begin_type/end_type
The abbreviations clr/def did not make it obvious that these two functions or grammar rules form pairs.
No functional change.
|
1.295 | 10-Jul-2021 |
rillig | lint: extract clrtyp from noclass_declspecs
Finally each clrtyp pairs up with its corresponding deftyp, which makes the grammar much easier to understand. The many grammar rules that contain these actions now all look the same.
No functional change.
|
1.294 | 10-Jul-2021 |
rillig | lint: extract clrtyp from declaration_specifiers
This makes the grammar more uniform and thereby easier to understand. The actions clrtyp and deftyp now come in pairs almost everywhere.
No functional change.
|
1.293 | 10-Jul-2021 |
rillig | lint: split grammar rule clrtyp_declmods
By extracting clrtyp from that rule, clrtyp and deftyp pair up nicely in most of the grammar rules. These two actions delimit the common part of a declaration that declares multiple identifiers.
No functional change.
|
1.292 | 10-Jul-2021 |
rillig | lint: inline grammar rule clrtyp_typespec
No functional change.
|
1.291 | 10-Jul-2021 |
rillig | lint: merge duplicate code from grammar rule clrtyp_typespec
No functional change.
|
1.290 | 10-Jul-2021 |
rillig | lint: swap order in grammar rule clrtyp_typespec
It should not make a difference whether the rule says 'T_TYPENAME clrtyp' or 'clrtyp T_TYPENAME'. The latter order is more consistent with the name of the rule, though.
According to the code, these two tokens take completely distinct actions. The code coverage outside of cgram.y and cgram.c stays exactly the same, at least for lint's test suite.
No functional change intended.
|
1.289 | 10-Jul-2021 |
rillig | lint: rename grammar rule declmods to clrtyp_declmods
It wasn't obvious from the name 'declmods' that this rule starts a new type declaration.
No functional change.
|
1.288 | 10-Jul-2021 |
rillig | lint: do not allow struct{const;}
In traditional C, a struct member was defined syntactically as 'type-specifier struct-declarator-list', the concept of a type-qualifier was not known back then.
C90 invented the type-qualifier 'const' and relaxed the syntactic requirement for struct member declarations by allowing 'const x'. Having only a type-qualifier without an actual type may be regarded as an "incomplete type", which would be forbidden by C90 and later.
Anyway, this doesn't occur in practice anyway, so there is no need for lint to try to parse it. This removes a bit of dead code, since a type-qualifier-list can never have type struct or union.
|
1.287 | 10-Jul-2021 |
rillig | lint: remove noclass_declmods from grammar
That rule was hard to understand since it contained clrtyp but not the corresponding deftyp. It's easier to read when a grammar rule contains both clrtyp and deftyp in the same line.
C99 does not mention the term 'decl-modifier' anywhere, and in fact the only thing that this grammar rule allowed was a type-qualifier-list. The new name better reflect this.
No functional change.
|
1.286 | 10-Jul-2021 |
rillig | lint: fix assertion failure for malformed member declaration
|
1.285 | 10-Jul-2021 |
rillig | lint: merge duplicate code in grammar for 'for' loops
No functional change.
|
1.284 | 10-Jul-2021 |
rillig | lint: clean up grammar for do-while statements
No functional change.
|
1.283 | 10-Jul-2021 |
rillig | lint: merge duplicate code in grammar for 'while' statements
No functional change.
|
1.282 | 10-Jul-2021 |
rillig | lint: do not allow __packed or _Alignas in statement
When the rule 'statement: type_attribute T_SEMI' was added in cgram.y 1.214 from 2021-04-14, type_attribute was the closest match since there was no definition for gcc_attribute yet.
|
1.281 | 10-Jul-2021 |
rillig | lint: reduce shift/reduce conflicts in direct_abstract_declarator
No functional change.
|
1.280 | 10-Jul-2021 |
rillig | lint: remove 8 of the grammar conflicts, 142 remaining
No functional change.
|
1.279 | 10-Jul-2021 |
rillig | lint: merge duplicate code in declmods and declmod
No functional change.
|
1.278 | 10-Jul-2021 |
rillig | lint: remove duplicate code for parsing declarations
No functional change.
|
1.277 | 09-Jul-2021 |
rillig | lint: remove 6 conflicts from the grammar, in type_direct_decl
No functional change.
|
1.276 | 09-Jul-2021 |
rillig | lint: remove 6 of the remaining 162 conflicts from the grammar
No functional change.
|
1.275 | 09-Jul-2021 |
rillig | lint: indent grammar actions properly
No functional change.
|
1.274 | 08-Jul-2021 |
rillig | lint: fix assignment to midrule in grammar (since today)
When compiling the grammar with Bison, it complains:
error: $$ for the midrule at $2 of 'struct' has no declared type
Yacc does not complain, instead it assumes that a midrule has the same type as the rule itself.
The assignment '$$ = $1' in the midrule action does not influence the $$ of the whole rule, it only assigns to $2. The assignment to $$ was done via the default action, therefore everything worked as expected. Any missing assignment in this rule would have been caught quickly by the strict assertion in mktag.
No functional change.
|
1.273 | 08-Jul-2021 |
rillig | lint: fix wrong check for enum constants in switch (since today)
|
1.272 | 08-Jul-2021 |
rillig | lint: demonstrate bug in handling enum declarations (since today)
Since cgram.y 1.270 from today (a "cleanup" commit), the enum constants were only registered in the symbol table, but they were not added to the enum type (en_first_enumerator). That information is used for validating switch statements on enum types.
The actual bug is an off-by-one error in the grammar, in the grammar rule 'enum_declaration'. Yacc does not notice this obvious error. Bison does, but it is not involved in building lint.
In the grammar rule 'enum_declaration', the intended $3 contains the first enumeration constant of the type, while $2, which yacc interprets as a symbol, contains a null pointer, at least on x86_64.
The existing tests did not cover this scenario, so the bug went unnoticed.
|
1.271 | 08-Jul-2021 |
rillig | lint: add grammar rule type_attribute_list_opt
Since type attributes (and GCC attributes as well) often modify the preceding identifier, without referring to $$, the easiest way to integrate them into the grammar is to define a separate grammar rule that can be placed wherever these attributes are allowed. This avoids duplicate actions like in direct_param_decl.
No functional change.
|
1.270 | 08-Jul-2021 |
rillig | lint: clean up grammar
enum_decl_lbrace was only used once and was small enough to be inlined.
Renamed expr_statement and added block_item_list_opt to match the wording from C99.
Added references to C99.
No functional change.
|
1.269 | 08-Jul-2021 |
rillig | lint: clean up grammar for member declarations
No functional change.
|
1.268 | 08-Jul-2021 |
rillig | lint: move optional grammar rules above their corresponding rules
No functional change.
|
1.267 | 08-Jul-2021 |
rillig | lint: move grammar rules for generic_selection around
They were misplaced between the statements, as they belong to the expressions, as indicated by the C99 section number.
No functional change.
|
1.266 | 08-Jul-2021 |
rillig | lint: remove irrelevant type information from __attribute__ tokens
The grammar once declared that an __attribute__ contained type information, but that was not used anyway.
No functional change.
|
1.265 | 06-Jul-2021 |
rillig | lint: document further shift/reduce conflicts
These cannot be resolved as easily as those from the previous commit. Anyway, the relevant code from the grammar is not yet covered by the tests, this needs to be done first.
|
1.264 | 06-Jul-2021 |
rillig | lint: document the cause for 24 of the 162 grammar conflicts
|
1.263 | 06-Jul-2021 |
rillig | lint: resolve conflict in grammar for __real__ and __imag__
There is no need for extra rules for '__real__(term)' since that is already handled by the simpler '__real__ term', just a few lines further up in the grammar. Likewise for __imag__.
The GCC manual does not mention anything about parentheses either.
|
1.262 | 06-Jul-2021 |
rillig | lint: do not allow _Alignas (from C11) or __packed after a label
|
1.261 | 06-Jul-2021 |
rillig | lint: rename grammar rules for GCC __attribute__
No functional change.
|
1.260 | 06-Jul-2021 |
rillig | lint: move grammar rules for GCC __attribute__ to the bottom
In GCC 2.95.3, attributes had already been available for functions, variables and types. At that time they were indeed related to declarations, and that's where they ended up in lint's grammar. Later, attributes were extended to labels, enumerators and statements as well.
To keep the grammar for declarations short and comprehensible, move the rather large part about __attribute__ at the bottom of the grammar, creating a new section called "GCC extensions".
The grammar rules are not named accurately (and never were). They are called "type attributes" but apply not only to types. These names will be improved in a follow-up commit.
No functional change.
|
1.259 | 06-Jul-2021 |
rillig | lint: align grammar rules for enum-specifier with C99
No functional change.
|
1.258 | 06-Jul-2021 |
rillig | lint: document grammar rule that deviates from C99
|
1.257 | 06-Jul-2021 |
rillig | lint: rearrange and rename grammar rules for parameter declarations
Place the notype/type variants close to each other to be able to compare them visually.
No functional change.
|
1.256 | 06-Jul-2021 |
rillig | lint: move the grammar rule array_size out of the type/notype section
An array size is used in several grammar rules for different types of declarations, therefore it doesn't make sense to place that rule somewhere in the middle, where it disrupted the flow of notype/type rules. The whole point of having the notype/type rules grouped is to be able to quickly compare them, since they are almost equal.
No functional change.
|
1.255 | 06-Jul-2021 |
rillig | lint: reduce grammar conflicts for GCC attributes
In all but one case, the use of type_attribute_list introduced an unnecessary ambiguity in the grammar. It appeared in a place where it could be repeated either by the type_attribute_list or by the enclosing rule. Both variants have the same effect.
No functional change.
|
1.254 | 06-Jul-2021 |
rillig | lint: clean up style in grammar
No functional change.
|
1.253 | 06-Jul-2021 |
rillig | lint: rename type generic_association_types to generic_association
The word 'types' was misleading and unnecessary.
No functional change.
|
1.252 | 05-Jul-2021 |
rillig | lint: refer to documentation about the 'notype' rules in the grammar
|
1.251 | 05-Jul-2021 |
rillig | lint: rename message 340 to talk about "GCC extension", not "GNU"
|
1.250 | 05-Jul-2021 |
rillig | lint: rename dinfo_t.d_stralign to d_sou_align_in_bits
When talking about alignment, offset and size of a type, the measurement unit must be mentioned in the variable name, especially when it differs from the standard unit of measurement, which is a byte, not a bit.
No functional change.
|
1.249 | 03-Jul-2021 |
rillig | lint: guard against segmentation fault when parsing struct
Found by afl. The code that triggers this case is:
struct{const}
|
1.248 | 29-Jun-2021 |
rillig | lint: remove comment from grammar rule type_direct_decl
The 'identifier' in type_direct_decl is necessary, as demonstrated in the test d_typename_as_var. Replacing T_NAME with 'identifier' in notype_direct_decl would increase the shift/reduce conflicts by 6. To keep this number low, keep everything as-is.
|
1.247 | 28-Jun-2021 |
rillig | lint: fix parse error for type 'void (*)[*]'
|
1.246 | 28-Jun-2021 |
rillig | lint: rename grammar rules for abstract declarators
The previous name 'decl' was ambiguous, it could have meant declaration as well as declarator. The new names are aligned with C99.
No functional change.
|
1.245 | 28-Jun-2021 |
rillig | lint: align grammar with C99
C99 uses type-qualifier-list_opt in section 6.7.5.
|
1.244 | 28-Jun-2021 |
rillig | lint: refrain from renaming the grammar rule 'pointer'
That rule is called 'pointer' by C99 as well.
No functional change.
|
1.243 | 28-Jun-2021 |
rillig | lint: rename pqinf_t to qual_ptr and clean up code
The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing.
The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'.
No functional change.
|
1.242 | 28-Jun-2021 |
rillig | lint: only accept assignment-expression in _Generic
That's what C11 says.
|
1.241 | 27-Jun-2021 |
rillig | lint: consistently use 'opt' as suffix
This corresponds to the usage in the C standards, where 'opt' is used as a subscripted suffix.
No functional change.
|
1.240 | 27-Jun-2021 |
rillig | lint: remove redundant '{ $$ = $1; }' from the grammar
In some cases the redundant code had been spelled out, in others it had been left out. Be consistent.
|
1.239 | 27-Jun-2021 |
rillig | lint: reorder grammar rules from big to small
No functional change.
|
1.238 | 27-Jun-2021 |
rillig | lint: fix parsing of _Generic selection expressions
Previously, lint accepted comma-expressions where only assignment-expressions are allowed.
This change does not make a difference in practice though since lint is usually only run on source code that properly compiles. Nevertheless, rather be precise and accurate since the grammar might some day be reused on less reliable input.
|
1.237 | 27-Jun-2021 |
rillig | lint: fix result type of _Generic expressions
|
1.236 | 27-Jun-2021 |
rillig | lint: require C11 for _Generic
This does not have any effect in practice since the option -g (originally meant for GCC extensions to the C standards) implicitly allows all features from C11, since err.c 1.111 from 2021-04-14.
Since the default lint flags for NetBSD builds include the option -g, this allows all C11 features.
Currently it is not possible to say "allow GNU extensions but not C11".
|
1.235 | 27-Jun-2021 |
rillig | lint: sort and rename grammar rules for generic selection
No functional change.
|
1.234 | 27-Jun-2021 |
rillig | lint: fix uninitialized variable for declaration after statement
|
1.233 | 27-Jun-2021 |
rillig | lint: proof-read the C grammar, remove unnecessary %type
After the fix from the previous commit (a missing assignment to $$ in an error case), make sure that there are no other bugs of the same kind, by manually checking that each rule with a %type assigns $$ in each and every case. There is one more instance in block_item_list, but that does not lead to a crash since it affects only a boolean variable, not a pointer.
It should not be necessary to check for this class of bugs manually, but neither BSD yacc nor GNU Bison provide any warning option to help with this scenario. They should have remarked that the %type for type_attribute is never used, since that is easy to detect. They should have also warned that the rule for block_item_list does not mention $$ at all.
Detecting the bug from the previous commit would probably be too much to ask since it involves control flow analysis in the C code. In this particular case, it would have been necessary to visit each possible branch from the 'if' statement and ensure that there is a $$ on the left-hand side of an assignment.
While here, note down several small inconsistencies in the grammar that should be fixed in follow-up commits.
|
1.232 | 27-Jun-2021 |
rillig | lint: fix undefined behavior after syntax error 'unnamed member'
There should really be a linter or other check that guards against forgetting to assign a value to '$$'.
|
1.231 | 27-Jun-2021 |
rillig | lint: fix type of pqinf.p_pcnt
A counter that can either be 0 or 1 and is never incremented is not really a counter, it's a flag.
No functional change.
|
1.230 | 20-Jun-2021 |
rillig | lint: use different tokens for operators '.' and '->'
Before C99, these tokens were only used in member access expressions. C99 reused the operator '.' in initializations of structs and unions. Let the grammar check for syntax errors instead of writing custom code.
No functional change.
|
1.229 | 20-Jun-2021 |
rillig | lint: fix crash on semantically wrong code in ({...})
Found by afl.
|
1.228 | 19-Jun-2021 |
rillig | lint: fix assertion failure in struct with unnamed member
Found using afl.
|
1.227 | 19-Jun-2021 |
rillig | lint: replace undefined behavior with assertion failure
Triggered by this malformed code:
struct{int;
|
1.226 | 03-May-2021 |
rillig | lint: fix parsing of __typeof__ after statement in ({ ... })
Since C99, declarations and statements can be freely mixed, and GCC supported this even before 1999.
|
1.225 | 02-May-2021 |
rillig | lint: sort GCC attributes alphabetically in the grammar
No functional change.
|
1.224 | 01-May-2021 |
rillig | lint: support all documented variants of __attribute__((nonnull))
|
1.223 | 30-Apr-2021 |
christos | - add nonstring attribute - allow attributes after labels (for unused) XXX: split the attributes into function, variable, etc attributes so that we don't accept all attributes in all places (only where they make sense)
|
1.222 | 29-Apr-2021 |
christos | Add constructor and destructor attribute priorities
|
1.221 | 23-Apr-2021 |
rillig | lint: merge duplicate code in grammar for GCC compound expressions
This increases the number of shift/reduce conflicts, once again. I don't know why since the previous two grammar rules only differed in a single detail. One of them had a declaration_list while the other didn't. This difference is exactly what declaration_list_opt is for.
Anyway, the tests for both cases (with and without declarations) work exactly as before.
Merging this duplicate code will probably make it easier to fix the current limitation in lint regarding GCC compound expressions that a statement followed by a declaration generates a syntax error.
Fixing this is not trivial, my first attempt failed either with segmentation faults or with sym->s_type becoming NOSPEC during the expression.
|
1.220 | 20-Apr-2021 |
christos | Add common attribute
|
1.219 | 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.218 | 14-Apr-2021 |
rillig | lint: remove stray semicolon from grammar, make empty rule visible
No functional change.
|
1.217 | 14-Apr-2021 |
christos | there is also an optional type qualifier list in the array size
|
1.216 | 14-Apr-2021 |
rillig | lint: add support for C11-isms such as int[static 3]
|
1.215 | 14-Apr-2021 |
rillig | lint: add test for newly added message about static array size
|
1.214 | 14-Apr-2021 |
christos | support parsing c99's static class for array size expressions.
|
1.213 | 13-Apr-2021 |
christos | Allow type attributes after function pointer parameters
|
1.212 | 12-Apr-2021 |
christos | Add attribute fallthrough
|
1.211 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.210 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.209 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.208 | 02-Apr-2021 |
rillig | lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the scope of the current expression. This was misleading before since the other related functions all have a 't' (probably for 'temporary') in their names.
Also encode in the function name that the returned memory is zeroed out as that could not be inferred from the old name.
No functional change.
|
1.207 | 30-Mar-2021 |
rillig | lint: rewrite handling of initializations, fixing several bugs
The previous implementation had a wrong model of how initialization happens in C99, its assertions failed in all kind of edge cases and it was not possible to fix the remaining bugs one at a time without running into even more obscure assertion failures.
The debug logging was detailed but did not help to clarify the situation. After about 20 failed attempts at fixing the small details I decided to start all over and rewrite the initialization code from scratch. I left the low-level parts of handling designators, the code that is independent of brace_level and the high-level parts of how the parser calls into this module. Everything else is completely new.
The concept of a brace level stays since that is how C99 describes initialization. The previous code could not handle multi-level designations (see d_init_pop_member.c). There are no more assertion failures in the initialization code.
Some TODO comments have been left in the tests to keep the line numbers the same in this commit. These will be cleaned up in a follow-up commit.
The new implementation does not handle initialization with "missing" braces. This is an edge case that both GCC and Clang warn about, so it is not widely used. If necessary, it may be added later.
The new implementation does not use any global variables in the vast majority of the functions, to make all dependencies and possible modifications obvious.
|
1.206 | 29-Mar-2021 |
rillig | lint: remove outdated comments, clean up style
No functional change.
|
1.205 | 28-Mar-2021 |
rillig | lint: rename public designator functions
Their previous names were too similar to the actual implementation functions, which was confusing.
No functional change.
|
1.204 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.203 | 26-Mar-2021 |
rillig | lint: rename pushctrl and popctrl to be more expressive
While here, remove the magic number 0 that in this context means "function body".
No functional change.
|
1.202 | 26-Mar-2021 |
rillig | lint: rename pushdecl and popdecl to be more expressive
The previous names were highly ambiguous. The 'decl' could have meant 'declaration', which would be the usual abbreviation. It could also be split into 'dec' and 'l', meaning 'declaration level', which would make more sense in this particular context.
To avoid having to guess anything about these names, rename the functions. Instead of 'push' and 'pop', I renamed them to 'begin' and 'end' since these are the high-level operation that are of interest. That the hierarchy of declaration levels is implemented as a stack is nice to know but not as important to understand the whole situation.
No functional change.
|
1.201 | 26-Mar-2021 |
rillig | lint: remove redundant '%prec' from grammar for compound literals
No change to the resulting binary.
|
1.200 | 25-Mar-2021 |
rillig | lint: fix names of functions dealing with designations
These functions modify the whole designation, not only a single designator.
No functional change.
|
1.199 | 23-Mar-2021 |
christos | Add _Alignas()
|
1.198 | 23-Mar-2021 |
rillig | lint: fix wrong error message about type mismatch in compound literal
Now that the code contains explicit markers for starting and ending an initialization, and having the guarantee that an assertion fails whenever some code accesses the state of the "current initialization" even though there is no ongoing initialization gives me much more confidence in the correctness of the code. The calls to begin_initialization and end_initialization always appear in pairs, enclosing the minimal amount of code necessary for initialization.
In a nutshell, global modifiable state is error-prone and hard to understand.
A nice side effect is that the grammar no longer needs a special rule for the outermost initializer since the functions for the debug logging are now called explicitly.
The code that misuses the initialization state just because it needs to temporarily store a sym_t somewhere is now clearly marked as such. A GCC statement expression can appear anywhere and is therefore independent of the initialization. Most probably the code can simply refer to the local variable in the grammar rule itself, or this variable needs to be encoded in the grammar %union. For sure there is a better way to handle this.
There is no longer a need that the function 'declare' initializes the initialization state, it was just the wrong place to do this.
|
1.197 | 23-Mar-2021 |
rillig | lint: add indirection for accessing the current initialization
This indirection will be needed to handle nested initializations, which are a new feature of C99. These are currently not handled correctly, see msg_171.c.
No functional change.
|
1.196 | 21-Mar-2021 |
rillig | lint: rename functions for handling control statements
No functional change.
|
1.195 | 21-Mar-2021 |
rillig | lint: rename d_nedecl to d_nonempty_decl
No functional change.
|
1.194 | 21-Mar-2021 |
rillig | lint: rename declspecs to declaration_specifiers, just as in C99
No functional change.
|
1.193 | 21-Mar-2021 |
rillig | lint: rename grammar rule 'data_def' to 'top_level_declaration'
No functional change.
|
1.192 | 21-Mar-2021 |
rillig | lint: remove redundant '%prec' declarations from the grammar
No change to the generated binary.
|
1.191 | 21-Mar-2021 |
rillig | lint: rename token T_XOR to T_BITXOR
For symmetry with the operator, which is named BITXOR.
No functional change.
|
1.190 | 21-Mar-2021 |
rillig | lint: in debug output, use uniform file location references
This makes it easy to click on the location in the IDE instead of having to manually parse the location and navigate to it.
No functional change outside debug mode.
|
1.189 | 21-Mar-2021 |
rillig | lint: remove redundant operator information from the grammar
Several tokens can only ever map to a single operator and thus do not need to encode the operator. Indeed, they already encoded it as NOOP, and it was not used by any grammar rule.
No functional change.
|
1.188 | 20-Mar-2021 |
rillig | lint: rename ftflg to seen_fallthrough
One less abbreviation to remember when reading the code.
No functional change.
|
1.187 | 20-Mar-2021 |
rillig | lint: make the calls to clear_warning_flags stand out less
Even though clear_warning_flags and its companions are implemented as macros, they act like ordinary functions. Do not distract the reader by using uppercase names for them.
No functional change.
|
1.186 | 20-Mar-2021 |
rillig | lint: clean up grammar for declaration after statement
No functional change.
|
1.185 | 20-Mar-2021 |
rillig | lint: fix check for declaration after statement in pre-C99 mode
The new code may not be the most beautiful, but it fixes all bugs that occurred while testing message 327. The grammar rules are taken from C99 6.8.2, so it's no surprise they work well.
|
1.184 | 20-Mar-2021 |
rillig | lint: properly name C99 in message about declaration after statement
Now that C99 has been released and published, there is no reason anymore to refer to it as C9X.
|
1.183 | 20-Mar-2021 |
rillig | lint: use proper boolean literals instead of 0/1
The code in the C grammar is generated by yacc and is not checked by lint's strict bool mode, therefore the replacement was done manually.
No change to the resulting change.
|
1.182 | 20-Mar-2021 |
rillig | lint: remove unnecessary '%prec T_COMMA' from grammar
My previous commit message was wrong in saying that the '%prec' was necessary. It is not necessary.
Most probably I misspelled the name of the grammar rule as opt_comma instead of comma_opt, which would lead to the same number of conflicts in the grammar plus a warning, but no build failure.
|
1.181 | 20-Mar-2021 |
rillig | lint: join grammar rules for initialization
The '%prec T_COMMA' is necessary to avoid lots of parse errors in the lint1 unit tests. Curiously, further down in the grammar, for compound literals, the '%prec T_COMMA' is not necessary, even though the context looks very similar.
No functional change.
|
1.180 | 20-Mar-2021 |
rillig | lint: fix grammar for initialization
Previously, the grammar syntactically accepted the following code:
int var = .member = 12345;
The designation '.member =' can only be used with brace-enclosed initializers.
|
1.179 | 20-Mar-2021 |
rillig | lint: align rule names in grammar with C99
No functional change.
|
1.178 | 19-Mar-2021 |
rillig | lint: add reminder that C99 does not allow '{}' in initializer
No functional change.
|
1.177 | 19-Mar-2021 |
rillig | lint: rename push_member and pop_member
These two functions are supposed to model the designator that is used for initializing structs and arrays. The implementation is still buggy and does not work at all for C99 designators with multiple names, see d_init_pop_member.c.
For now, just rename the functions to head in the right direction.
No functional change.
|
1.176 | 17-Mar-2021 |
rillig | lint: add debug logging for C99-style initialization of arrays
No functional change outside debug mode.
|
1.175 | 17-Mar-2021 |
rillig | lint: move to_int_constant from the grammar to decl.c
This way, the code is covered by running 'make lint'. The code from the grammar is not covered, therefore it still uses int instead of bool in a few places.
Inline the comparison functions for uint64_t. These functions didn't add any clarity to the code.
No functional change.
|
1.174 | 17-Mar-2021 |
rillig | lint: move main part of idecl over to decl.c and rename it
No functional change.
|
1.173 | 17-Mar-2021 |
rillig | lint: replace a call to LERROR with lint_assert
No functional change.
|
1.172 | 17-Mar-2021 |
rillig | lint: rename 'toicon' to 'to_int_constant'
No functional change.
|
1.171 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.170 | 17-Mar-2021 |
rillig | lint: rename 'parn' to 'paren' in the grammar
No functional change.
|
1.169 | 07-Mar-2021 |
rillig | lint: do not allow assignment-expression for constant-expression
It's a funny idea to do something like 'case a = 13:', but since any compiler will reject this code, there is no point in lint supporting it.
No functional change since everywhere the grammar allows a constant expression, there is no ambiguity where an assignment could be interpreted differently.
|
1.168 | 07-Mar-2021 |
rillig | lint: rename grammar rule 'constant'
C99 6.4.4 already defines a grammar rule named 'constant' for an number literal or an enum constant, so don't use that name for something else.
No functional change.
|
1.167 | 07-Mar-2021 |
rillig | lint: align names of C grammar rules with C99
No functional change.
|
1.166 | 07-Mar-2021 |
rillig | lint: in strict C mode, warn about initialization with '[a ... b]'
https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
|
1.165 | 07-Mar-2021 |
rillig | lint: fix off-by-one error in 'case 3...5'
According to the GCC documentation[1], the high end of the range is inclusive as well, which makes sense since otherwise there would be no way of specifying a range that includes the maximum representable number.
Since the range is not used at all in the code, none of the tests could possibly fail.
[1] https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
No functional change.
|
1.164 | 07-Mar-2021 |
rillig | lint: inline 'case 3...5' in grammar
There was no point in having a separate grammar rule for the '3...' part of a range expression, it just made the code more complicated than necessary.
No functional change.
|
1.163 | 20-Feb-2021 |
rillig | lint: rename mkinit to init_using_expr
No functional change outside debug mode.
|
1.162 | 19-Feb-2021 |
rillig | lint: rename storage class constants to be more expressive
No functional change.
|
1.161 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.160 | 31-Jan-2021 |
rillig | lint: don't warn about constant condition in 'do { } while (0)'
|
1.159 | 31-Jan-2021 |
rillig | lint: add quotes to messages 1 and 19
|
1.158 | 31-Jan-2021 |
rillig | lint: be more precise in message 003 "tag in argument list"
|
1.157 | 18-Jan-2021 |
rillig | lint: clean up member names of control_structure and comments
|
1.156 | 18-Jan-2021 |
rillig | lint: rename grammar rule lorange
It looked too much like an orange.
|
1.155 | 18-Jan-2021 |
rillig | lint: rename grammar rules to align with C99 6.7.6
|
1.154 | 18-Jan-2021 |
rillig | lint: fix precedence of __builtin_offsetof
A previous version of the C grammar contained TBUILTIN_SIZEOF in this place, which had two typos. Therefore it was handled as a separate token that was otherwise ignored. Curiously, bison didn't warn about this obvious inconsistency.
|
1.153 | 18-Jan-2021 |
rillig | lint: sort tokens in grammar
|
1.152 | 18-Jan-2021 |
rillig | lint: rename T_SOU to T_STRUCT_OR_UNION
This abbreviation occurred too seldom to be used.
|
1.151 | 18-Jan-2021 |
rillig | lint: don't treat restrict and _Thread_local as volatile anymore
|
1.150 | 18-Jan-2021 |
rillig | lint: align token names with the wording from C99
|
1.149 | 18-Jan-2021 |
rillig | lint: replace abort with lint_assert
|
1.148 | 18-Jan-2021 |
rillig | lint: expand abbreviations in function names
|
1.147 | 18-Jan-2021 |
rillig | lint: rename T_ELLIPSE to T_ELLIPSIS
The 3 dots have nothing to do with geometry.
|
1.146 | 18-Jan-2021 |
rillig | lint: rename T_STROP to T_MEMBACC
The 'STR' was misleading since it is the abbreviation for 'string' in many other programs. Member access not only happens in structs, it also happens in unions.
|
1.145 | 17-Jan-2021 |
rillig | lint: rename T_AND to T_AMPER
When parsing a text into a C program, the character '&' does not yet mean 'bitwise and', it could also be the address operator.
|
1.144 | 17-Jan-2021 |
rillig | lint: rename bitwise operators
When there are several variants of the AND operator, both of them should get a distinguishing prefix, otherwise it's not clear which of the two possible operators is meant by the plain AND.
|
1.143 | 17-Jan-2021 |
rillig | lint: rename operator STAR to INDIR
C99 calls this operator the "indirection operator". The word "star" does not occur in the index of that standard.
|
1.142 | 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.141 | 16-Jan-2021 |
rillig | lint: in strict bool mode, integer constants do not have type bool
Previously, lint1 allowed integer constants such as 0 and 1 to be used as bool constants. This was only half-baked since after fixing all error messages from that strict mode, there may still be integer literals in the code that should be replaced with true or false. This would stop a migration from int to bool in the middle, leaving inconsistent code around.
To find the remaining type inconsistencies, treat integers and bool as completely incompatible, even for compile time constants.
|
1.140 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.139 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.138 | 10-Jan-2021 |
rillig | lint: rename functions with short names
|
1.137 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.136 | 09-Jan-2021 |
rillig | lint: make target platform independent of host platform
If lint is run on a platform that has CHAR_BIT == 10, this doesn't magically make an ILP32 platform have 40 bits per uint32_t.
At the moment, all of the supported platforms are either ILP32 or I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE, so nothing changes practically.
|
1.135 | 09-Jan-2021 |
rillig | lint: rename ename to enumeration_constant
|
1.134 | 09-Jan-2021 |
rillig | lint: align grammar rules with C99
|
1.133 | 09-Jan-2021 |
rillig | lint: expand abbreviations in grammar rules
stmnt -> statement comp -> compound
The abbreviation "stmnt" was non-standard, and "comp" was ambiguous since it is used for "comparison" as well.
|
1.132 | 09-Jan-2021 |
rillig | lint: rename T_MULT to T_ASTERISK
In the early phase of lexical analysis, the '*' does not mean multiplication, therefore its name should not suggest that. It is only an asterisk, and depending on the surrounding context, it will only later turn into a pointer dereference or a multiplication.
The call operator(T_MULT, MULT) was misleading since the MULT was not used at all.
|
1.131 | 05-Jan-2021 |
rillig | lint: remove unused TBUILTIN_SIZEOF from the C grammar
This token is not generated by the lexer, and it was misspelled anyway. All other token names start with "T_", this one was missing the underscore.
|
1.130 | 03-Jan-2021 |
rillig | lint: use consistent indentation for C grammar
|
1.129 | 03-Jan-2021 |
rillig | lint: rename funcarg and funccall to longer names
From the previous short names, it was no obvious that these functions create a new tree node.
The function named funccall in lint2 has been left as-is, since it has a completely different prototype.
|
1.128 | 03-Jan-2021 |
rillig | lint: rename functions that create nodes
|
1.127 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.126 | 01-Jan-2021 |
rillig | lint: rename tokens for left and right parentheses
|
1.125 | 01-Jan-2021 |
rillig | lint: split label handling into separate functions
The only thing these cases have in common is the name "label" and the "reached = 1" assignment. That's not reason enough to combine completely unrelated functions.
|
1.124 | 01-Jan-2021 |
rillig | lint: replace simple LERROR with lint_assert
|
1.123 | 01-Jan-2021 |
rillig | lint: align comments with actual message, in the lexer and parser
|
1.122 | 30-Dec-2020 |
rillig | lint: split cluparg into separate functions
That function did more than its short name could express, and the things it did were not related in any way.
|
1.121 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.120 | 30-Dec-2020 |
rillig | lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
|
1.119 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.118 | 30-Dec-2020 |
rillig | lint: reduce nesting of function calls
|
1.117 | 30-Dec-2020 |
rillig | lint: add debug logging to the parser
Even with -DDEBUG and -DYYDEBUG, the debug output is not detailed enough to clearly see what happens.
Add some custom debug logging to the parser, mainly for demonstration purposes, and also to find out how to fix the test d_struct_init_nested.
|
1.116 | 29-Dec-2020 |
rillig | lint: split complete_tag into separate functions
|
1.115 | 29-Dec-2020 |
rillig | lint: rename functions for handling the initialization stack
|
1.114 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.113 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.112 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.111 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.110 | 28-Dec-2020 |
rillig | lint: spell check
|
1.109 | 28-Dec-2020 |
rillig | lint: remove trailing whitespace
|
1.108 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.107 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.106 | 04-Dec-2020 |
christos | __sentinel__ = __sentinel__(0)
|
1.105 | 18-Sep-2020 |
christos | add optimize attribute
|
1.104 | 04-Mar-2019 |
christos | Add __thread/tls_model attribute
|
1.103 | 04-Mar-2019 |
christos | add a two argument version of alloc_size
|
1.102 | 04-Mar-2019 |
christos | add gnu_printf
|
1.101 | 03-Mar-2019 |
christos | Add more gnu attributes
|
1.100 | 04-Jan-2019 |
christos | recognize destructor attribute.
|
1.99 | 24-Nov-2018 |
christos | add warn_unused_result.
|
1.98 | 03-Sep-2018 |
christos | support deprecated("string") for libpcap
|
1.97 | 08-Jul-2018 |
christos | recognize noinline attribute
|
1.96 | 29-Jun-2018 |
christos | Add our syslog format.
|
1.95 | 15-Jan-2018 |
christos | branches: 1.95.2; 1.95.4; Add a _Noreturn token
|
1.94 | 06-Mar-2017 |
christos | fix typeof, add __builtin_offsetof
|
1.93 | 06-Mar-2017 |
christos | handle typeof in casts
|
1.92 | 07-Jan-2017 |
christos | branches: 1.92.2; add pcs
|
1.91 | 30-Dec-2016 |
christos | - add buffer bounded attribute - allow empty attributes
|
1.90 | 30-Dec-2016 |
christos | sort, kill typo
|
1.89 | 30-Dec-2016 |
christos | add bounded, fix nonnull
|
1.88 | 29-Dec-2016 |
christos | handle __ symbols differently (so we don't duplicate entries in the table) and add non_null.
|
1.87 | 29-Dec-2016 |
christos | allow cascaded attributes
|
1.86 | 29-Dec-2016 |
christos | Add alias attribute
|
1.85 | 29-Dec-2016 |
christos | Add always_inline
|
1.84 | 29-Dec-2016 |
christos | Add more attributes.
|
1.83 | 29-Dec-2016 |
christos | accept optional type attributes after struct/union members
|
1.82 | 27-Dec-2016 |
christos | teach lint __attribute__((__unused__))
|
1.81 | 05-Nov-2016 |
christos | Add _Generic C11 support.
|
1.80 | 19-Aug-2016 |
christos | be less aggressive in clearing blocks to protect against:
int main(int argc, char *argv[]) { int rv;
if ((rv = ({ int _ret = 1; if (argc == 1) {} _ret; })) != 0) printf("%d\n", rv); return 0; }
|
1.79 | 31-Jul-2016 |
dholland | Don't allow initializers of the form { .a = .b = expr } as this is not valid. Helps a bit with PR 22500.
|
1.78 | 20-Jul-2016 |
christos | accept attributes in param decls
|
1.77 | 20-Jul-2016 |
christos | handle "extern __attribute__((__gnu_inline__)) __inline"
|
1.76 | 27-Feb-2016 |
christos | branches: 1.76.2; Add visibility and weak
|
1.75 | 02-Jan-2016 |
christos | Handle function symbol renames.
|
1.74 | 13-Oct-2015 |
christos | the next symbol should be a type.
|
1.73 | 13-Oct-2015 |
christos | handle anonymous struct/union members.
|
1.72 | 13-Oct-2015 |
christos | more descriptive aborts
|
1.71 | 28-Jul-2015 |
christos | handle c99 nested struct initialization { .data.foo[0] = 1 }
|
1.70 | 01-Jul-2015 |
christos | Fix segmentation fault caused by freeing prematurely function parameter types inside cast expressions.
|
1.69 | 11-May-2015 |
christos | handle compound literals with a trailing comma
|
1.68 | 03-Apr-2015 |
christos | accept typenames in param decls.
|
1.67 | 26-Sep-2014 |
christos | oops I terminated the block too early (thanks unit tests!)
|
1.66 | 26-Sep-2014 |
christos | make for introduce a new block level for c99 decls.
|
1.65 | 21-Apr-2014 |
christos | add more attributes
|
1.64 | 21-Apr-2014 |
christos | add asm function renames
|
1.63 | 18-Apr-2014 |
christos | add more places where attribute is valid.
|
1.62 | 18-Apr-2014 |
christos | handle constant attribute
|
1.61 | 18-Apr-2014 |
christos | Handle the rest of gcc __attribute__ s.
|
1.60 | 17-Apr-2014 |
christos | typeof and extension don't need parens
|
1.59 | 23-Mar-2014 |
dholland | branches: 1.59.2; typo in comment
|
1.58 | 18-Feb-2014 |
christos | add __extension__ and typeof
|
1.57 | 04-Feb-2014 |
njoly | Handle another declaration after statement case for lint in c99 mode. Add the corresponding testcase.
|
1.56 | 16-Jan-2014 |
christos | empty init_decl {} is valid
|
1.55 | 19-Apr-2013 |
christos | Allow linted comments to take an argument that defines which error to suppress.
|
1.54 | 27-Mar-2012 |
christos | branches: 1.54.2; more cross lint friendlyness XXX: needs more constants converted double/float
|
1.53 | 25-Dec-2011 |
christos | fix the grammar conflict differently.
|
1.52 | 25-Dec-2011 |
christos | PR/45666: Nicolas Joly: lint(1) wrong 'syntax error' message
|
1.51 | 19-Dec-2011 |
njoly | c99: do not warn about trailing comma in enum declaration.
|
1.50 | 04-Oct-2011 |
christos | branches: 1.50.2; Handle c99 declarations in the middle of blocks.
|
1.49 | 09-Feb-2010 |
wiz | Fix typo in comment.
|
1.48 | 03-Oct-2009 |
christos | add type attributes in a few more places.
|
1.47 | 03-Oct-2009 |
christos | accept struct { ... } __packed name;
|
1.46 | 02-Oct-2009 |
christos | recognize struct __packed x { }; in addition to struct x { } __packed;
|
1.45 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.44 | 02-May-2009 |
christos | Add __alignof__.
|
1.43 | 01-May-2009 |
christos | add variable declarations in for loops for c99
|
1.42 | 16-Nov-2008 |
dholland | branches: 1.42.2; WARNS=4
|
1.41 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.40 | 25-Apr-2008 |
christos | handle case C1 ... C2:
|
1.39 | 08-Nov-2006 |
christos | branches: 1.39.16; - add debugging to track nowarns - make /*LINTED*/ take effect on unused functions
|
1.38 | 17-Oct-2006 |
he | Use __inline instead of inline, to allow linting of ourselves...
|
1.37 | 12-Jul-2006 |
christos | 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.
|
1.36 | 24-Dec-2005 |
perry | Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
|
1.35 | 17-Jul-2005 |
christos | Handle C99 array range initializers:
type a[] = { [lo ... hi] = c }:
|
1.34 | 03-Aug-2004 |
yamt | recognize C99 array initializer designators. PR/18896.
|
1.33 | 24-May-2003 |
christos | handle void ({ })
|
1.32 | 20-May-2003 |
christos | Better implementation of ({}) gcc extension.
|
1.31 | 18-May-2003 |
kristerw | 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.
|
1.30 | 23-Oct-2002 |
christos | mention what is wrong with the ({}) productions.
|
1.29 | 22-Oct-2002 |
christos | add support for ({}) gcc shit.
|
1.28 | 22-Oct-2002 |
christos | add C9X/GCC compound literal expressions.
|
1.27 | 22-Oct-2002 |
christos | add variable array dimension.
|
1.26 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.25 | 13-Sep-2002 |
christos | 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.
|
1.24 | 05-Feb-2002 |
thorpej | 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.
|
1.23 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.22 | 30-Jan-2002 |
thorpej | Add a missing "static" on a function decl.
|
1.21 | 26-Jul-2001 |
wiz | Various typos in comments (neccessary, sceme, choise, ...).
|
1.20 | 28-May-2001 |
lukem | 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.
|
1.19 | 24-May-2001 |
lukem | oops! delint previous
|
1.18 | 24-May-2001 |
lukem | allow trailing , in enum if -g
|
1.17 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.16 | 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.15 | 23-Nov-1998 |
christos | branches: 1.15.8; 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.
|
1.14 | 13-Nov-1998 |
christos | Fix problems with LINTED comment:
if (a) b; /*LINTED*/ c;
if (a) { b; } /*LINTED*/ c;
do { b; } /*LINTED*/ while (c);
Produced warnings for c.
|
1.13 | 22-Feb-1998 |
christos | WARNSify
|
1.12 | 06-Nov-1997 |
cjs | I do wish people would start including <string.h> when they use memcpy.
|
1.11 | 03-Nov-1997 |
cgd | 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.
|
1.10 | 09-May-1997 |
mycroft | branches: 1.10.2; Hack to work around compiler bug for now.
|
1.9 | 22-Dec-1996 |
cgd | * Accept asm statements at any place where you could see a function or variable declaration, in addition to within function & variable declarations and function bodies. I think this comes close enough to what gcc does to be considered "correct enough." Certainly, it fixes the problem for the couple of cases where this is a problem in our tree.
|
1.8 | 02-Oct-1995 |
jpo | don't print warnings about unused variables or arguments in compound statements which contain asm statements.
|
1.7 | 02-Oct-1995 |
jpo | 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.
|
1.6 | 02-Oct-1995 |
jpo | support asm statements and asm modifiers in declarations
asm statements consist of an asm keyword, an optional qualifier, a left paren, a list of tokens up to and including the matching right paren, and a semicolon.
asm modifiers consist of an asm keyword, an left paren, a string and a right paren.
asm statements and modifiers have no semantic for lint(1), they exist only to avoid complaints about them.
|
1.5 | 02-Oct-1995 |
jpo | __{const,signed,volatile}{__,} added const, signed and volatile are disabled with -t
|
1.4 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.3 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.10.2.2 | 12-Nov-1997 |
mellon | Pull rev 1.12 up from trunk (cjs)
|
1.10.2.1 | 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.15.8.1 | 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.39.16.1 | 18-May-2008 |
yamt | sync with head.
|
1.42.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.50.2.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.50.2.1 | 17-Apr-2012 |
yamt | sync with head
|
1.54.2.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.54.2.1 | 23-Jun-2013 |
tls | resync from head
|
1.59.2.1 | 10-Aug-2014 |
tls | Rebase.
|
1.76.2.4 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.76.2.3 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.76.2.2 | 06-Aug-2016 |
pgoyette | Sync with HEAD
|
1.76.2.1 | 26-Jul-2016 |
pgoyette | Sync with HEAD
|
1.92.2.1 | 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.95.4.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.95.2.4 | 18-Jan-2019 |
pgoyette | Synch with HEAD
|
1.95.2.3 | 26-Nov-2018 |
pgoyette | Sync with HEAD, resolve a couple of conflicts
|
1.95.2.2 | 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.95.2.1 | 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.506.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.22 | 01-Mar-2024 |
rillig | tests/lint: remove redundant documentation
|
1.21 | 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.20 | 12-Aug-2023 |
rillig | lint: clean up
|
1.19 | 10-Jul-2023 |
rillig | lint: ensure that untyped grammar rules are listed
Untyped grammar rules are suspicious because they subtly affect the order in which the grammar actions are performed. This leads to the various bugs mentioned in msg_347.c.
|
1.18 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.17 | 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.16 | 03-Jul-2022 |
rillig | lint: do not treat message IDs as arithmetic numbers
No functional change.
|
1.15 | 03-Jul-2022 |
rillig | lint: remove unused code in consistency checker
|
1.14 | 03-Jul-2022 |
rillig | lint: verify that comment above warning_at matches the message
No binary change.
|
1.13 | 16-Dec-2021 |
rillig | tests/lint: ensure that tests on a message mention this message
|
1.12 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.11 | 15-Jun-2021 |
rillig | tests/lint1: make error handling in the lint1 linter simpler
|
1.10 | 14-Apr-2021 |
rillig | lint: add support for C11-isms such as int[static 3]
|
1.9 | 28-Feb-2021 |
rillig | tests/lint: shorten code for checking redundancy in files
No functional change.
|
1.8 | 28-Feb-2021 |
rillig | tests/lint: keep messages in test files in sync with actual messages
Each of the tests named msg_*.c repeats the template of the message, to make the test somewhat self-contained when viewed in isolation.
This creates a redundancy, and keeping track of this manually is next to impossible. I tried it and failed in 9 cases, even though it has just been 2 months since I myself created the initial files and I knew all the time that this redundancy exists.
Be fool-proof for the future by checking this automatically.
|
1.7 | 19-Feb-2021 |
rillig | lint: shorten code in check-msgs.lua
No functional change.
|
1.6 | 31-Jan-2021 |
rillig | lint: mention the operator in messages about bit shifts
|
1.5 | 02-Jan-2021 |
rillig | lint: fix typo in check-msgs tool
|
1.4 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.3 | 01-Jan-2021 |
rillig | lint: align comments with actual message, in the lexer and parser
|
1.2 | 01-Jan-2021 |
rillig | lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format strings from the actual arguments prevents the compiler from cross-checking them.
|
1.1 | 31-Dec-2020 |
rillig | lint: check messages and their IDs for consistency
|
1.32 | 12-May-2024 |
rillig | lint: condense code for strict bool mode
|
1.31 | 12-May-2024 |
rillig | lint: in strict bool mode, allow do-while-0
Even though 0 is not a boolean constant, allow this common idiom, to help in those cases where the C preprocessor used by lint does not mark tokens as coming from system headers (Clang).
|
1.30 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.29 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.28 | 30-Dec-2023 |
rillig | lint: in strict bool mode, allow 'a & b' in controlling expressions
Previously, the expression 'a & b' was only treated as bool if 'a' had enum type. This didn't cover cases in which bit masks were implemented using integer types instead of enum sets.
|
1.27 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.26 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.25 | 10-Jul-2023 |
rillig | lint: merge duplicate code for getting the name of an operator
|
1.24 | 09-Jul-2023 |
rillig | lint: remove redundant '#' after 'argument' in diagnostics
|
1.23 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.22 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.21 | 22-May-2023 |
rillig | lint: rename constant NOTSPEC to NO_TSPEC
It was too easy to misread the old name as NOT_SPEC instead of the intended NO_TSPEC.
|
1.20 | 21-Jan-2023 |
rillig | lint: make code for strict bool mode more consistent
Guard all entry points with a check for Tflag and remove the now redundant internal check for Tflag.
No functional change.
|
1.19 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.18 | 19-Jun-2022 |
rillig | lint: add quotes around placeholders in 4 messages
|
1.17 | 15-Jun-2022 |
rillig | lint: rename mod_t.m_requires_bool to m_compares_with_zero
The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict bool mode, in default mode they accept any scalar expression and compare it with zero. The new names are more accurate.
No functional change.
|
1.16 | 15-Jun-2022 |
rillig | lint: clean up an empty line and the documentation
No functional change.
|
1.15 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.14 | 19-May-2022 |
rillig | lint: in strict bool mode, check function arguments more strictly
When a system header defined the constant FALSE = 0, that constant could be passed as a bool argument. On the other hand, the constant TRUE = 1 could not be passed in the same way. Remove this inconsistency.
|
1.13 | 16-Apr-2022 |
rillig | lint: merge mod_t.m_test_context into m_requires_bool
These two flags mean exactly the same.
No functional change.
|
1.12 | 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.11 | 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.10 | 22-Dec-2021 |
rillig | lint: fix wrong error in strict bool mode in condition with comma
For the result of the comma operator, it doesn't matter whether the comma itself comes from a system header or not. Instead, it's the main operator of the right operand.
Since 2021-11-16.
|
1.9 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.8 | 26-Jul-2021 |
rillig | lint: make typeok_scalar_strict_bool simpler
No functional change.
|
1.7 | 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.6 | 02-Jul-2021 |
rillig | lint: in strict bool mode, make (flag & FLAG) simpler
This is a tiny change in an edge case that does not occur in practice, which is that the left-hand side of the '&' is explicitly cast to an enum type. The apparent "loss of information" from the deleted comment has already been explained in the previous commit.
|
1.5 | 02-Jul-2021 |
rillig | lint: no special check for unary operators in strict bool mode
All interesting constellations regarding unary operators are already covered by the simple model from ops.def.
No functional change.
|
1.4 | 20-Jun-2021 |
rillig | lint: rename val_t.v_unsigned to avoid confusion
The name v_unsigned suggested that the value would be interpreted as unsigned, which was wrong. Whether a value is signed or unsigned is decided by v_tspec instead.
Revert the previous commit for boolen constants since their value is already interpreted as unsigned, and there is no need for any warning about differences between traditional C and ANSI C since the _Bool type has only been added ten years later in C99.
The code for printing a tree node was also confused by this struct member, even with its old name v_ansiu. That code will be fixed in a follow-up commit.
No functional change.
|
1.3 | 20-Jun-2021 |
rillig | lint: in strict bool mode, treat boolean constants as unsigned
In strict bool mode, bool is not an arithmetic type anyway, therefore it doesn't matter whether the type is signed or unsigned.
C99 6.2.5p6 defines _Bool as one of the "standard unsigned integer types", so making the constants unsigned is more accurate.
No functional change.
|
1.2 | 20-Jun-2021 |
rillig | lint: rename val_t.v_ansiu to v_unsigned
When lint was written in 1995, traditional C was still nearby since C90 had been around for only 5 years. 26 years later, almost all code adheres to C90 or even C99 or C11, therefore "C90 or later" can safely be assumed as the default.
No functional change.
|
1.1 | 06-Apr-2021 |
rillig | lint: move check for strict bool mode into separate file
No functional change.
|
1.13 | 18-Dec-2024 |
rillig | lint: warn about unusual argument types in <ctype.h> functions
|
1.12 | 19-Mar-2024 |
rillig | branches: 1.12.2; lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.11 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.10 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.9 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.8 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.7 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.6 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.5 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.4 | 19-Mar-2022 |
rillig | lint: be more specific in comment about <ctype.h> check
No binary change.
|
1.3 | 25-Jul-2021 |
rillig | lint: split is_ctype_function into separate parts
This reduces the number of string comparisons for function names that start with 'is' or 'to'.
The tests now cover function names that start with 'is' or 'to' but are not one of the well-known functions from ctype.h. This removes the '*' in the output from gcov.
No functional change.
|
1.2 | 05-Apr-2021 |
rillig | lint: inline macro in check for <ctype.h> functions
No functional change.
|
1.1 | 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.12.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.28 | 27-Feb-2025 |
rillig | lint: allow the getopt warning to be suppressed in the natural place
|
1.27 | 19-Mar-2024 |
rillig | branches: 1.27.2; lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.26 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.25 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.24 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.23 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.22 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.21 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.20 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.19 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.18 | 29-Jan-2024 |
rillig | lint: check getopt call more strictly
Previously, '(c = getopt(...)) != -2' would match as well.
|
1.17 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.16 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.15 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.14 | 01-Nov-2021 |
rillig | lint: enter full C90 compatibility mode
The C99 comment in tree.c:3468 has been there since 2017-03-06, without anyone complaining that their compiler would not handle it.
Strangely, running GCC 10.3.0 in '-std=c90' mode does not complain about declarations after statements, '-Wdeclaration-after-statement' is needed separately.
No functional change.
|
1.13 | 01-Nov-2021 |
rillig | lint: move all declarations above statements
All code that is used by src/tools is supposed to be compatible with C90.
No functional change.
|
1.12 | 09-Oct-2021 |
rillig | lint: warn if a getopt switch tries to handle unreachable ':'
|
1.11 | 22-Aug-2021 |
rillig | lint: fix wrong warning about '?' in getopt
|
1.10 | 04-Jun-2021 |
rillig | lint: fix function name in check for getopt
No functional change.
|
1.9 | 18-Apr-2021 |
rillig | branches: 1.9.4; lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
|
1.8 | 18-Apr-2021 |
rillig | lint: migrate the getopt check to warning_at
|
1.7 | 22-Mar-2021 |
rillig | lint: reduce visibility of global variable for getopt check
No functional change.
|
1.6 | 20-Feb-2021 |
rillig | lint: reduce duplicate code in check for getopt
This also changes the conditions to their positive form, which is easier to read.
No functional change. The resulting binary would have been the same as before, were it not for the changed line numbers in the lint_assert calls further down in the code.
|
1.5 | 20-Feb-2021 |
rillig | lint: clean up check for getopt
The original options string is not needed during the check. Having only the unhandled options suffices.
No functional change.
|
1.4 | 20-Feb-2021 |
rillig | lint: fix crash from ckgetopt.c 1.2 and document the data structures
|
1.3 | 20-Feb-2021 |
christos | Prevent crashing when options are NULL in libc while linting src/lib/libc/posix1e/acl_from_text.c
|
1.2 | 19-Feb-2021 |
rillig | lint: fix build in tools mode
|
1.1 | 19-Feb-2021 |
rillig | lint: warn about mismatch in getopt handling
|
1.9.4.1 | 06-Jun-2021 |
cjep | sync with head
|
1.27.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.16 | 31-Aug-2025 |
rillig | lint: check for mismatches in snprintb conversions
Seen in sh3/dmacreg.h, SH3_DMAC_CHCR_BITS.
|
1.15 | 12-May-2024 |
rillig | lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.14 | 12-Apr-2024 |
rillig | lint: clean up and speed up the check for snprintb
|
1.13 | 12-Apr-2024 |
rillig | lint: in snprintb, warn about all escaped characters in descriptions
|
1.12 | 25-Mar-2024 |
rillig | lint: rename snprintb 'directives' to 'conversions'
This aligns the terminology with the snprintf function.
|
1.11 | 13-Mar-2024 |
rillig | lint: trim down the check for snprintb formats
|
1.10 | 10-Mar-2024 |
rillig | lint: clean up tree matcher for snprintb calls
|
1.9 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.8 | 09-Mar-2024 |
rillig | lint: remove unneeded checks for left and right operands
|
1.7 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.6 | 03-Mar-2024 |
rillig | lint: warn about escaped snprintb directive
Repurpose message 362, as the previous version was redundant since null bytes in old-style formats are already covered by message 371 (bit position out of range) and 377 (redundant '\0' at the end).
|
1.5 | 03-Mar-2024 |
rillig | lint: fix warning about "empty" single-letter snprintb descriptions
|
1.4 | 03-Mar-2024 |
rillig | lint: check for unreachable bits and fields in snprintb formats
While here, clean up a few existing checks.
|
1.3 | 02-Mar-2024 |
rillig | lint: check snprintb formats for overlapping bits and fields
|
1.2 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.1 | 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.84 | 11-Jul-2025 |
rillig | lint: fix warning about enum array index
Seen in openssh/fmt_scaled.c, scale_chars.
|
1.83 | 20-Feb-2025 |
rillig | lint: support __attribute__((__mode__(TI)))
This fixes the wrong lint warnings about the shift amount being greater than the type size in compiler_rt/popcountti2.c.
|
1.82 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.81 | 28-Sep-2024 |
rillig | lint: handle __attribute__((__unused__)) for functions and variables
Previously, lint ignored the '__unused' marker, requiring its own /* ARGSUSED */ marker instead.
Previously, attributes were interpreted as soon as the closing parenthesis was parsed. For a function definition such as '__unused static void f(void) {}', this was too early, as the attribute was not connected to the function, as the function was not parsed yet.
Now, the 'unused' attribute is passed around by the parser, until it is merged into the declarator where it belongs. Due to an inaccuracy in the grammar, the 'used' attribute has to be passed through a parameter_list, even though a parameter list is not related to attributes. Still, it's better than before.
|
1.80 | 24-Sep-2024 |
rillig | lint: exclude the GCC builtins from debug logging
Their source code is parsed for simplicity, and since the text is fixed, there is nothing surprising to be expected there. Instead, start debugging when the actual code begins.
|
1.79 | 11-May-2024 |
rillig | branches: 1.79.2; lint: parse but otherwise ignore C23 attributes
The C23 attributes are only parsed before an expression in an expression statement, as a proof of concept. Other places will follow later.
|
1.78 | 09-May-2024 |
rillig | lint: in C23 mode, support the nullptr constant
|
1.77 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.76 | 01-May-2024 |
rillig | lint: support _Alignas and __attribute__((__aligned(4)))
|
1.75 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.74 | 19-Mar-2024 |
rillig | lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.73 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.72 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.71 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.70 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.69 | 02-Feb-2024 |
rillig | lint: fix debug output for strings, reduce code size
The debug output contained too many newlines.
The buffer functions were built into lint2 even though they weren't used.
Enable the query for invisible characters in string literals, to make sure that a newline in a string literal does not trigger that query.
|
1.68 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.67 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.66 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.65 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.64 | 02-Dec-2023 |
rillig | lint: rename NOSCL to NO_SCL
For symmetry with NO_TSPEC. No functional change.
|
1.63 | 17-Oct-2023 |
rillig | lint: fix debug output of convert/cast operators
The default name of the 'CVT' operator is 'convert', therefore the override is only needed for 'cast'.
|
1.62 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.61 | 02-Aug-2023 |
rillig | lint: remove unused string literals
|
1.60 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.59 | 01-Aug-2023 |
rillig | lint: improve debug logging for declarators
|
1.58 | 30-Jul-2023 |
rillig | lint: in debug mode, default to indenting the debug log
Only the 'parsing' lines are not indented, as line breaks are independent from the structure of the code.
|
1.57 | 30-Jul-2023 |
rillig | lint: in memory debug mode, log the type of the nodes
First log all objects to be freed, then free them all at once. This allows cross references from the objects of a block independent of their allocation order.
|
1.56 | 28-Jul-2023 |
rillig | lint: extract 'vararg' and 'prototype' flags from global 'dcs'
These flags are only relevant for parameter lists, so add a separate type for it.
No functional change.
|
1.55 | 13-Jul-2023 |
rillig | lint: merge duplicate code for checking duplicate type qualifiers
|
1.54 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.53 | 13-Jul-2023 |
rillig | lint: _Thread_local is a storage class, not a type qualifier
|
1.52 | 12-Jul-2023 |
rillig | lint: clean up handling of __real__ and __imag__
These two operatos are not binary, therefore they don't need a right operand. The questionable operands were a copy-and-paste mistake, as the code was taken from the ++ and -- operands (tree.c 1.46 from 2008-04-25). The ++ and -- operands aren't binary either, but since lint represents address calculations in their premultiplied form, the expression ptr++ contains a hidden right operand specifying the number of bytes by which to increment the pointer.
Creating an integer-constant-expression node with type 'long double' didn't make sense either. Luckily, these expressions are only built but not analyzed any further.
|
1.51 | 12-Jul-2023 |
rillig | lint: reject _Noreturn if it occurs in invalid places
C11 introduced _Noreturn as a function-specifier, not as a type attribute. The latter may occur in more places.
|
1.50 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.49 | 10-Jul-2023 |
rillig | lint: merge duplicate code for getting the name of an operator
|
1.48 | 10-Jul-2023 |
rillig | lint: improve debug output when debugging the grammar parser
|
1.47 | 08-Jul-2023 |
rillig | lint: clean up
PUSH nodes are not marked as binary, yet they have a left and a right operand.
If none of the queries is enabled, omit the query from the debug log.
|
1.46 | 02-Jul-2023 |
rillig | lint: clean up variable names relating to structure padding
|
1.45 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.44 | 02-Jul-2023 |
rillig | lint: use unsigned int for struct alignment
This gets rid of 'unsigned short', which saved a few bytes of memory but was inconvenient to deal with.
No functional change.
|
1.43 | 02-Jul-2023 |
rillig | lint: extend debug logging for declaration levels
Indent the debug logging according to the declaration level.
Since there are a few cases where the enclosing declaration levels are modified, log the whole declaration level stack whenever a level begins or ends.
|
1.42 | 02-Jul-2023 |
rillig | lint: clean up variable names
|
1.41 | 01-Jul-2023 |
rillig | lint: clean up typos
|
1.40 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.39 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.38 | 30-Jun-2023 |
rillig | lint: clean up packing of structs and unions
No functional change outside debug mode.
|
1.37 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.36 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.35 | 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.34 | 23-Jun-2023 |
rillig | lint: remove redundant printflike declarations from debugging code
|
1.33 | 03-Jun-2023 |
rillig | lint: loosen assertion that unary operators have only a single operand
|
1.32 | 03-Jun-2023 |
rillig | lint: use consistent and configurable stream for debug output
|
1.31 | 22-May-2023 |
rillig | lint: rename constant NOTSPEC to NO_TSPEC
It was too easy to misread the old name as NOT_SPEC instead of the intended NO_TSPEC.
|
1.30 | 22-Apr-2023 |
rillig | lint: fix missing initialization for cast to union
The left operand of a unary AST node must not be NULL.
The previous code crashed lint when run with some query enabled, as is_cast_redundant assumes that a non-null AST node has valid operands.
$ cat <<EOF > crash.c double demo(void) { union u { double *num; } u; u = (union u)&((double) { 0.0 }); return *u.num; } EOF $ /usr/libexec/lint1 -w -S -g -q8 crash.c /dev/null
|
1.29 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.28 | 11-Apr-2023 |
rillig | lint: in debug mode, use different names for macro and function
No functional change.
|
1.27 | 10-Apr-2023 |
rillig | lint: add debug logging for values that differ between trad and C90
|
1.26 | 28-Mar-2023 |
rillig | lint: condense debugging code
No functional change.
|
1.25 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.24 | 08-Jan-2023 |
rillig | lint: unclutter debug logging for nodes
No functional change.
|
1.23 | 16-Jul-2022 |
rillig | lint: add missing space before func_proto_sym in debug mode
|
1.22 | 03-Jul-2022 |
rillig | lint: add debug logging for struct and enum details
|
1.21 | 26-May-2022 |
rillig | lint: fix spacing and line breaks in debug logging
The spacing between function arguments in a declaration info was too big, it was the indentation level instead of a single space.
The function debug_sym is used for two purposes: own-line and in-line, which coincidentally are distinguished by whether the suffix string is "\n".
|
1.20 | 26-May-2022 |
rillig | lint: improve debug logging for NAME expressions
In a NAME expression, the name is an essential part, so put it to the front, in natural reading order.
|
1.19 | 26-May-2022 |
rillig | lint: add missing newlines in debug_node
|
1.18 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.17 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.16 | 09-Apr-2022 |
rillig | lint: rename dinfo_t.d_offset to d_offset_in_bits
Most often, offsets are measured in bytes, so better embed the unit in the variable name.
No functional change.
|
1.15 | 09-Apr-2022 |
rillig | lint: extract is_member into separate function
No functional change.
|
1.14 | 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.13 | 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.12 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.11 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.10 | 02-Apr-2022 |
rillig | lint: add debug logging for the declaration stack
To track down the wrong edge cases in decl_direct_abstract.c.
|
1.9 | 01-Mar-2022 |
rillig | lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and debug_symtab can be called as needed during a debug session.
|
1.8 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.7 | 21-Dec-2021 |
rillig | lint: rename debug_indent to debug_print_indent
The previous name could be mistaken to mean "increase the indentation of the debug output". Instead, the function prints the current indentation.
In externs1.h, the macro definition was a duplicate, the macros were sorted differently than the functions a few lines above.
No binary change.
|
1.6 | 20-Dec-2021 |
rillig | lint: in debug mode, output value of boolean expressions
|
1.5 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.4 | 16-Nov-2021 |
rillig | tests/lint: explain the missing error message in strict bool mode
There are 2 separate bugs that lead to the missing error message.
The first bug is that when parsing a name, the information about whether that name comes from a system header is not properly recorded for the last token before switching from or to a system header.
The second bug is that for determining whether the type of a function call expression is relaxed, the types of the function call arguments are taken into account, even though the type only depends on the function itself. The same idea applies to the operators '<<' and '>>', as their result type only depends on the left operand, at least since C90.
|
1.3 | 22-Aug-2021 |
rillig | lint: merge duplicate code for binary operator
No functional change.
|
1.2 | 01-Aug-2021 |
rillig | lint: merge duplicate debugging code
The functions 'debug_node' and 'display_expression' were similar enough to be merged.
Migrate debug_node to use the existing debug logging functions.
Remove the now unused option 'd' from the options string.
|
1.1 | 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.79.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.421 | 18-Sep-2025 |
rillig | lint: in C23 mode, do not warn about an empty parameter list
|
1.420 | 14-May-2025 |
rillig | lint: extract type_attributes functions from grammar
|
1.419 | 14-May-2025 |
rillig | lint: accept '__attribute__((mode(TI)))' before 'unsigned'
|
1.418 | 04-May-2025 |
rillig | lint: in a parameter declaration using typedef, keep the qualifiers
While C23 6.7.7.4p6 doesn't explicitly mention this particular case of a 'const typedef', keeping the qualifiers fixes a warning in probably legitimate code.
Seen in cvs, regex_internal.c, function 'bitset_contain'.
|
1.417 | 12-Apr-2025 |
rillig | lint: reword messages that apply to traditional C
|
1.416 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.415 | 10-Apr-2025 |
rillig | lint: remove now-unnecessary CONSTCOND comments
|
1.414 | 10-Mar-2025 |
rillig | lint: in C99 mode and later, warn about non-prototype functions
Suggested by Christos Zoulas.
|
1.413 | 27-Feb-2025 |
rillig | lint: normalize whitespace
|
1.412 | 03-Jan-2025 |
rillig | lint: add detail to message about obsolete identifier list
|
1.411 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.410 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.409 | 28-Nov-2024 |
rillig | lint: add queries for typedefs to struct/union and their pointers
As suggested in share/misc/style since 1.75 from August 2023.
These are queries instead of warnings as the number of false positives or historical practice is too high; these queries are only intended for detecting these typedefs on newly added types.
|
1.408 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.407 | 29-Oct-2024 |
rillig | lint: add details to message about too large integer constant
|
1.406 | 14-Oct-2024 |
rillig | lint: add more details to messages about hidden symbols
|
1.405 | 28-Sep-2024 |
rillig | lint: handle __attribute__((__unused__)) for functions and variables
Previously, lint ignored the '__unused' marker, requiring its own /* ARGSUSED */ marker instead.
Previously, attributes were interpreted as soon as the closing parenthesis was parsed. For a function definition such as '__unused static void f(void) {}', this was too early, as the attribute was not connected to the function, as the function was not parsed yet.
Now, the 'unused' attribute is passed around by the parser, until it is merged into the declarator where it belongs. Due to an inaccuracy in the grammar, the 'used' attribute has to be passed through a parameter_list, even though a parameter list is not related to attributes. Still, it's better than before.
|
1.404 | 04-Sep-2024 |
rillig | lint: clean up checks for declarations
|
1.403 | 12-May-2024 |
rillig | branches: 1.403.2; lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.402 | 04-May-2024 |
rillig | lint: increase debug logging for declarations
All changes to the global variable 'dcs' are tracked now, to help identify the cause of the failing tests in expr_sizeof and gcc_attribute_aligned.
While here, test more invalid type combinations in typedefs.
|
1.401 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.400 | 01-May-2024 |
rillig | lint: fix size of struct with large alignment
Lint now successfully passes all compile-time assertions in the amd64 kernel that deal with struct sizes.
|
1.399 | 01-May-2024 |
rillig | lint: support _Alignas and __attribute__((__aligned(4)))
|
1.398 | 30-Mar-2024 |
rillig | lint: document which fields are not reset when starting a new type
Setting all visible fields to their null value seemed as if the whole object were reset.
|
1.397 | 29-Mar-2024 |
rillig | lint: clean up
|
1.396 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.395 | 09-Mar-2024 |
rillig | lint: use fewer struct keywords
|
1.394 | 02-Mar-2024 |
rillig | lint: remove custom wrappers around <ctype.h> functions
|
1.393 | 08-Feb-2024 |
rillig | lint: clean up variable names, parameter order, comments
No functional change.
|
1.392 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.391 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.390 | 23-Jan-2024 |
rillig | lint: unconst parameters
These were leftovers from earlier refactorings and are no longer needed.
No binary change.
|
1.389 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.388 | 21-Jan-2024 |
rillig | lint: clean up redundant const from parameters and local variables
These were leftovers from splitting large functions into smaller functions, to ensure that variables were not unintentionally reassigned. Those refactorings are finished, and the extra help from the compiler is no longer necessary.
No binary change.
|
1.387 | 20-Jan-2024 |
rillig | lint: add query for const automatic variables
|
1.386 | 06-Jan-2024 |
rillig | lint: remove redundant parentheses, braces and comments
Rename the functions for folding constant expressions, to make the comments redundant.
|
1.385 | 10-Dec-2023 |
rillig | lint: allow querying for 'static' followed by non-'static' declaration
|
1.384 | 10-Dec-2023 |
rillig | lint: clean up comments
No functional change.
|
1.383 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.382 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.381 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.380 | 02-Dec-2023 |
rillig | lint: rename NOSCL to NO_SCL
For symmetry with NO_TSPEC. No functional change.
|
1.379 | 14-Sep-2023 |
rillig | lint: fix wording of diagnostics about 'C99 extension'
The term 'extension' means an extension to a C standard. C99 by itself is not an extension but a revision of the C standard.
|
1.378 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.377 | 02-Aug-2023 |
rillig | lint: remove unused string literals
|
1.376 | 02-Aug-2023 |
rillig | lint: do not return bogus types for unnamed function parameters
Since decl.c 1.18 from 2000-07-05, lint has returned bogus type information in cases where it couldn't interpret complicated declarators.
In cases like these, rather fail than proceed with wrong data.
|
1.375 | 02-Aug-2023 |
rillig | lint: fix handling of unnamed function parameters
|
1.374 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.373 | 02-Aug-2023 |
rillig | lint: simplify handling of old-style arguments
|
1.372 | 01-Aug-2023 |
rillig | lint: clear global variable 'dcs' after use
Having unnecessarily set members is confusing during debugging.
|
1.371 | 01-Aug-2023 |
rillig | lint: improve debug logging for declarators
|
1.370 | 31-Jul-2023 |
rillig | lint: fix assertion failure after unnamed bit-field member
Since 2023-07-15.
|
1.369 | 30-Jul-2023 |
rillig | lint: increase debug logging for declarations, constify
Lint doesn't parse declarators correctly, see msg_347.c, and fixing this part is nontrivial.
|
1.368 | 30-Jul-2023 |
rillig | lint: remove outdated comment (since decl.c 1.6 from 1995-10-02)
|
1.367 | 29-Jul-2023 |
rillig | lint: eliminate redundant code
No functional change.
|
1.366 | 29-Jul-2023 |
rillig | lint: condense code for ending a function
No functional change.
|
1.365 | 29-Jul-2023 |
rillig | lint: constify
|
1.364 | 29-Jul-2023 |
rillig | lint: remove forward declarations for functions
No functional change.
|
1.363 | 28-Jul-2023 |
rillig | lint: extract 'vararg' and 'prototype' flags from global 'dcs'
These flags are only relevant for parameter lists, so add a separate type for it.
No functional change.
|
1.362 | 25-Jul-2023 |
rillig | lint: allow 'thread_local' to be combined with 'static'
|
1.361 | 18-Jul-2023 |
rin | lint1:initdecl(): Remove hack for now-fixed PR port-sh3/56311
|
1.360 | 15-Jul-2023 |
rillig | lint: allow 'extern' and 'thread_local' to be combined
|
1.359 | 15-Jul-2023 |
rillig | lint: properly initialize unnamed struct/union members
Previously, their 'containing type' was not initialized. The code for initializing them is adapted from declarator_name.
|
1.358 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.357 | 15-Jul-2023 |
rillig | lint: add debug logging for memory management and the symbol table
|
1.356 | 14-Jul-2023 |
rillig | lint: clean up redundant and verbose code
|
1.355 | 13-Jul-2023 |
rillig | lint: merge duplicate code for checking duplicate type qualifiers
|
1.354 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.353 | 13-Jul-2023 |
rillig | lint: in C23 mode, recognize the keyword 'thread_local'
|
1.352 | 13-Jul-2023 |
rillig | lint: _Thread_local is a storage class, not a type qualifier
|
1.351 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.350 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.349 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.348 | 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.347 | 09-Jul-2023 |
rillig | lint: clean up wording in diagnostics
Use the term 'parameter' as defined in C99 3.15.
|
1.346 | 09-Jul-2023 |
rillig | lint: clean up the wording of a few diagnostics
|
1.345 | 08-Jul-2023 |
rillig | lint: warn about pointer casts between different kinds of types
Pointer casts from an integer type to a floating-point type and vice versa get a 'maybe troublesome' warning now. The previous assumption that all types of the same bit-size are convertible may have been valid from a technical point of view, but still such code should get more attention.
The rules for struct and union types could be made more fine-grained later, if the need arises. To suppress this warning, it's always possible to cast to an intermediate 'void *'.
|
1.344 | 08-Jul-2023 |
rillig | lint: clarify the meaning of 'portable size in bits' of a type
No functional change.
|
1.343 | 07-Jul-2023 |
rillig | lint: warn about function definitions without header declaration
The existing warning was only issued for function declarations, not for function definitions.
The interesting change in the tests is in msg_351.c. Many other tests use non-static functions due to their syntactic brevity. In these tests, the warning is disabled individually, to allow new functions to be added without generating warning 351.
|
1.342 | 07-Jul-2023 |
rillig | lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only combining them if actually desired.
|
1.341 | 03-Jul-2023 |
rillig | lint: invert the -u, -v and -z flags
Now they behave the same as in the manual page.
No functional change.
|
1.340 | 03-Jul-2023 |
rillig | lint: rename uppercase QUAD to LLONG
No binary change.
|
1.339 | 02-Jul-2023 |
rillig | lint: eliminate redundant conditions
|
1.338 | 02-Jul-2023 |
rillig | lint: clean up variable names relating to structure padding
|
1.337 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.336 | 02-Jul-2023 |
rillig | lint: use unsigned int for struct alignment
This gets rid of 'unsigned short', which saved a few bytes of memory but was inconvenient to deal with.
No functional change.
|
1.335 | 02-Jul-2023 |
rillig | lint: extend debug logging for declaration levels
Indent the debug logging according to the declaration level.
Since there are a few cases where the enclosing declaration levels are modified, log the whole declaration level stack whenever a level begins or ends.
|
1.334 | 02-Jul-2023 |
rillig | lint: initialize unnamed member like an unnamed bit-field
See set_bit_field_width.
|
1.333 | 02-Jul-2023 |
rillig | lint: clean up variable names
|
1.332 | 01-Jul-2023 |
rillig | lint: constify, reduce indentation
No functional change.
|
1.331 | 01-Jul-2023 |
rillig | lint: clean up duplicate and dead code for integer constants
No functional change.
|
1.330 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.329 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.328 | 30-Jun-2023 |
rillig | lint: replace macro for unique identifiers with function
No functional change.
|
1.327 | 30-Jun-2023 |
rillig | lint: clean up handling of declarations
No functional change.
|
1.326 | 30-Jun-2023 |
rillig | lint: fix computation of bit-field width
When bit-fields in packed structs were added on 2009-10-02, lint assumed that they would only use 'signed int' or 'unsigned int' as storage unit, even though C99 also allows _Bool.
The cleanup commit for decl.c 1.225 from 2021-08-28 accidentally changed the rounding mode for bit-field storage units from round-up to round-down.
|
1.325 | 30-Jun-2023 |
rillig | lint: clean up packing of structs and unions
No functional change outside debug mode.
|
1.324 | 30-Jun-2023 |
rillig | tests/lint: demonstrate bugs in anonymous struct/union handling
|
1.323 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.322 | 29-Jun-2023 |
rillig | lint: use standard terminology for bit-field width
No functional change.
|
1.321 | 29-Jun-2023 |
rillig | lint: clean up initialization of type properties
No functional change.
|
1.320 | 29-Jun-2023 |
rillig | lint: clean up function names
No functional change.
|
1.319 | 29-Jun-2023 |
rillig | lint: clean up completion of struct, union and enum declarations
No functional change.
|
1.318 | 24-Jun-2023 |
rillig | lint: add query for redundant 'extern' in function declaration
|
1.317 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.316 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.315 | 03-Jun-2023 |
rillig | lint: add query for static variables in functions
This query allows finding hidden global variables, as an easier-to-read alternative to 'objdump -t'.
|
1.314 | 22-May-2023 |
rillig | lint: use consistent variable name for redeclared symbol
No binary change.
|
1.313 | 22-May-2023 |
rillig | lint: fix emitted type for arrays of unknown size
|
1.312 | 22-May-2023 |
rillig | lint: clean up the name of a local variable
No binary change.
|
1.311 | 22-May-2023 |
rillig | lint: rename constant NOTSPEC to NO_TSPEC
It was too easy to misread the old name as NOT_SPEC instead of the intended NO_TSPEC.
|
1.310 | 25-Apr-2023 |
rillig | lint: reword message for missing declaration in header
Suggested by Christos.
|
1.309 | 22-Apr-2023 |
rillig | lint: fix wrong warning about 'extern' temporary identifier
|
1.308 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.307 | 28-Mar-2023 |
rillig | lint: warn about 'extern' declarations inside function bodies
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
The previous attempt (message 351 about 'extern' declarations outside headers) did not cover the proposal from the tech-userlevel mailing list but instead warns about a different usage pattern of the 'extern' keyword.
|
1.306 | 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.305 | 29-Jan-2023 |
rillig | lint: rename functions for function definition
No functional change.
|
1.304 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.303 | 14-Jan-2023 |
rillig | lint: use fewer abbreviations
No binary change except for line numbers in assertions in decl.c.
|
1.302 | 01-Oct-2022 |
rillig | branches: 1.302.2; lint: miscellaneous cleanup
No functional change.
|
1.301 | 01-Oct-2022 |
rillig | lint: reduce pointer indirection for unnamed entities
No functional change.
|
1.300 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.299 | 28-Aug-2022 |
rillig | lint: inline previous_declaration for nonconstant message IDs
This adds back the compile-time printf validation in debug mode that was missing before.
|
1.298 | 28-Aug-2022 |
rillig | lint: clean up visual clutter
No functional change.
|
1.297 | 28-Aug-2022 |
rillig | lint: rename functions to be clearer
No need anymore to keep external identifiers at the "6 significant initial characters" mandated by C90.
|
1.296 | 28-Aug-2022 |
rillig | lint: rename dcs manipulation functions to be clearer
No functional change.
|
1.295 | 26-Aug-2022 |
rillig | lint: clean up to_int_constant
No functional change.
|
1.294 | 03-Jul-2022 |
rillig | lint: include the width of bit-fields in the type name
|
1.293 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.292 | 21-Jun-2022 |
rillig | lint: use is_struct_or_union instead of comparing twice
No functional change.
|
1.291 | 21-Jun-2022 |
rillig | lint: add quotes and details to some more messages
|
1.290 | 20-Jun-2022 |
rillig | lint: add quotes around several placeholders in messages
|
1.289 | 19-Jun-2022 |
rillig | lint: add quotes around placeholders in 4 messages
|
1.288 | 19-Jun-2022 |
rillig | tests/lint: add quotes around placeholders in a few messages
|
1.287 | 15-Jun-2022 |
rillig | lint: unexport lint's messages
There was only a single place where a message was used directly, instead of calling one of the several functions for this purpose.
|
1.286 | 15-Jun-2022 |
rillig | lint: remove unnecessary memory allocation
No functional change.
|
1.285 | 11-Jun-2022 |
rillig | lint: add quotes around placeholders for a few more messages
|
1.284 | 11-Jun-2022 |
rillig | lint: add quotes around a few more placeholders in messages
|
1.283 | 31-May-2022 |
rillig | lint: fix null pointer dereference after syntax error
Found by afl, starting with the malformed input '/**/f=({;/**/};}' that no longer crashes. This input led to 'f=({L:;}', which is at least a syntactically valid prefix of a translation unit, containing a GCC statement expression with an unused label. The error message for this unused label assumed that it would always be inside a function definition.
While here, document incomplete recovery after syntax errors, in msg_249.c.
|
1.282 | 26-May-2022 |
rillig | lint: rename olwarn and LWARN_BAD to be more expressive
No functional change.
|
1.281 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.280 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.279 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.278 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.277 | 10-Apr-2022 |
rillig | lint: fix assertion failure on duplicate qualifiers from __typeof__
|
1.276 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.275 | 09-Apr-2022 |
rillig | lint: rename dinfo_t.d_offset to d_offset_in_bits
Most often, offsets are measured in bytes, so better embed the unit in the variable name.
No functional change.
|
1.274 | 09-Apr-2022 |
rillig | lint: extract is_member into separate function
No functional change.
|
1.273 | 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.272 | 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.271 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.270 | 09-Apr-2022 |
rillig | lint: rename length to length_in_bits
No functional change.
|
1.269 | 08-Apr-2022 |
rillig | lint: fix undefined behavior on enum overflow (since 1995)
GCC had optimized the check away, due to the obvious integer overflow 'x - 1 == INT_MAX'. To prevent further bugs like this, compile with -ftrapv.
|
1.268 | 03-Apr-2022 |
rillig | lint: fix crash after syntax error in array declaration
|
1.267 | 02-Apr-2022 |
rillig | lint: clean up style
Remove outdated ARGSUSED (the one in tree.c had been wrong since 1995), remove unused argument.
No functional change.
|
1.266 | 02-Apr-2022 |
rillig | lint: use appropriate alignment on both the host and target platform
|
1.265 | 02-Apr-2022 |
rillig | lint: remove unreachable message 'compiler takes alignment of function'
|
1.264 | 02-Apr-2022 |
rillig | lint: try harder to recover after syntax errors
lint: assertion "false" failed in declarator_name at decl.c:1596 near msg_022.c:22
|
1.263 | 02-Apr-2022 |
rillig | lint: extract type creation into separate functions
No functional change.
|
1.262 | 02-Apr-2022 |
rillig | lint: inline setcomplete
No functional change.
|
1.261 | 02-Apr-2022 |
rillig | lint: untangle nested variable assignments
The code is buggy (see decl_direct_abstract.c), so at least make it readable, making it hopefully easier to fix the bugs.
Before decl.c 1.18 from 2000-07-05, lint crashed when it parsed 'sizeof(int(double))', since that commit it has been hiding the bugs, working with wrong type information instead.
Fix the logged type in add_function (had been wrong since today).
|
1.260 | 02-Apr-2022 |
rillig | lint: do not log dinfo_t pointers in debug mode
Before the addition of debug_dinfo from today, this had been the only way to notice changes to the global 'dcs' variable. Since the content of that variable is now logged, the pointer is not needed anymore.
|
1.259 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.258 | 02-Apr-2022 |
rillig | lint: add debug logging for the declaration stack
To track down the wrong edge cases in decl_direct_abstract.c.
|
1.257 | 01-Apr-2022 |
rillig | lint: improve determination of abstract typename
Still not perfect, but at least a step in the right direction. See decl_direct_abstract.c for the missing edge cases.
See PR#22119.
|
1.256 | 01-Apr-2022 |
rillig | lint: add details to message about illegal return type
|
1.255 | 01-Apr-2022 |
rillig | lint: add debug logging for type declarators
This will help in fixing the wrong type in msg_347.c, as well as the assertion failure for 'sizeof(int())'.
|
1.254 | 01-Apr-2022 |
rillig | lint: fix indentation and spacing, add a missing 'else' to 'else if'
No functional change.
|
1.253 | 13-Mar-2022 |
rillig | lint: rename function 'cleanup' to be more expressive
No functional change.
|
1.252 | 01-Mar-2022 |
rillig | lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and debug_symtab can be called as needed during a debug session.
|
1.251 | 27-Feb-2022 |
rillig | tests/lint: add tests for messages about old-style functions
|
1.250 | 27-Feb-2022 |
rillig | lint: C99 has been released, so refer to it by its proper name
|
1.249 | 27-Feb-2022 |
rillig | lint: unabbreviate two more members of sym_t
No functional change.
|
1.248 | 27-Feb-2022 |
rillig | lint: unabbreviate some fields in sym_t
No functional change.
|
1.247 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in function names
No functional change.
|
1.246 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.245 | 27-Feb-2022 |
rillig | lint: rename ARG to OLD_STYLE_ARG
Pre-C90 argument declarations have been old for more than 30 years now, so mention that fact in the constant name. This reduces potential confusion with other occurrences of the words 'arg' or 'argument'.
No functional change.
|
1.244 | 07-Feb-2022 |
rillig | lint: reword message about bit-field in a union
There is nothing illegal about a bit-field in a union, it is allowed by C90, C99 and C11.
Fixes PR toolchain/53219.
|
1.243 | 22-Dec-2021 |
rillig | lint: use C90 instead of C89 when referring to the C standard
|
1.242 | 01-Nov-2021 |
rillig | lint: move all declarations above statements
All code that is used by src/tools is supposed to be compatible with C90.
No functional change.
|
1.241 | 17-Sep-2021 |
christos | downgrade bitfield in union to a warnings (ldpd uses it).
|
1.240 | 13-Sep-2021 |
rillig | lint: continue analysis of wrong type in abstract declaration
No functional change.
|
1.239 | 13-Sep-2021 |
rillig | lint: replace comment in new_style_function with equivalent code
No functional change.
|
1.238 | 13-Sep-2021 |
rillig | lint: eliminate local variable in new_style_function
No functional change.
|
1.237 | 12-Sep-2021 |
rillig | lint: track down wrong function type in abstract type
|
1.236 | 12-Sep-2021 |
rillig | lint: add more details to error about redeclaration
Message 27 is triggered by several conditions. The one triggered by register_vget in sbin/fsck_lfs/vnode.c needs more details than the others.
|
1.235 | 05-Sep-2021 |
rillig | lint: fix some more lint warnings
The only remaining warnings are in scan.c, which is a generated Flex scanner.
No functional change.
|
1.234 | 05-Sep-2021 |
rillig | lint: fix lint warnings
|
1.233 | 04-Sep-2021 |
rillig | lint: reduce indentation in tdeferr
No functional change.
|
1.232 | 04-Sep-2021 |
rillig | lint: use unsigned integers for size calculations
No change for type definitions that are smaller than 128 MB. For larger types, integer overflow might occur, just like before.
|
1.231 | 04-Sep-2021 |
rillig | lint: remove redundant and duplicate code
|
1.230 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.229 | 04-Sep-2021 |
rillig | lint: split declare_local into smaller functions
|
1.228 | 29-Aug-2021 |
rillig | lint: add __sync_ and _mm_ as prefixes for builtin functions
These two additions cover all cases that occur in the current NetBSD build on x86_64. This allows build_name to use the usual pattern 'if Sflag then error else if sflag then warning'. That function currently issues a warning in C99 as well, even though C99 prohibits implicit function declarations.
|
1.227 | 28-Aug-2021 |
rillig | lint: do not emit GCC builtin functions
Lint1 no longer emits declarations of GCC builtin functions and calls to them.
Previously, lint generated 3421 useless warnings in a default NetBSD build, like this:
__atomic_load_n, arg 1 used inconsistently acl.c(216)[pointer to unsigned int] rbtdb.c(921)[pointer to unsigned short]
This was because lint just doesn't understand that these functions are type-generic, which is indeed unusual in C.
These useless warnings made the lint output more frightening than it should actually be. Together with the strange formatting of the diagnostics (space-space-tab after the main message, two spaces and two colons between the occurrences, symbols are listed in hashcode order), this creates the impression that lint is not intended to be a user-friendly tool.
For now, fix the excess warnings, leaving the other items for later.
|
1.226 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types
Lint does not need to support any types larger than 256 MB since they don't occur in practice. Practically, such large types have never been supported at all since the function type_size_in_bits used int for the internal calculations, resulting in overflows.
|
1.225 | 28-Aug-2021 |
rillig | lint: fix a few lint warnings about type conversions
A simple 'unsigned int' is more than enough for representing the size of a bit-field, as well as the maximum alignment of any type.
No functional change.
|
1.224 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.223 | 28-Aug-2021 |
rillig | lint: clean up alignment_in_bits
The given type can never be NULL, and an array can never have NULL as subtype.
|
1.222 | 16-Aug-2021 |
rillig | lint: add more details to message about redeclared tag
|
1.221 | 10-Aug-2021 |
rillig | lint: fix 3 of the 4 wrong messages about lvalue in initial assignment
|
1.220 | 10-Aug-2021 |
rillig | lint: remove redundant test for negative bit-field size
A bit-field can never have negative size. Its type is an unsigned integer.
Strangely, GCC 10.3.0 only complains about this if the extra struct level lint1_type.t_b is removed. Clang 12.0.1 does not complain at all.
|
1.219 | 03-Aug-2021 |
rillig | lint: in strict enum mode, error out on enum type mismatch in union cast
|
1.218 | 03-Aug-2021 |
rillig | lint: casting to a struct is not allowed in C99, only with GCC
|
1.217 | 01-Aug-2021 |
rillig | lint: remove option -d, clean up debug logging
The command line option -d was not used by /usr/bin/lint, and it only triggered a handful of debug messages. Move this debug logging over to the compile-time -DDEBUG setting.
Move display_expression further up to avoid the forward declaration.
|
1.216 | 01-Aug-2021 |
rillig | lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault, probably related to the symbol table. To better understand this part, log insertions and deletions.
The other debug log messages do not need to mention the current file position anymore, this is what lex_next_line takes care of since scan.l 1.113 from 2021-01-05.
|
1.215 | 31-Jul-2021 |
rillig | lint: improve support for __int128_t and __uint128_t
For the .ln files, I chose the letter 'J' to represent the 128-bit integer types since it is close to 'I' for int. The naming of 'L' for 'long' is obvious, but 'Q' for 64-bit integers is a quad-16-bit word, which is an unusual measurement unit nowadays. One benefit of choosing 'J' is that the next letter, 'K' can then be used for 256-bit integer types.
Support for 128-bit integer types is still very basic. Plus, it is only supported on LP64 platforms, which means that lint cannot be cross-compiled to check for an LP64 platform while running on an ILP32 platform.
|
1.214 | 31-Jul-2021 |
rillig | lint: initialize shared types in the same order as in tspec_t
This makes it easier to see whether there are any types missing, such as __uint128_t.
No functional change.
|
1.213 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.212 | 31-Jul-2021 |
rillig | lint: add debugging output for the grammar tokens
No functional change outside debug mode.
|
1.211 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.210 | 25-Jul-2021 |
rillig | lint: move scl_name from print.c to decl.c
It is only needed there.
|
1.209 | 23-Jul-2021 |
rillig | lint: remove a few unnecessary abbreviations
No functional change.
|
1.208 | 23-Jul-2021 |
rillig | lint: make offset and alignment positive numbers
There's no use case for negative alignment or offsets in structures.
No functional change.
|
1.207 | 15-Jul-2021 |
rillig | lint: reduce verboseness of merge_signedness
No functional change.
|
1.206 | 15-Jul-2021 |
rillig | lint: rename merge_type_specifiers to merge_signedness
No functional change.
|
1.205 | 15-Jul-2021 |
rillig | lint: replace switch statement in dcs_merge_declaration_specifiers
Grouping the rules by their abstract type took a lot of visual space. Instead, move each of the rules from C11 6.7.2 into its own if statement, so that the rules almost read like in the standard.
No functional change.
|
1.204 | 15-Jul-2021 |
rillig | lint: extract dcs_merge_declaration_specifiers from end_type
No functional change.
|
1.203 | 15-Jul-2021 |
rillig | lint: clean up mix of 'case' and 'if'
No functional change.
|
1.202 | 15-Jul-2021 |
rillig | lint: remove warning about _Complex long double in traditional C
Complex types have been introduced in C99, so there is no danger of anyone trying to use them in traditional C.
|
1.201 | 15-Jul-2021 |
rillig | lint: fix internal error for sizeof(typeof)
|
1.200 | 15-Jul-2021 |
rin | PR port-sh3/56311
As a workaround for GCC bug, compile initdecl() with -O0 for sh3.
|
1.199 | 13-Jul-2021 |
rillig | lint: fix wording of message for incomplete struct (2021-07-04)
A struct member is not an argument. In err.c 1.124 from 2021-07-04, the wording had been changed, without noticing that the message was used twice: once for an argument, once for a struct member.
|
1.198 | 11-Jul-2021 |
rillig | lint: add quotes around placeholders in message 23 and 232
|
1.197 | 10-Jul-2021 |
rillig | lint: rename clrtyp/deftyp to begin_type/end_type
The abbreviations clr/def did not make it obvious that these two functions or grammar rules form pairs.
No functional change.
|
1.196 | 10-Jul-2021 |
rillig | lint: fix assertion failure in declare_argument
|
1.195 | 05-Jul-2021 |
rillig | lint: reduce noise in storage_class_name
No functional change.
|
1.194 | 05-Jul-2021 |
rillig | lint: rename dinfo_t.d_stralign to d_sou_align_in_bits
When talking about alignment, offset and size of a type, the measurement unit must be mentioned in the variable name, especially when it differs from the standard unit of measurement, which is a byte, not a bit.
No functional change.
|
1.193 | 04-Jul-2021 |
rillig | lint: improve wording for incomplete struct or union
|
1.192 | 28-Jun-2021 |
rillig | lint: turn null pointer dereference into assertion failure
Originally I only needed a message that would output the type name from an abstract-declarator (C99 6.7.6), to see whether lint interprets the types correctly.
Message 155 looked like a good candidate, but it only revealed more incomplete and untested code in lint.
|
1.191 | 28-Jun-2021 |
rillig | lint: align grammar with C99
C99 uses type-qualifier-list_opt in section 6.7.5.
|
1.190 | 28-Jun-2021 |
rillig | lint: rename pqinf_t to qual_ptr and clean up code
The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing.
The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'.
No functional change.
|
1.189 | 27-Jun-2021 |
rillig | lint: fix type of pqinf.p_pcnt
A counter that can either be 0 or 1 and is never incremented is not really a counter, it's a flag.
No functional change.
|
1.188 | 20-Jun-2021 |
rillig | lint: fix assertion failure on malformed struct declaration
Found using afl.
|
1.187 | 20-Jun-2021 |
rillig | lint: fix segmentation fault for malformed struct
Code to trigger this bug: struct{char a(_)0}
Found using afl.
|
1.186 | 19-Jun-2021 |
rillig | lint: fix crash in malformed initialization
|
1.185 | 19-Jun-2021 |
rillig | lint: fix assertion failure after syntax error in declaration
The code to trigger this case is:
(s)(int(int););
This only happens with BSD yacc, but not with Bison since they differ in error handling.
|
1.184 | 19-Jun-2021 |
rillig | lint: in debug mode, print name of the "storage class"
This helps in tracking down the internal errors related to declarations, found by running afl.
|
1.183 | 19-Jun-2021 |
rillig | lint: fix internal error for unfinished declaration
A translation unit that contains just 'void x' without the trailing semicolon had crashed lint1 before:
assertion "dcs->d_ctx == AUTO" failed in declare at decl.c:2049
Found using afl.
|
1.182 | 16-May-2021 |
rillig | lint: add more specific warning for bit-field of type plain 'int'
Previously, declaring a bit-field of type plain 'int' resulted in this warning:
warning: nonportable bit-field type 'int' [34]
This warning was too unspecific to be actionable, and until yesterday it didn't even include the type. In order to allow this warning to be understood and properly fixed, describe the actual nonportability more precisely:
warning: bit-field of type plain 'int' has implementation-defined signedness [344]
|
1.181 | 16-May-2021 |
rillig | lint: add type information to unportable bit-field type
Seeing the message "unportable bit-field type 'int'" may sound strange at first, but that's a strict interpretation of the wording in C99 6.7.2.1p4, which requires that the bit-field type is "'_Bool', 'unsigned int' or 'signed int', or some other implementation-defined type".
The rationale for C99 6.7.2.1 explicitly lists plain 'int' among the allowed types for bit-fields, regardless of any additional implementation-defined types. This means that lint had interpreted this paragraph wrong, and it should be fixed to allow plain int as well.
|
1.180 | 02-May-2021 |
rillig | branches: 1.180.2; lint: allow large integer types for bit-fields in GCC mode
These types are explicitly allowed by GCC.
I'm not sure which of the flags -g and -p should be stronger. That is, if both -g and -p are given, should 'unsigned char' be allowed as a bit-field type since -g would allow it, or should it be warned about since -p warns about it? For now, continue to warn about these.
|
1.179 | 02-May-2021 |
rillig | lint: extract check_bit_field_type from declare_bit_field
No functional change.
|
1.178 | 18-Apr-2021 |
rillig | lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
|
1.177 | 18-Apr-2021 |
rillig | lint: preserve curr_pos when checking whether a symbol is used
At the end of a function definition (funcend), curr_pos was not restored, probably because the very next action is to read the next token, which will then set curr_pos.
Again, this may affect the location reported in assertion failures, everything else is unchanged.
|
1.176 | 18-Apr-2021 |
rillig | lint: do not modify curr_pos in check_global_symbols
No functional change.
|
1.175 | 18-Apr-2021 |
rillig | lint: in check_global_variable_size, restore curr_pos
This affects only calls to lint_assert, all other code stays functionally the same.
|
1.174 | 18-Apr-2021 |
rillig | lint: migrate check_tag_usage to warning_at
This one is already a little trickier since it does not restore the original curr_pos. This function is only called in a few places, and these either restore curr_pos themselves or only call functions afterwards that immediately overwrite curr_pos.
Except for lint_assert, which may now report a different location.
The call to check_global_variable that is related to check_tag_usage was the function that started this whole refactoring since its lint_assert reported a completely wrong location when using a compound literal in an initializer expression at block level 0.
|
1.173 | 18-Apr-2021 |
rillig | lint: migrate print_previous_declaration to message_at
|
1.172 | 10-Apr-2021 |
rillig | lint: prepare renaming of 'struct type'
It's confusing to have the same struct tag in both lint1 and lint2, with mostly the same members, but also some differences. Before actually changing this, I reviewed all occurrences of the word 'type' in the code.
No functional change.
|
1.171 | 09-Apr-2021 |
rillig | lint: quote placeholders in messages for unused variables
|
1.170 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.169 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.168 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.167 | 30-Mar-2021 |
rillig | lint: rewrite handling of initializations, fixing several bugs
The previous implementation had a wrong model of how initialization happens in C99, its assertions failed in all kind of edge cases and it was not possible to fix the remaining bugs one at a time without running into even more obscure assertion failures.
The debug logging was detailed but did not help to clarify the situation. After about 20 failed attempts at fixing the small details I decided to start all over and rewrite the initialization code from scratch. I left the low-level parts of handling designators, the code that is independent of brace_level and the high-level parts of how the parser calls into this module. Everything else is completely new.
The concept of a brace level stays since that is how C99 describes initialization. The previous code could not handle multi-level designations (see d_init_pop_member.c). There are no more assertion failures in the initialization code.
Some TODO comments have been left in the tests to keep the line numbers the same in this commit. These will be cleaned up in a follow-up commit.
The new implementation does not handle initialization with "missing" braces. This is an edge case that both GCC and Clang warn about, so it is not widely used. If necessary, it may be added later.
The new implementation does not use any global variables in the vast majority of the functions, to make all dependencies and possible modifications obvious.
|
1.166 | 27-Mar-2021 |
rillig | lint: move handling of function renaming over to declare_extern
No functional change.
|
1.165 | 27-Mar-2021 |
rillig | lint: rename decl1ext, reduce visibility
No functional change.
|
1.164 | 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.163 | 27-Mar-2021 |
rillig | lint: remove space between 'sizeof ('
No functional change.
|
1.162 | 26-Mar-2021 |
christos | use __func__
|
1.161 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.160 | 26-Mar-2021 |
rillig | lint: rename pushdecl and popdecl to be more expressive
The previous names were highly ambiguous. The 'decl' could have meant 'declaration', which would be the usual abbreviation. It could also be split into 'dec' and 'l', meaning 'declaration level', which would make more sense in this particular context.
To avoid having to guess anything about these names, rename the functions. Instead of 'push' and 'pop', I renamed them to 'begin' and 'end' since these are the high-level operation that are of interest. That the hierarchy of declaration levels is implemented as a stack is nice to know but not as important to understand the whole situation.
No functional change.
|
1.159 | 23-Mar-2021 |
rillig | lint: fix wrong error message about type mismatch in compound literal
Now that the code contains explicit markers for starting and ending an initialization, and having the guarantee that an assertion fails whenever some code accesses the state of the "current initialization" even though there is no ongoing initialization gives me much more confidence in the correctness of the code. The calls to begin_initialization and end_initialization always appear in pairs, enclosing the minimal amount of code necessary for initialization.
In a nutshell, global modifiable state is error-prone and hard to understand.
A nice side effect is that the grammar no longer needs a special rule for the outermost initializer since the functions for the debug logging are now called explicitly.
The code that misuses the initialization state just because it needs to temporarily store a sym_t somewhere is now clearly marked as such. A GCC statement expression can appear anywhere and is therefore independent of the initialization. Most probably the code can simply refer to the local variable in the grammar rule itself, or this variable needs to be encoded in the grammar %union. For sure there is a better way to handle this.
There is no longer a need that the function 'declare' initializes the initialization state, it was just the wrong place to do this.
|
1.158 | 23-Mar-2021 |
rillig | lint: add indirection for accessing the current initialization
This indirection will be needed to handle nested initializations, which are a new feature of C99. These are currently not handled correctly, see msg_171.c.
No functional change.
|
1.157 | 21-Mar-2021 |
rillig | lint: adjust type in documentation of add_array
No functional change.
|
1.156 | 21-Mar-2021 |
rillig | lint: rename d_fargs, d_fdpos and d_fpsyms to be less abbreviated
No functional change.
|
1.155 | 21-Mar-2021 |
rillig | lint: rename d_nedecl to d_nonempty_decl
No functional change.
|
1.154 | 21-Mar-2021 |
rillig | lint: rename d_rdcsym to d_redeclared_symbol
No functional change.
|
1.153 | 21-Mar-2021 |
rillig | lint: inline local variable in declarator_1_struct_union
No functional change.
|
1.152 | 20-Mar-2021 |
rillig | lint: update comment on setasm for C99
No functional change.
|
1.151 | 20-Mar-2021 |
rillig | lint: reduce indentation and braces in merge_type_specifiers
No functional change.
|
1.150 | 20-Mar-2021 |
rillig | lint: extract adjusting of the storage class into separate function
No functional change.
|
1.149 | 19-Mar-2021 |
rillig | lint: rename in_bit to in_bits
No functional change.
|
1.148 | 19-Mar-2021 |
rillig | lint: rename tsize to type_size_in_bits
The shorter name size_in_bits was already taken by the function-like macro with argument type tspec_t.
No functional change.
|
1.147 | 17-Mar-2021 |
rillig | lint: rename dinfo_t members to be more expressive
While here, sync redundant but diverging comments, split multi-assignments and initialize the members in declaration order.
No functional change.
|
1.146 | 17-Mar-2021 |
rillig | lint: move to_int_constant from the grammar to decl.c
This way, the code is covered by running 'make lint'. The code from the grammar is not covered, therefore it still uses int instead of bool in a few places.
Inline the comparison functions for uint64_t. These functions didn't add any clarity to the code.
No functional change.
|
1.145 | 17-Mar-2021 |
rillig | lint: move main part of idecl over to decl.c and rename it
No functional change.
|
1.144 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.143 | 28-Feb-2021 |
rillig | lint: rename members and access macros of the basic types
Having the measurement unit in the variable name prevents accidental confusion between bits and bytes, especially since usually the word 'size' means the size in bytes, while 'width' means the size in bits, at least for integer types.
No functional change.
|
1.142 | 28-Feb-2021 |
rillig | lint: document allowed types for bit-fields
No functional change.
|
1.141 | 28-Feb-2021 |
rillig | lint: extract declare_bit_field from declarator_1_struct_union
No functional change.
|
1.140 | 28-Feb-2021 |
rillig | lint: add type information to 'illegal bit-field type'
|
1.139 | 28-Feb-2021 |
rillig | lint: rename getbound to alignment_in_bits
No functional change.
|
1.138 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.137 | 19-Feb-2021 |
rillig | lint: rename storage class constants to be more expressive
No functional change.
|
1.136 | 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.135 | 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.134 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.133 | 31-Jan-2021 |
rillig | lint: add quotes to messages 1 and 19
|
1.132 | 30-Jan-2021 |
rillig | lint: rename incompl to is_incomplete
No functional change.
|
1.131 | 24-Jan-2021 |
rillig | lint: update data types in comments from int to bool
|
1.130 | 18-Jan-2021 |
rillig | lint: clean up member names of control_structure and comments
|
1.129 | 18-Jan-2021 |
rillig | lint: flatten check_global_variable_size
|
1.128 | 18-Jan-2021 |
rillig | lint: fix assertion failure for restrict and _Thread_local
|
1.127 | 17-Jan-2021 |
rillig | lint: extend a few message comments
|
1.126 | 17-Jan-2021 |
rillig | lint: replace integer constants with bool constants
|
1.125 | 17-Jan-2021 |
rillig | lint: fix type mismatch for strict bool mode
No functional change.
|
1.124 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.123 | 16-Jan-2021 |
rillig | lint: in strict bool mode, integer constants do not have type bool
Previously, lint1 allowed integer constants such as 0 and 1 to be used as bool constants. This was only half-baked since after fixing all error messages from that strict mode, there may still be integer literals in the code that should be replaced with true or false. This would stop a migration from int to bool in the middle, leaving inconsistent code around.
To find the remaining type inconsistencies, treat integers and bool as completely incompatible, even for compile time constants.
|
1.122 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.121 | 11-Jan-2021 |
rillig | lint: sprinkle a few const modifiers throughout the code
|
1.120 | 10-Jan-2021 |
rillig | lint: split check_global_variable into several functions
This reduces the indentation and allows the messages in the comments to contain the complete text instead of only an abbreviated prefix.
No functional change.
|
1.119 | 10-Jan-2021 |
rillig | lint: fix assertion failure for syntax error in enum declaration
|
1.118 | 10-Jan-2021 |
rillig | lint: remove redundant parentheses around return value
|
1.117 | 10-Jan-2021 |
rillig | lint: change return type of eqptrtype to bool
|
1.116 | 10-Jan-2021 |
rillig | lint: rename functions with short names
|
1.115 | 10-Jan-2021 |
rillig | lint: use message 232 for unused label in function
This message had been defined but not used before.
|
1.114 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.113 | 09-Jan-2021 |
rillig | lint: make target platform independent of host platform
If lint is run on a platform that has CHAR_BIT == 10, this doesn't magically make an ILP32 platform have 40 bits per uint32_t.
At the moment, all of the supported platforms are either ILP32 or I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE, so nothing changes practically.
|
1.112 | 09-Jan-2021 |
rillig | lint: rename ename to enumeration_constant
|
1.111 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.110 | 03-Jan-2021 |
rillig | lint: rename prflstrg to printflike_argnum, likewise for scflstrg
|
1.109 | 03-Jan-2021 |
rillig | lint: rename t_ispacked to t_packed and d_ispacked to d_packed
It's shorter, and the other flags of the type or declaration also don't have "is" in their names. Except for t_isenum, but that's because there is a macro named t_enum that would interfere with that name.
|
1.108 | 03-Jan-2021 |
rillig | lint: rename type.t_isfield to t_bitfield
|
1.107 | 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.106 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.105 | 03-Jan-2021 |
rillig | lint: separate error and warning for 27 and 58
Even though this results in more lines of code, the benefit is that the message text in the comment is verified by check-msgs.lua. The code is also easier to read, the parentheses and asterisk were not needed.
|
1.104 | 03-Jan-2021 |
rillig | lint: fix spelling of message 308
All other messages are lowercase as well.
|
1.103 | 02-Jan-2021 |
rillig | lint: convert bitfieldtype_ok from int to bool
No functional change intended, except for the output in debug mode.
|
1.102 | 02-Jan-2021 |
rillig | lint: fix lint warning 161 "constant in conditional context"
|
1.101 | 02-Jan-2021 |
rillig | lint: add a few more tests
No serious bugs found this time.
|
1.100 | 02-Jan-2021 |
rillig | lint: fix message 308 "Invalid type for _Complex"
Previously, lint aborted since it didn't expect tspec_name to be called with NOTSPEC, which at that point was the only possible value of dcs->d_cmod.
|
1.99 | 02-Jan-2021 |
rillig | lint: allow _Bool for bit-fields
|
1.98 | 02-Jan-2021 |
rillig | lint: fix buffer truncation for type names
Previously, most type names had been cut off after 63 significant characters. In some cases, 127 characters survived, or 255. And for the debugging messages, sometimes even 1023. This inconsistency was useless.
It was wrong in the first place to make the caller of the function tyname responsible for handling the buffer. That's not something a caller of such a simple function should do. These callers have better things to do.
The API of the new function type_name is as simple as possible.
In the implementation, the name of the type is generated anew each time. I just didn't know whether the type details could change, once the type is initialized, and I didn't want to find out. To be on the safe side, the resulting type name is cached, independently of the type it was generated for. Using a trivial, unbalanced binary tree should be good enough for now.
All this work is necessary to support adding new debug logging, without being distracted by irrelevant implementation details such as these buffer sizes. Adding new debug messages should be fun and easy; up to now, it was overly bureaucratic.
|
1.97 | 01-Jan-2021 |
rillig | lint: combine duplicate case branches in popdecl
This works around GCC 9, which didn't see that the following statement cannot terminate normally, even though 0 is obviously a constant expression and assert_failed is marked as __attribute__((__noreturn__)).
do { if (!(0)) assert_failed(...); } while (0)
|
1.96 | 01-Jan-2021 |
kre | Build breakage fix (hopefully) - brain dead gcc. NFCI.
|
1.95 | 01-Jan-2021 |
rillig | lint: remove NTSPEC from enum tspec_t
The number of elements in an enumeration is not a valid enum constant of that enumeration itself.
|
1.94 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.93 | 01-Jan-2021 |
rillig | lint: replace simple LERROR with lint_assert
|
1.92 | 01-Jan-2021 |
rillig | lint: replace some more LERROR with lint_assert
|
1.91 | 01-Jan-2021 |
rillig | lint: rename basic_type_name to tspec_name
The term "basic type" is precisely defined in C99 6.2.5p14, and tspec_t is close to that, but nowhere identical.
|
1.90 | 01-Jan-2021 |
rillig | lint: remove redundant printf arguments
|
1.89 | 01-Jan-2021 |
rillig | lint: align comments with actual message, in the lexer and parser
|
1.88 | 01-Jan-2021 |
rillig | lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format strings from the actual arguments prevents the compiler from cross-checking them.
|
1.87 | 30-Dec-2020 |
rillig | lint: split cluparg into separate functions
That function did more than its short name could express, and the things it did were not related in any way.
|
1.86 | 30-Dec-2020 |
rillig | lint: spell check comments
|
1.85 | 30-Dec-2020 |
rillig | lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
|
1.84 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.83 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_field, s_keyw and s_xsym
|
1.82 | 30-Dec-2020 |
rillig | lint: rename remaining _nxt members to _next
|
1.81 | 30-Dec-2020 |
rillig | lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
|
1.80 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.79 | 29-Dec-2020 |
rillig | lint: fix typo in comments
|
1.78 | 29-Dec-2020 |
rillig | lint: split complete_tag into separate functions
|
1.77 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.76 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.75 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.74 | 28-Dec-2020 |
rillig | lint: rename confusing function setcompl
The previous function name suggested that it would set the complete flag of the type, but it was the exact opposite. To reduce confusion, negate the meaning of the parameter.
|
1.73 | 28-Dec-2020 |
rillig | lint: spell check
|
1.72 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.71 | 02-Jun-2020 |
christos | Fix return of alignof()
|
1.70 | 04-Mar-2019 |
christos | Add __thread/tls_model attribute
|
1.69 | 07-Sep-2018 |
christos | recognize int128
|
1.68 | 06-Mar-2017 |
christos | branches: 1.68.10; 1.68.12; Accept PTR for addtype
|
1.67 | 27-Dec-2016 |
christos | branches: 1.67.2; teach lint __attribute__((__unused__))
|
1.66 | 03-Nov-2016 |
kamil | Prefer modern simple past tense and past participle of catch
The "catched" form is obsolete and nonstandard, prefer "caught".
|
1.65 | 23-Aug-2016 |
christos | compute anonymous bitfield sizes properly.
|
1.64 | 19-Aug-2016 |
christos | Don't warn about empty structs twice.
|
1.63 | 18-Aug-2016 |
christos | - handle sizes of structs/unions with anon members - handle structs/unions with only anon members
|
1.62 | 31-Jul-2016 |
dholland | typo in comment
|
1.61 | 02-Jan-2016 |
christos | branches: 1.61.2; print the length on error.
|
1.60 | 13-Oct-2015 |
christos | handle anonymous struct/union members.
|
1.59 | 18-Apr-2014 |
christos | handle LDOUBLE
|
1.58 | 15-Dec-2013 |
christos | branches: 1.58.2; downgrade illegal bitfield from error to warning so we can ignore it.
|
1.57 | 19-Apr-2013 |
christos | make NOSTRICT behave the same a LINTED; use the new format.
|
1.56 | 19-Apr-2013 |
christos | Allow linted comments to take an argument that defines which error to suppress.
|
1.55 | 17-Feb-2013 |
christos | rename enum_t to avoid rpc/types.h lossage.
|
1.54 | 27-Mar-2012 |
christos | branches: 1.54.2; more cross lint friendlyness XXX: needs more constants converted double/float
|
1.53 | 24-Jun-2011 |
christos | branches: 1.53.2; Always use our own align macro and explain a bit more why this is bogus.
|
1.52 | 24-May-2011 |
joerg | Fix format string usage
|
1.51 | 02-Oct-2009 |
christos | handle bit fields in packed structures.
|
1.50 | 02-Oct-2009 |
christos | compute sizes by the new tsize() function.
|
1.49 | 02-Oct-2009 |
christos | fix typedef struct __packed
|
1.48 | 02-Oct-2009 |
christos | recognize struct __packed x { }; in addition to struct x { } __packed;
|
1.47 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.46 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.45 | 02-Mar-2009 |
christos | Don't produce type mismatch warnings if one side of ?: is "[qual] void *" and the other side is "[qual] pointer".
|
1.44 | 16-Nov-2008 |
dholland | branches: 1.44.2; WARNS=4
|
1.43 | 27-Sep-2008 |
dholland | Don't accidentally treat "long double" as "long". PR bin/39639.
|
1.42 | 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.41 | 27-Apr-2008 |
christos | reorder a couple of error messages.
|
1.40 | 26-Apr-2008 |
christos | fix "long double" type recognition which broke with the complex changes.
|
1.39 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.38 | 08-Nov-2006 |
christos | branches: 1.38.16; - add debugging to track nowarns - make /*LINTED*/ take effect on unused functions
|
1.37 | 23-Oct-2006 |
christos | allow 0 sized structs in c9x
|
1.36 | 23-Oct-2006 |
christos | add zero sized array handling. It is a little too chatty now.
|
1.35 | 13-Jul-2006 |
christos | flex arrays are a c9x feature.
|
1.34 | 12-Sep-2004 |
yamt | recognize _Bool.
|
1.33 | 20-Jun-2004 |
jmc | 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
|
1.32 | 02-Nov-2002 |
perry | branches: 1.32.2; Make long long a c99ism, not a gnuism.
|
1.31 | 13-Sep-2002 |
christos | 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.
|
1.30 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.29 | 18-Jan-2002 |
thorpej | Centralize the initialization/declaration of the ttab.
|
1.28 | 03-Jan-2002 |
thorpej | Make sure the tspec_t enum starts at 0, and declare NTSPEC in the enum proper.
|
1.27 | 03-Jan-2002 |
thorpej | Simplify test for integer types in the BITFIELDTYPE handling path.
|
1.26 | 03-Jan-2002 |
thorpej | * 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.
|
1.25 | 21-Nov-2001 |
wiz | "than" instead of "then".
|
1.24 | 16-Sep-2001 |
wiz | Spell 'occurred' with two 'r's.
|
1.23 | 26-Jul-2001 |
wiz | Various typos in comments (neccessary, sceme, choise, ...).
|
1.22 | 28-May-2001 |
lukem | 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.
|
1.21 | 24-May-2001 |
lukem | minor whitespace/knf
|
1.20 | 19-May-2001 |
sommerfeld | Change type of anonymous bitfield pads so that lint -p no longer generates a portability warning.
|
1.19 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.18 | 05-Jul-2000 |
christos | 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...
|
1.17 | 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.16 | 13-Mar-2000 |
soren | branches: 1.16.2; Fix doubled 'the's.
|
1.15 | 27-Jul-1998 |
mycroft | Fix a recurring typo: comparision -> comparison.
|
1.14 | 27-Jul-1998 |
mycroft | Fix uses of uninitialized memory, and incorrect types for initializers. From ITOH Yasufumi, PR 5861.
|
1.13 | 22-Feb-1998 |
christos | WARNSify
|
1.12 | 22-Dec-1996 |
cgd | * recognize that pointers to identical unnamed and untyped structs, unions, and enums are, in fact, identical. This is done by tagging each of unnamed and untyped structure, union and enum with a unique position of creation, which is used as a unique identifier that when determine whether or not a pair of structures, unions, or enums are identical.
|
1.11 | 02-Oct-1995 |
jpo | no need to print a warning about inline keywords "inline" is a valid keyword only with -g, and "__inline" is always a valid keyword
|
1.10 | 02-Oct-1995 |
jpo | don't print warnings about unused variables or arguments in compound statements which contain asm statements.
|
1.9 | 02-Oct-1995 |
jpo | 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.
|
1.8 | 02-Oct-1995 |
jpo | support asm statements and asm modifiers in declarations
asm statements consist of an asm keyword, an optional qualifier, a left paren, a list of tokens up to and including the matching right paren, and a semicolon.
asm modifiers consist of an asm keyword, an left paren, a string and a right paren.
asm statements and modifiers have no semantic for lint(1), they exist only to avoid complaints about them.
|
1.7 | 02-Oct-1995 |
jpo | some minor bug fixes
|
1.6 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.5 | 02-Oct-1995 |
jpo | __{const,signed,volatile}{__,} added const, signed and volatile are disabled with -t
|
1.4 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.3 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.16.2.1 | 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.32.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.33 (requested by jmc in ticket #527): 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
|
1.38.16.1 | 18-May-2008 |
yamt | sync with head.
|
1.44.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.53.2.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.53.2.1 | 17-Apr-2012 |
yamt | sync with head
|
1.54.2.3 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.54.2.2 | 23-Jun-2013 |
tls | resync from head
|
1.54.2.1 | 25-Feb-2013 |
tls | resync with head
|
1.58.2.1 | 10-Aug-2014 |
tls | Rebase.
|
1.61.2.4 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.61.2.3 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.61.2.2 | 04-Nov-2016 |
pgoyette | Sync with HEAD
|
1.61.2.1 | 06-Aug-2016 |
pgoyette | Sync with HEAD
|
1.67.2.1 | 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.68.12.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.68.10.1 | 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.180.2.1 | 31-May-2021 |
cjep | sync with head
|
1.302.2.1 | 19-Jul-2023 |
martin | Pull up following revision(s) (requested by rin in ticket #237):
usr.bin/xlint/lint1/decl.c: revision 1.361 doc/HACKS: revision 1.239
lint1:initdecl(): Remove hack for now-fixed PR port-sh3/56311 doc/HACKS: PR port-sh3/56311 has been fixed.
|
1.403.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.7 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.6 | 20-Aug-2001 |
wiz | precede, not preceed.
|
1.5 | 28-May-2001 |
lukem | 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.
|
1.4 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.3 | 22-Feb-1998 |
christos | WARNSify
|
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.96 | 29-Aug-2024 |
rillig | lint: support GCC's __auto_type
Fixes PR toolchain/58654.
|
1.95 | 12-May-2024 |
rillig | branches: 1.95.2; lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.94 | 27-Mar-2024 |
rillig | lint: clean up; extend overflow test
|
1.93 | 19-Mar-2024 |
rillig | lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.92 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.91 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.90 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.89 | 02-Mar-2024 |
rillig | lint: remove custom wrappers around <ctype.h> functions
|
1.88 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.87 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.86 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.85 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.84 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.83 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.82 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.81 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.80 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.79 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.78 | 02-Dec-2023 |
rillig | lint: remove redundant empty lines
No functional change.
|
1.77 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.76 | 12-Aug-2023 |
rillig | lint: clean up comments
There's no output buffer anymore.
|
1.75 | 12-Aug-2023 |
rillig | lint: remove redundant comments
|
1.74 | 12-Aug-2023 |
rillig | lint: for each record in the output file, write the newline immediately
There's no point delaying the '\n' until the next line is written.
|
1.73 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.72 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.71 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.70 | 29-Jun-2023 |
rillig | lint: clean up initialization of type properties
No functional change.
|
1.69 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.68 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.67 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.66 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.65 | 02-Feb-2023 |
rillig | lint: clean up
In symtab_search, most of the conditions were redundant, so remove them.
In read_byte, using CHAR_MASK was conceptually wrong, as that constant is from the target platform while the lexical analysis happens on the host platform. It was unnecessary as well, as a hypothetical host platform with 36-bit chars might encode the characters from the basic source character set as numbers higher than 0x0_0000_00ff. Since lint assumes that both the source character set as well as the execution character set are the same and based on 8-bit bytes, nothing changes.
No functional change.
|
1.64 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.63 | 21-Jun-2022 |
rillig | lint: use is_struct_or_union instead of comparing twice
No functional change.
|
1.62 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.61 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.60 | 28-Nov-2021 |
rillig | lint: do not export unnamed objects to the .ln file
Since these objects are unnamed, they cannot be referenced by other files or even create name clashes.
Seen in usr.sbin/cpuctl/aarch64.c, reported by Christos.
|
1.59 | 12-Sep-2021 |
rillig | lint: un-abbreviate rvused and rvdisc
No functional change.
|
1.58 | 04-Sep-2021 |
rillig | lint: inline local variables in outtype
No functional change.
|
1.57 | 04-Sep-2021 |
rillig | lint: clean up outfstrg, which writes format strings
Most characters don't need outqchar, a simple outchar is often enough.
Since '\0' is not a digit, there is no need to check for that.
No functional change.
|
1.56 | 04-Sep-2021 |
rillig | lint: move outqchar from common to lint1
|
1.55 | 04-Sep-2021 |
rillig | lint: use 'char' as type for passing characters to functions
No functional change.
|
1.54 | 02-Sep-2021 |
rillig | lint: fix typo in assertion
|
1.53 | 31-Aug-2021 |
rillig | lint: reduce verbose switch statement to table lookup
No functional change.
|
1.52 | 30-Aug-2021 |
rillig | tests/lint: test varargs, printflike, scanflike
|
1.51 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.50 | 23-Aug-2021 |
rillig | lint: remove unnecessary width parameter for msb
No functional change.
|
1.49 | 19-Aug-2021 |
rillig | lint: change return type of 'msb' from int to bool
No functional change.
|
1.48 | 08-Aug-2021 |
rillig | lint: condense code for writing the .ln files
No functional change.
|
1.47 | 31-Jul-2021 |
rillig | lint: improve support for __int128_t and __uint128_t
For the .ln files, I chose the letter 'J' to represent the 128-bit integer types since it is close to 'I' for int. The naming of 'L' for 'long' is obvious, but 'Q' for 64-bit integers is a quad-16-bit word, which is an unusual measurement unit nowadays. One benefit of choosing 'J' is that the next letter, 'K' can then be used for 256-bit integer types.
Support for 128-bit integer types is still very basic. Plus, it is only supported on LP64 platforms, which means that lint cannot be cross-compiled to check for an LP64 platform while running on an ILP32 platform.
|
1.46 | 15-Jul-2021 |
rillig | lint: replace call to ttos with type_name
Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as ttos and more expressive. It can also be called multiple times without invalidating the returned strings.
Used only in debug mode.
|
1.45 | 05-Jul-2021 |
rillig | lint: fix type warnings in emit1.c
The plain character strings in strg_t are saved as an array of unsigned char. When such a character is passed to ch_isdigit, it requires a cast. This is exactly the situation that ch_isdigit tried to avoid in the first place.
No functional change.
|
1.44 | 18-Apr-2021 |
rillig | lint: test emitting of symbol information in the .ln files
Even though the new test is quite large, it didn't find any bugs in the code. The only thing I'm unsure about is why static functions are exported as well, since they are supposed to be local to the translation unit.
|
1.43 | 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.42 | 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.41 | 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.40 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.39 | 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.38 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.37 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.36 | 11-Jan-2021 |
rillig | lint: sprinkle a few const modifiers throughout the code
|
1.35 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.34 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.33 | 03-Jan-2021 |
rillig | lint: rename prflstrg to printflike_argnum, likewise for scflstrg
|
1.32 | 02-Jan-2021 |
rillig | lint: fix lint warning 161 "constant in conditional context"
|
1.31 | 01-Jan-2021 |
rillig | lint: replace simple LERROR with lint_assert
|
1.30 | 01-Jan-2021 |
rillig | lint: replace some more LERROR with lint_assert
|
1.29 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.28 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.27 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.26 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.25 | 29-Dec-2020 |
rillig | lint: fix typo in comments
|
1.24 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.23 | 28-Dec-2020 |
rillig | lint: spell check
|
1.22 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.21 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.20 | 26-Dec-2017 |
christos | Don't print duplicate definitions for inline symbols.
|
1.19 | 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.18 | 26-Apr-2008 |
christos | Fix complex double to be '\0' instead of 'u', from Nicolas Joly.
|
1.17 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.16 | 24-Sep-2005 |
perry | branches: 1.16.20; in several comments: implizit -> implicit explizit -> explicit
|
1.15 | 12-Sep-2004 |
yamt | recognize _Bool.
|
1.14 | 20-Jun-2004 |
jmc | 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
|
1.13 | 13-Sep-2002 |
christos | branches: 1.13.2; 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.
|
1.12 | 05-Feb-2002 |
thorpej | 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.
|
1.11 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.10 | 28-May-2001 |
lukem | 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.
|
1.9 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.8 | 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.7 | 22-Feb-1998 |
christos | branches: 1.7.8; WARNSify
|
1.6 | 03-Nov-1997 |
cgd | 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.
|
1.5 | 22-Dec-1996 |
cgd | branches: 1.5.2; * recognize that pointers to identical unnamed and untyped structs, unions, and enums are, in fact, identical. This is done by tagging each of unnamed and untyped structure, union and enum with a unique position of creation, which is used as a unique identifier that when determine whether or not a pair of structures, unions, or enums are identical.
|
1.4 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.3 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
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.5.2.1 | 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.7.8.1 | 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.13.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.14 (requested by jmc in ticket #527): 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
|
1.16.20.1 | 18-May-2008 |
yamt | sync with head.
|
1.95.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.277 | 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.276 | 06-Sep-2025 |
rillig | lint: reword message for bit-shift in trad-C90 migration mode
Mentioning the type names gives a hint about why the behavior differs; the message only occurs when the type of the shift amount has higher rank than the type of the shifted value.
|
1.275 | 31-Aug-2025 |
rillig | lint: check for mismatches in snprintb conversions
Seen in sh3/dmacreg.h, SH3_DMAC_CHCR_BITS.
|
1.274 | 08-Jul-2025 |
rillig | lint: reword message about 'extra bits set to 0'
The word 'extra' in the previous wording was too unspecific to make sense of. In the reworded message, focus on the problem instead of mentioning only the effect.
|
1.273 | 07-Jul-2025 |
rillig | lint: remove message 207, making its message ID invalid
|
1.272 | 04-May-2025 |
rillig | lint: add more details to message about discarding qualifiers
The name of the function (or, if not available, its type) is useful in lines that contain more than one function call.
|
1.271 | 12-Apr-2025 |
rillig | lint: warn about constant assignment in operand to '&&' or '||'
Seen in bin/sh/redir.c:1084 for errno, which is fine.
Seen in usr.sbin/mopd/mopprobe/mopprobe.c:235, which looks suspicious but hasn't been touched since 1997.
|
1.270 | 12-Apr-2025 |
rillig | lint: reword messages that apply to traditional C
|
1.269 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.268 | 10-Apr-2025 |
rillig | lint: remove warning for constant operand to '!'
|
1.267 | 07-Apr-2025 |
rillig | lint: remove warning about 'constant in conditional context'
This makes the '-X 161' option to lint invalid.
|
1.266 | 27-Feb-2025 |
rillig | lint: add details to message about conversion in 'case'
|
1.265 | 24-Feb-2025 |
rillig | lint: remove no-op variant of the unary '&' operator
Neither K&R 1978 nor any of the C standards mentions that &function or &array would be a no-op. This no-op behavior produced wrong warnings in sbin/gpt.
|
1.264 | 20-Feb-2025 |
rillig | lint: add detail to message about truncated constant
|
1.263 | 20-Feb-2025 |
rillig | lint: mention the assignment operator in 'illegal combination'
In source lines that contain both a 'return' statement as well as a function-like macro, such as the C11 atomics, seeing the word 'init' in the diagnostic helps to see that the type conflict is not in the 'return' statement but instead in some initializer.
Seen in userspace-rcu/wfcqueue.h:147.
|
1.262 | 03-Jan-2025 |
rillig | lint: add detail to message about obsolete identifier list
|
1.261 | 15-Dec-2024 |
rillig | lint: add details to message about possible precedence confusion
|
1.260 | 08-Dec-2024 |
rillig | lint: warn about do-while macros that end with a semicolon
|
1.259 | 01-Dec-2024 |
rillig | lint: warn about function definitions that still use identifier lists
|
1.258 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.257 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.256 | 28-Nov-2024 |
rillig | lint: add queries for typedefs to struct/union and their pointers
As suggested in share/misc/style since 1.75 from August 2023.
These are queries instead of warnings as the number of false positives or historical practice is too high; these queries are only intended for detecting these typedefs on newly added types.
|
1.255 | 23-Nov-2024 |
rillig | lint: use separate message when discarding a qualifier in call
|
1.254 | 23-Nov-2024 |
rillig | lint: add details to messages about discarding qualifiers
The related message 153 is left as-is, as it is used in two places, and the second place is not only about discarded qualifiers.
|
1.253 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.252 | 31-Oct-2024 |
rillig | lint: allow enum constant named 'N_*' to exceed the array index
Seen in libxcb.
While here, add the name of the enum constant to the message, to quickly decide whether the identifier is outside the range of expected enum values, thus marking the number of enum constants.
|
1.251 | 29-Oct-2024 |
rillig | lint: add details to message about too large integer constant
|
1.250 | 14-Oct-2024 |
rillig | lint: add more details to messages about hidden symbols
|
1.249 | 29-Sep-2024 |
rillig | lint: only skip assertion failure in fuzzing mode
Skipping the assertion message after seeing a syntax error in the parser was surprising, as there was no information about the assertion that failed.
|
1.248 | 28-Sep-2024 |
rillig | lint: reword warning about cast between unrelated pointer types
The phrase "may be troublesome" was too unspecific to be useful.
|
1.247 | 10-Jul-2024 |
rillig | lint: add warning for '!(var = constant)'
This catches expressions like 'ATF_CHECK(errno = ENOENT)', which was intended to use '==' instead of '='.
|
1.246 | 09-Jun-2024 |
rillig | branches: 1.246.2; lint: warn about lossy floating point constant to integer conversions
|
1.245 | 08-Jun-2024 |
rillig | lint: add details to warnings about negative constant to unsigned
|
1.244 | 12-May-2024 |
rillig | lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.243 | 11-May-2024 |
rillig | lint: warn when comparing an integer to a floating point constant
|
1.242 | 09-May-2024 |
rillig | lint: add details to message about too many initializers
|
1.241 | 27-Apr-2024 |
rillig | lint: add query for conversion from void pointer to other pointer
|
1.240 | 12-Apr-2024 |
rillig | lint: in snprintb, warn about all escaped characters in descriptions
|
1.239 | 30-Mar-2024 |
rillig | lint: add query for implicit integer-to-floating conversion
|
1.238 | 30-Mar-2024 |
rillig | lint: do not convert array subscripts from size_t to ptrdiff_t
The C standards do not specify a fixed type for an array subscript, it just has to be an integer type. Previously, query 4 fired for the ubiquitous expression 'ptr[sz]' when sz had type 'size_t'.
The test platform_ilp32_long is unaffected by this change, as the integer constant 0x80000000 has type 'unsigned int', while size_t is 'unsigned long' on those platforms, and even though the types 'unsigned int' and 'unsigned long' have the same value space, there's still a conversion, at least for now.
|
1.237 | 30-Mar-2024 |
rillig | lint: reword messages about array subscripts to sound more natural
|
1.236 | 29-Mar-2024 |
rillig | lint: fix wording of warning about bit-field initializer
|
1.235 | 28-Mar-2024 |
rillig | lint: clean up
|
1.234 | 27-Mar-2024 |
rillig | lint: don't use 'long' in diagnostics
The size of 'long' differs between 64-bit and 32-bit platforms. Eliminate this possible platform-dependency.
|
1.233 | 25-Mar-2024 |
rillig | lint: rename snprintb 'directives' to 'conversions'
This aligns the terminology with the snprintf function.
|
1.232 | 10-Mar-2024 |
rillig | lint: add details to the message about integer overflow
Having only the operator was too unspecific to be actionable, so add the actual numbers and the data type.
|
1.231 | 03-Mar-2024 |
rillig | lint: warn about escaped snprintb directive
Repurpose message 362, as the previous version was redundant since null bytes in old-style formats are already covered by message 371 (bit position out of range) and 377 (redundant '\0' at the end).
|
1.230 | 03-Mar-2024 |
rillig | lint: fix warning about "empty" single-letter snprintb descriptions
|
1.229 | 03-Mar-2024 |
rillig | lint: check for unreachable bits and fields in snprintb formats
While here, clean up a few existing checks.
|
1.228 | 02-Mar-2024 |
rillig | lint: check snprintb formats for overlapping bits and fields
|
1.227 | 02-Mar-2024 |
rillig | lint: remove custom wrappers around <ctype.h> functions
|
1.226 | 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.225 | 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.224 | 03-Feb-2024 |
rillig | lint: warn about short octal escape followed by '8' or '9'
These mistakes is typically found in snprintb format directives but is probably a typo everywhere else as well.
|
1.223 | 20-Jan-2024 |
rillig | lint: add query for const automatic variables
|
1.222 | 07-Jan-2024 |
rillig | lint: allow querying for invisible characters in literals and constants
|
1.221 | 10-Dec-2023 |
rillig | lint: allow querying for 'static' followed by non-'static' declaration
|
1.220 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.219 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.218 | 14-Sep-2023 |
rillig | lint: fix wording of diagnostics about 'C99 extension'
The term 'extension' means an extension to a C standard. C99 by itself is not an extension but a revision of the C standard.
|
1.217 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.216 | 03-Aug-2023 |
rillig | lint: make '_Static_assert' only available in C11 or C23 mode
|
1.215 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.214 | 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.213 | 21-Jul-2023 |
rillig | lint: reword message about non-constant initializer
|
1.212 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.211 | 11-Jul-2023 |
rillig | lint: update wording in diagnostic for C99
|
1.210 | 10-Jul-2023 |
rillig | lint: when debugging the parser, write messages on stderr
This way, all messages (regular debug, yacc debug, lint diagnostics) occur in the correct order.
|
1.209 | 09-Jul-2023 |
rillig | lint: in the warning about ordered enums, mention the affected type
|
1.208 | 09-Jul-2023 |
rillig | lint: clean up wording in diagnostics
Use the term 'parameter' as defined in C99 3.15.
|
1.207 | 09-Jul-2023 |
rillig | lint: clean up the wording of a few diagnostics
|
1.206 | 09-Jul-2023 |
rillig | lint: remove redundant '#' after 'argument' in diagnostics
|
1.205 | 07-Jul-2023 |
rillig | lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only combining them if actually desired.
|
1.204 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.203 | 30-Jun-2023 |
rillig | lint: add query for assigning an integer 0 to a pointer
|
1.202 | 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.201 | 24-Jun-2023 |
rillig | lint: add query for redundant 'extern' in function declaration
|
1.200 | 22-Jun-2023 |
rillig | lint: add query for comma operator
|
1.199 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.198 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.197 | 03-Jun-2023 |
rillig | lint: add query for static variables in functions
This query allows finding hidden global variables, as an easier-to-read alternative to 'objdump -t'.
|
1.196 | 13-May-2023 |
rillig | lint: add query for chained assignments
|
1.195 | 25-Apr-2023 |
rillig | lint: reword message for missing declaration in header
Suggested by Christos.
|
1.194 | 23-Apr-2023 |
rillig | lint: be strict when parsing command line for excluded message IDs
Previously, lint accepted -X '1, 2, 3', while the manual page lists the IDs without spaces.
On 32-bit platforms, lint accepted -X -4294967295, and on 64-bit platforms, it accepted the corresponding larger numbers.
The code for parsing message IDs and query IDs conceptually does the same, but the implementations differed for no reason.
|
1.193 | 15-Apr-2023 |
rillig | lint: add query for parenthesized return value
|
1.192 | 31-Mar-2023 |
rillig | lint: allow querying for octal integer constants
|
1.191 | 28-Mar-2023 |
rillig | lint: warn about 'extern' declarations inside function bodies
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
The previous attempt (message 351 about 'extern' declarations outside headers) did not cover the proposal from the tech-userlevel mailing list but instead warns about a different usage pattern of the 'extern' keyword.
|
1.190 | 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.189 | 22-Feb-2023 |
rillig | lint: fix confusing message about nonportable character constants
|
1.188 | 19-Feb-2023 |
rillig | lint: make basename simpler
There is no need to handle trailing slashes since lint only handles regular files in diagnostics, not directories. Furthermore, only the last '/' was ignored, but multiple trailing slashes would not.
|
1.187 | 18-Feb-2023 |
rillig | lint: remove unused internal_error
|
1.186 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.185 | 08-Jan-2023 |
rillig | lint: improve error message for parsing query IDs
|
1.184 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.183 | 19-Aug-2022 |
rillig | lint: add more details to message about large bit-shifts
|
1.182 | 16-Jul-2022 |
rillig | lint: add more details to message about pointer alignment
The previous message 'may cause alignment problem' was not detailed enough to be actionable, it didn't give the necessary insight to why lint was complaining at all.
The new message 'increases alignment from 1 to 4' or 'from 2 to 8' describes the potentially problematic conversion, and together with the involved type names, it allows an informed decision about whether lint's warning is warranted or not.
In a typical NetBSD build, this warning is in the top 10. The number of these warnings depends on the architecture, it is typically between 800 and 1600.
|
1.181 | 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.180 | 02-Jul-2022 |
rillig | lint: allow message IDs to be only specified in decimal
The message IDs are communicated in decimal everywhere, there's no point in passing '-X 0x00000084' instead of the clearer '-X 132'.
|
1.179 | 01-Jul-2022 |
rillig | lint: clean up suppression of warnings and errors
Since lint1.h 1.11 from 2001-12-13, lint1 had been a memory hog. While it used a bit set for keeping track of the message IDs of the suppressed messages, it only used the lower 4 bits of each 32-bit word, due to a missing CHAR_BIT in __NERRBITS.
As a quick hack, the bit set had 1024 entries, much more than the number of actual messages, which is currently at 350. This meant 674 bytes of wasted memory, plus the code size for the bit manipulations.
The only functional change is that the option '-X' now only accepts actually valid message IDs. Previously it had accepted all numbers from 0 to 1023.
|
1.178 | 01-Jul-2022 |
rillig | lint: move error handling code from main1.c to err.c
No functional change.
|
1.177 | 01-Jul-2022 |
rillig | lint: add quotes around operator in message 138, remove message 240
Message 138 doesn't occur in practice, it was the last one that was missing the quotes around the placeholder.
Message 240 was also missing the quotes, but it was not reachable. There was also no apparent benefit in warning about 'assignment of different structures' when the message about 'assignment type mismatch' serves the same purpose.
|
1.176 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.175 | 21-Jun-2022 |
rillig | lint: add quotes and details to some more messages
|
1.174 | 20-Jun-2022 |
rillig | lint: remove redundant include
err.c doesn't use anything from <sys/types.h>, plus it is already included by "lint.h".
No binary change.
|
1.173 | 20-Jun-2022 |
rillig | lint: add quotes around several placeholders in messages
|
1.172 | 19-Jun-2022 |
rillig | lint: add quotes around placeholders in 4 messages
|
1.171 | 19-Jun-2022 |
rillig | tests/lint: add quotes around placeholders in a few messages
|
1.170 | 15-Jun-2022 |
rillig | lint: unexport lint's messages
There was only a single place where a message was used directly, instead of calling one of the several functions for this purpose.
|
1.169 | 11-Jun-2022 |
rillig | lint: add quotes around placeholders for a few more messages
|
1.168 | 11-Jun-2022 |
rillig | lint: add quotes around a few more placeholders in messages
|
1.167 | 31-May-2022 |
rillig | lint: prevent assertion failure after parse error from grammar
Instead of running into an assertion failure, the malformed input 'f=({;};}' now generates:
malformed.c(1): error: syntax error ';' [249] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): error: cannot recover from previous errors [224]
|
1.166 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.165 | 12-May-2022 |
christos | gcc allows __alignof__(unary-expression)
|
1.164 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.163 | 30-Apr-2022 |
rillig | lint: inline macro c11flag
No functional change.
|
1.162 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.161 | 16-Apr-2022 |
rillig | lint: for gnuism and c99ism, calculate severity
Calculating the severity as a simple sum removes the condition sequence 'a && !b, or else a || !b', which can quickly become a brain twister, especially when negations are involved.
No functional change.
|
1.160 | 16-Apr-2022 |
rillig | lint: model C language levels in a future-compatible way
The options -t, -s and -S are confusing because they are used inconsistently. The option -S enables C99 features, but when using it instead of -s, it also doesn't enable all checks required by C90 and later. Prepare fixing of these inconsistencies by replacing the flag variables with language levels that can be extended in a straight-forward way as new C standards arrive.
| option | allow_trad | allow_c90 | allow_c99 | allow_c11 | |--------|------------|-----------|-----------|-----------| | -t | x | - | - | - | | (none) | x | x | - | - | | -s | - | x | - | - | | -S | - | x | x | - | | -Ac11 | - | x | x | x |
Each usage of the old flag variables will be inspected and migrated individually, to clean up the subtle variations in the conditions and to provide a simpler model.
When lint was created in 1995, its focus was migrating traditional C code to C90 code. Lint does not help in migrating from C90 to C99 or from C99 to C11 since there are only few silent changes, and simply because nobody took the time to implement these migration aids. If necessary, such migration modes could be added separately.
There is a small functional change: when the option -s is combined with either -S or -Ac11, lint now only keeps the last of these options. Previously, these options could be combined, leading to a mixture of language levels, halfway between C90, C99 and C11. Especially combining traditional C with C11 doesn't make sense, but xlint currently allows it.
The 3 tests that accidentally specified multiple language levels have been adjusted to a single language level.
|
1.159 | 08-Apr-2022 |
rillig | lint: remove unused message 70, add some more tests
|
1.158 | 05-Apr-2022 |
rillig | lint: remove unused message 40
I had not been used since 1995, when lint was imported to NetBSD.
|
1.157 | 02-Apr-2022 |
rillig | lint: remove unreachable message 'compiler takes alignment of function'
|
1.156 | 02-Apr-2022 |
rillig | lint: try harder to recover after syntax errors
lint: assertion "false" failed in declarator_name at decl.c:1596 near msg_022.c:22
|
1.155 | 01-Apr-2022 |
rillig | lint: add type details to message about 'sizeof(function)'
The code in add_function is severely broken, it mixes up the return type of the function with the argument types. For now, at least show the guessed type in the diagnostic, to allow human readers quickly spot the bug.
Extend the test cases in decl_direct_abstract.c to show that the behavior differs unreasonably if the first parameter of the function is equal to its return type.
|
1.154 | 01-Apr-2022 |
rillig | lint: add details to message about illegal return type
|
1.153 | 27-Feb-2022 |
rillig | lint: C99 has been released, so refer to it by its proper name
|
1.152 | 07-Feb-2022 |
rillig | lint: reword message about bit-field in a union
There is nothing illegal about a bit-field in a union, it is allowed by C90, C99 and C11.
Fixes PR toolchain/53219.
|
1.151 | 22-Dec-2021 |
rillig | lint: use C90 instead of C89 when referring to the C standard
|
1.150 | 22-Dec-2021 |
rillig | lint: fix handling of initializations
The implementation from March 2021 added proper support for designators but didn't model the brace levels correctly. In particular, it could not handle additional braces or omitted braces. In such a case, lint skipped the remaining initializers from the initialization. Due to this, type errors in the remaining initializers went unnoticed. Another effect was that arrays of unknown size were wrongly reported as having size 0.
Both GCC and Clang recommend placing braces around each sub-type that is initialized, such as a struct, union or array. Postfix does not follow these recommendations, therefore lint had to be disabled in external/ibm-public/postfix/Makefile.inc. This commit fixes the bugs mentioned there.
|
1.149 | 21-Dec-2021 |
rillig | lint: reword message 187 about too long string literal for initializer
The previous message was imprecise in that it didn't distinguish between non-terminating and terminating null bytes.
|
1.148 | 04-Dec-2021 |
rillig | lint: add quotes around placeholders in message 123
|
1.147 | 30-Oct-2021 |
rillig | lint: warn if an enum name is used for mismatched array access
This helps to keep the enum definition and the straight-forward implementation of a to_string or name function in sync.
The test for message 241 had to be adjusted because of exactly this bug. That test defined a bit mask enum but accessed it like a value enum type.
|
1.146 | 09-Oct-2021 |
rillig | lint: add more details to warning about nonportable character comparison
Especially when macros are involved, this makes it easier to see that there is a real problem.
Seen in bin/sh/expand.c:273, where a plain char is compared to numbers larger than 127.
|
1.145 | 12-Sep-2021 |
rillig | lint: add more details to error about redeclaration
Message 27 is triggered by several conditions. The one triggered by register_vget in sbin/fsck_lfs/vnode.c needs more details than the others.
|
1.144 | 05-Sep-2021 |
rillig | lint: fix some more lint warnings
The only remaining warnings are in scan.c, which is a generated Flex scanner.
No functional change.
|
1.143 | 05-Sep-2021 |
rillig | lint.7: document removed messages
Having just an empty string as the message was confusing.
|
1.142 | 31-Aug-2021 |
rillig | lint: remove unused function for generic messages
The function message_at is still used, for information about previous occurrences of a symbol.
|
1.141 | 27-Aug-2021 |
rillig | lint: remove unused message about nonportable character escape
It has not been used since at least 2001.
|
1.140 | 27-Aug-2021 |
rillig | lint: remove unused message for struct without named members
Lint has not produced this message since the rewrite of the initializations in March 2021. Structures that consist of only unnamed bit-fields probably don't occur in practice.
|
1.139 | 23-Aug-2021 |
rillig | lint: add quotes around placeholder in message 141
|
1.138 | 22-Aug-2021 |
rillig | lint: use standard quotes in messages 203 and 271
|
1.137 | 16-Aug-2021 |
rillig | lint: add more details to message about redeclared tag
|
1.136 | 14-Aug-2021 |
rillig | lint: use standard quoting style for messages 124 and 184
|
1.135 | 09-Aug-2021 |
rillig | lint: warn about 'char * = strchr(const char *, int)'
Found in findcc.c, there are about 25 other instances of this incongruency in the whole source tree.
For more examples of functions from the C Standard Library that implicitly remove the 'const' qualifier from an argument, see the C++ include file 'cstring'.
|
1.134 | 03-Aug-2021 |
rillig | lint: union casts are only available as a GCC extension, not in C99
|
1.133 | 03-Aug-2021 |
rillig | lint: add quotes around placeholder in message 214
function '%s' expects to return value
|
1.132 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.131 | 25-Jul-2021 |
rillig | lint: add type information to message about invalid cast
This probably doesn't matter in practice since the compiler is supposed to catch this kind of error. Adding the type information mainly ensures that parsing abstract type names works as specified.
|
1.130 | 15-Jul-2021 |
rillig | lint: remove message 66 about missing semicolon in struct-declaration
|
1.129 | 13-Jul-2021 |
rillig | lint: fix wording of message for incomplete struct (2021-07-04)
A struct member is not an argument. In err.c 1.124 from 2021-07-04, the wording had been changed, without noticing that the message was used twice: once for an argument, once for a struct member.
|
1.128 | 11-Jul-2021 |
rillig | lint: add quotes around placeholders in message 23 and 232
|
1.127 | 10-Jul-2021 |
rillig | lint: flush stdout before an internal error
Previously, the internal error may have appeared too early in the output. Provoking internal errors and assertion failures is still easy, just run afl-fuzz for a few seconds.
|
1.126 | 05-Jul-2021 |
rillig | lint: rename message 340 to talk about "GCC extension", not "GNU"
|
1.125 | 04-Jul-2021 |
rillig | lint: align messages for invalid left operand of '.' or '->'
|
1.124 | 04-Jul-2021 |
rillig | lint: improve wording for incomplete struct or union
|
1.123 | 03-Jul-2021 |
rillig | lint: fix segmentation fault on malformed preprocessor output
# 0 "" # 0 ""2
Found using afl, does not happen in practice though since every C preprocessor generates balanced 'enter' (1) and 'leave' (2) events.
|
1.122 | 30-Jun-2021 |
rillig | lint: mention the name of an implicitly declared function
In the regular NetBSD builds, this happened in swab.c:65. That line contains __predict_false, which may or may not be a macro. In other cases, there may be more than one function call in a single line.
|
1.121 | 28-Jun-2021 |
rillig | lint: add type information to message 155 (type mismatch)
|
1.120 | 27-Jun-2021 |
rillig | lint: require C11 for _Generic
This does not have any effect in practice since the option -g (originally meant for GCC extensions to the C standards) implicitly allows all features from C11, since err.c 1.111 from 2021-04-14.
Since the default lint flags for NetBSD builds include the option -g, this allows all C11 features.
Currently it is not possible to say "allow GNU extensions but not C11".
|
1.119 | 16-May-2021 |
rillig | lint: add more specific warning for bit-field of type plain 'int'
Previously, declaring a bit-field of type plain 'int' resulted in this warning:
warning: nonportable bit-field type 'int' [34]
This warning was too unspecific to be actionable, and until yesterday it didn't even include the type. In order to allow this warning to be understood and properly fixed, describe the actual nonportability more precisely:
warning: bit-field of type plain 'int' has implementation-defined signedness [344]
|
1.118 | 16-May-2021 |
rillig | lint: add type information to unportable bit-field type
Seeing the message "unportable bit-field type 'int'" may sound strange at first, but that's a strict interpretation of the wording in C99 6.7.2.1p4, which requires that the bit-field type is "'_Bool', 'unsigned int' or 'signed int', or some other implementation-defined type".
The rationale for C99 6.7.2.1 explicitly lists plain 'int' among the allowed types for bit-fields, regardless of any additional implementation-defined types. This means that lint had interpreted this paragraph wrong, and it should be fixed to allow plain int as well.
|
1.117 | 16-May-2021 |
rillig | lint: add quotes to message 309 about constant conversion
|
1.116 | 18-Apr-2021 |
rillig | branches: 1.116.2; lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
|
1.115 | 18-Apr-2021 |
rillig | lint: rename parameter to diagnostic functions and macros
The first parameter is not just an arbitrary number, it's a message ID.
|
1.114 | 18-Apr-2021 |
rillig | lint: flip parameters in verror_at, vwarning_at, vmessage_at
The parameters are in the same order now as in the corresponding macros.
|
1.113 | 18-Apr-2021 |
rillig | lint: add error_at, warning_at, message_at
Right now there are several places in the code that use the global variable curr_pos for passing a parameter to the diagnostic functions. That's not what global variables are for.
Make it easy for the code to migrate to the parameter-passing style.
No functional change.
|
1.112 | 18-Apr-2021 |
rillig | lint: do not allow the diagnostics to be modified
|
1.111 | 14-Apr-2021 |
christos | gnu enables c11 extensions
|
1.110 | 14-Apr-2021 |
rillig | lint: add option to accept C11 features
The list of available letters for the command line options gets shorter and shorter. Most of the interesting letters are already used for some warning categories. Curiously, -A, -W and -E were all still available.
The option -A nicely matches the intention of the option, which is to allow a certain set of language features. To keep the option available for further extensions, define -Ac11 as the currently only valid option of that kind. This allows straight-forward extension for C17 and future language standards, as well as independent feature-sets. The options -W and -E may someday complement the -A option, using the allow/warn/error categories.
|
1.109 | 14-Apr-2021 |
rillig | lint: remove redundant condition in update_location
|
1.108 | 14-Apr-2021 |
rillig | lint: add support for C11-isms such as int[static 3]
|
1.107 | 14-Apr-2021 |
christos | support parsing c99's static class for array size expressions.
|
1.106 | 09-Apr-2021 |
rillig | lint: quote placeholders in messages for unused variables
|
1.105 | 09-Apr-2021 |
rillig | lint: clean up handling of preprocessing output lines
No functional change.
|
1.104 | 08-Apr-2021 |
rillig | lint: in code from included files, print stack trace
Previously, the standard NetBSD build generated several lint warnings in lhash.h from OpenSSL, without providing any hint as to which file actually included that header. In cases like these, lint now interprets the line number information in the preprocessor output from GCC to reconstruct the exact include path to the file in question.
The program check-expect.lua had to be rewritten almost completely since it assumed that all diagnostics would come from the main file. In all existing tests, this was true, but these tests did not cover all cases that occurred in practice. Now it records the complete location of the diagnostic instead of just the line number.
|
1.103 | 06-Apr-2021 |
rillig | lint: add details to warning about too large shift amount
The previous message 'shift greater than size of object' was too short to give reasonable hints, especially when the expressions involve typedefs or macros.
|
1.102 | 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.101 | 02-Apr-2021 |
rillig | lint: reword message about constant argument to '!'
In the other messages, operators are typically written in their literal form as well. Using single quotes disambiguates them from normal punctuation.
|
1.100 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.99 | 30-Mar-2021 |
rillig | lint: add type information for message about unknown member name
|
1.98 | 30-Mar-2021 |
rillig | lint: add type information to message 175
|
1.97 | 28-Mar-2021 |
rillig | lint: remove wrong warning about wrong initializer type
The following code is valid:
int valid = {{{ 3 }}};
C90 3.5.7 and C99 6.7.8 both say that the "initializer for a scalar shall be a single expression, optionally enclosed in braces". They don't put any upper bound on the amount of braces, not even in the "Translation limits" section.
|
1.96 | 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.95 | 26-Mar-2021 |
rillig | lint: add quotes around placeholder in message about undefined variable
Before: error: expected undefined [99] After: error: 'expected' undefined [99]
Seen in external/mpl/bind, which for Clang defines in stdatomic.h: > #define atomic_exchange_explicit(obj, desired, order) \ > __c11_atomic_exchange_explicit(obj, expected, order) Note the mismatch between 'desired' and 'expected'.
|
1.94 | 26-Mar-2021 |
rillig | lint: improve output format for internal errors
The new format follows the common conventions for file locations and allows quick navigation in IDEs.
To trigger an internal error, it suffices to have 2 tokens in lint1's input, after preprocessing: 'void __pure'.
|
1.93 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.92 | 22-Mar-2021 |
rillig | lint: use precise type information in message about type mismatch
While here, reword the message, avoiding operators and parentheses.
Since 2021-01-02, providing the precise type name is as easy as the broad type classification (just replace tspec_name with type_name), and it's definitely more useful to the human readers.
|
1.91 | 21-Mar-2021 |
rillig | lint: prefix error messages with 'error:'
This makes it easier to find these errors in the build logs.
|
1.90 | 21-Mar-2021 |
rillig | lint: remove redundant prototypes
No functional change.
|
1.89 | 20-Mar-2021 |
rillig | lint: properly name C99 in message about declaration after statement
Now that C99 has been released and published, there is no reason anymore to refer to it as C9X.
|
1.88 | 18-Mar-2021 |
rillig | lint: reword message about type mismatch in initialization
Using parentheses for quotes is unusual, furthermore the previous message didn't follow proper grammar rules, sacrificing clarity for brevity.
|
1.87 | 07-Mar-2021 |
rillig | lint: in strict C mode, warn about initialization with '[a ... b]'
https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
|
1.86 | 28-Feb-2021 |
rillig | lint: add type information to 'illegal bit-field type'
|
1.85 | 28-Feb-2021 |
rillig | lint: add type information for 'incompatible struct pointers'
|
1.84 | 28-Feb-2021 |
rillig | lint: add type information to enum type mismatch
|
1.83 | 28-Feb-2021 |
rillig | lint: make messages for incompatible pointers more specific
Message 153 didn't state obviously which of the pointer types was the one before conversion (or cast) and which was the resulting type.
Message 229 didn't have any type information at all.
|
1.82 | 28-Feb-2021 |
rillig | lint: add type information to 'possible pointer alignment problem [135]'
This warning occurs more than 7400 times in a regular NetBSD build, and without giving any type information, leaves the reader clueless about what the underlying issue might be. Add type information since that is a no-brainer to implement.
|
1.81 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.80 | 21-Feb-2021 |
rillig | lint: add type information to message about enum mismatch
|
1.79 | 19-Feb-2021 |
rillig | lint: warn about mismatch in getopt handling
|
1.78 | 04-Feb-2021 |
rillig | lint: add back "due to prototype" to message 259
That message is only supposed to warn about compatibility to traditional C, in case the function should ever be compiled without its prototype being in effect. All other type checks are supposed to be in another function, as documented, but that type check misses to report a few error-prone type combinations (long to char, long to int).
30 years after the introduction of prototypes with C90, almost all existing code uses prototypes. The warning has thus lost most of its usefulness and can rather be confusing since a conversion from 'char' to 'long' is not problematic with prototypes in action, and the probability of the code being backported to a pre-C90 compiler is diminishingly small.
The words "due to prototype" now serve as a hint again. The proper fix could be to suppress this warning in C99 mode since that's far enough from traditional C.
|
1.77 | 31-Jan-2021 |
rillig | lint: reword message 259 about function argument conversion
The words "due to prototype" are an anachronism from the 1990s. Nowadays every function is defined using a prototype, which makes these words redundant.
|
1.76 | 31-Jan-2021 |
rillig | lint: make warning about function argument conversion more detailed
For every conversion it is useful to know both the source and the target type since these are not always obvious from the code.
The only surprise is the warning in d_gcc_extension. The conversion there is from 'double' to 'long double', which is a lossless conversion. This may be a bug in lint.
|
1.75 | 31-Jan-2021 |
rillig | lint: mention the operator in messages about bit shifts
|
1.74 | 31-Jan-2021 |
rillig | lint: add quotes to messages 1 and 19
|
1.73 | 31-Jan-2021 |
rillig | lint: be more precise in message 003 "tag in argument list"
|
1.72 | 30-Jan-2021 |
rillig | lint: add type information to message 275
Before: cast discards 'const' from pointer target type After: cast discards 'const' from type 'pointer to const char'
Seen in sqlite3.c.
|
1.71 | 30-Jan-2021 |
rillig | lint: add type information to warning about troublesome casts
The previous warning text did not mention the actual types that are involved in the type conversion. These types can be hard to see from the source code as soon as macros are involved, and even in plain code, one would have to follow the declarations, which is an unnecessary burden. Lint already has all information about the involved types, so there is no reason for omitting this crucial information.
Seen in external/mit/lua/dist/src/lvm.c and several other files. Including the type information in the message immediately makes the message scarier.
Before: pointer casts may be troublesome After: pointer cast from 'pointer to struct TString' to 'pointer to union GCUnion' may be troublesome
|
1.70 | 30-Jan-2021 |
rillig | lint: remove message 189, add tests for a few other messages
Message 189 would have applied to traditional C and was supposed to detect assignments between struct and union types. The corresponding check had never been implemented though.
Traditional C has been superseded for 30 years now, therefore there is no point in adding this check retroactively.
|
1.69 | 17-Jan-2021 |
rillig | lint: add type information to message 126
|
1.68 | 17-Jan-2021 |
rillig | lint: rename local variables in lbasename
|
1.67 | 14-Jan-2021 |
rillig | lint: add type details to message for enum type mismatch
Before December 2020, it was cumbersome to add type information to a message since the caller had to explicitly allocate buffers for the type names. That's probably the reason why this crucial detail had been left out of the warning.
|
1.66 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.65 | 09-Jan-2021 |
rillig | lint: fix crash for error 108 (invalid type of unary operator)
|
1.64 | 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.63 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.62 | 03-Jan-2021 |
rillig | lint: fix spelling of message 308
All other messages are lowercase as well.
|
1.61 | 03-Jan-2021 |
rillig | lint: add type information to message 124 "illegal pointer combination"
|
1.60 | 02-Jan-2021 |
rillig | lint: fix message 308 "Invalid type for _Complex"
Previously, lint aborted since it didn't expect tspec_name to be called with NOTSPEC, which at that point was the only possible value of dcs->d_cmod.
|
1.59 | 30-Dec-2020 |
rillig | lint: reduce verbosity of assertions
Having 2 lines of source code per assertion is too much, especially since most of this code is redundant anyway. Extract the common code and the additional negation into a simple function instead.
|
1.58 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.57 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.56 | 28-Dec-2020 |
rillig | lint: spell check
|
1.55 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.54 | 02-Jun-2020 |
christos | Fix return of alignof()
|
1.53 | 07-Sep-2018 |
christos | recognize int128
|
1.52 | 15-Jan-2018 |
christos | branches: 1.52.2; 1.52.4; fix indent
|
1.51 | 19-Aug-2016 |
christos | Add union casts.
|
1.50 | 18-Aug-2016 |
christos | anonymous members are C9X
|
1.49 | 14-Oct-2015 |
christos | more descriptive errors
|
1.48 | 29-Jul-2015 |
christos | Be more specific about the type errors
|
1.47 | 18-Feb-2014 |
christos | add __extension__ and typeof
|
1.46 | 19-Apr-2013 |
christos | Allow linted comments to take an argument that defines which error to suppress.
|
1.45 | 20-Apr-2012 |
christos | branches: 1.45.2; add __PRETTY_FUNCTION__
|
1.44 | 04-Oct-2011 |
christos | branches: 1.44.2; Handle c99 declarations in the middle of blocks.
|
1.43 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.42 | 02-May-2009 |
christos | Add __alignof__.
|
1.41 | 01-May-2009 |
christos | add variable declarations in for loops for c99
|
1.40 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.39 | 13-Apr-2009 |
christos | since we know the types, print what they are in error messages.
|
1.38 | 31-Jul-2008 |
christos | branches: 1.38.6; 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.
|
1.37 | 25-Jul-2008 |
dsl | 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!
|
1.36 | 27-Apr-2008 |
christos | branches: 1.36.2; print the types involved in an error.
|
1.35 | 27-Apr-2008 |
christos | reorder a couple of error messages.
|
1.34 | 26-Apr-2008 |
christos | fix "long double" type recognition which broke with the complex changes.
|
1.33 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.32 | 04-Mar-2008 |
christos | branches: 1.32.2; PR/38142: YAMAMOTO Takashi: lint -S complains on variable length arrays
|
1.31 | 23-Oct-2006 |
christos | branches: 1.31.8; 1.31.14; allow 0 sized structs in c9x
|
1.30 | 23-Oct-2006 |
christos | add zero sized array handling. It is a little too chatty now.
|
1.29 | 02-Jan-2005 |
christos | say from what type to what time we are converting.
|
1.28 | 03-Aug-2004 |
yamt | recognize C99 array initializer designators. PR/18896.
|
1.27 | 20-Jun-2004 |
jmc | 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
|
1.26 | 02-Nov-2002 |
perry | branches: 1.26.2; 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.
|
1.25 | 02-Nov-2002 |
perry | add c99ism(), by analogy to gnuism(), for c99 construct (un)warnings
|
1.24 | 22-Oct-2002 |
christos | add support for ({}) gcc shit.
|
1.23 | 22-Oct-2002 |
christos | add C9X/GCC compound literal expressions.
|
1.22 | 22-Oct-2002 |
christos | add variable array dimension.
|
1.21 | 22-Oct-2002 |
christos | handle gcc __FUNCTION__ and C9X __func__
|
1.20 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.19 | 13-Sep-2002 |
christos | 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.
|
1.18 | 07-Mar-2002 |
tv | Rename `basename' as `lbasename' so as not to confuse with the libgen.h prototyped function of the same name.
|
1.17 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.16 | 13-Dec-2001 |
augustss | 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.
|
1.15 | 28-May-2001 |
lukem | 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.
|
1.14 | 24-May-2001 |
lukem | support // comments if -g is given
|
1.13 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.12 | 06-Jul-2000 |
christos | - support for -X flag - support for -m flag - print the error number in each message
|
1.11 | 27-Jul-1998 |
mycroft | Fix a recurring typo: comparision -> comparison.
|
1.10 | 22-Feb-1998 |
christos | WARNSify
|
1.9 | 03-Nov-1997 |
cgd | 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.
|
1.8 | 02-Oct-1995 |
jpo | branches: 1.8.4; removed some dubious warnings about conversion of constant operands of bitwise operators
|
1.7 | 02-Oct-1995 |
jpo | 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.
|
1.6 | 02-Oct-1995 |
jpo | some minor bug fixes
|
1.5 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.4 | 02-Oct-1995 |
jpo | __{const,signed,volatile}{__,} added const, signed and volatile are disabled with -t
|
1.3 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
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.8.4.1 | 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.26.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.27 (requested by jmc in ticket #527): 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
|
1.31.14.1 | 24-Mar-2008 |
keiichi | sync with head.
|
1.31.8.1 | 23-Mar-2008 |
matt | sync with HEAD
|
1.32.2.1 | 18-May-2008 |
yamt | sync with head.
|
1.36.2.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.38.6.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.44.2.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.44.2.1 | 23-May-2012 |
yamt | sync with head.
|
1.45.2.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.45.2.1 | 23-Jun-2013 |
tls | resync from head
|
1.52.4.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.52.2.1 | 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.116.2.1 | 31-May-2021 |
cjep | sync with head
|
1.246.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.4 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.3 | 28-May-2001 |
lukem | 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.
|
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.242 | 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.241 | 14-May-2025 |
rillig | lint: extract type_attributes functions from grammar
|
1.240 | 04-May-2025 |
rillig | lint: add more details to message about discarding qualifiers
The name of the function (or, if not available, its type) is useful in lines that contain more than one function call.
|
1.239 | 10-Apr-2025 |
rillig | lint: do not warn about constant operand of '!'
Like its related warning about a constant condition, the purpose of this warning is unclear, and suppressing the warning requires special lint comments, thus cluttering the code.
The message itself is still kept in err.c to keep the '-X 239' option valid. These LINTFLAGS will be removed in a follow-up commit.
The lint comments /* CONSTCOND */, as well as its more verbose forms /* CONSTANTCOND */ and /* CONSTANTCONDITION */ are no longer needed and can be removed.
|
1.238 | 08-Dec-2024 |
rillig | lint: warn about do-while macros that end with a semicolon
|
1.237 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.236 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.235 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.234 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.233 | 28-Sep-2024 |
rillig | lint: handle __attribute__((__unused__)) for functions and variables
Previously, lint ignored the '__unused' marker, requiring its own /* ARGSUSED */ marker instead.
Previously, attributes were interpreted as soon as the closing parenthesis was parsed. For a function definition such as '__unused static void f(void) {}', this was too early, as the attribute was not connected to the function, as the function was not parsed yet.
Now, the 'unused' attribute is passed around by the parser, until it is merged into the declarator where it belongs. Due to an inaccuracy in the grammar, the 'used' attribute has to be passed through a parameter_list, even though a parameter list is not related to attributes. Still, it's better than before.
|
1.232 | 24-Sep-2024 |
rillig | lint: exclude the GCC builtins from debug logging
Their source code is parsed for simplicity, and since the text is fixed, there is nothing surprising to be expected there. Instead, start debugging when the actual code begins.
|
1.231 | 04-Sep-2024 |
rillig | lint: clean up checks for declarations
|
1.230 | 17-Jun-2024 |
rillig | branches: 1.230.2; lint: accept C23 [[fallthrough]] statements
Needed by bind9/getaddresses.c:137.
|
1.229 | 12-May-2024 |
rillig | lint: remove unused flag '-u' from lint1
This flag is completely handled by lint2.
|
1.228 | 12-May-2024 |
rillig | lint: in strict bool mode, allow do-while-0
Even though 0 is not a boolean constant, allow this common idiom, to help in those cases where the C preprocessor used by lint does not mark tokens as coming from system headers (Clang).
|
1.227 | 12-May-2024 |
rillig | lint: move code for parsing balanced token sequences to lex.c
To access yytext from lex.c, the lexer needs to be in %pointer mode, which was specified in IEEE Std 1003.1, 2004 Edition and thus should be old enough to be available on platforms other than NetBSD, for use in tools/lint1 where lint1 is built before yacc and lex.
|
1.226 | 11-May-2024 |
rillig | lint: parse but otherwise ignore C23 attributes
The C23 attributes are only parsed before an expression in an expression statement, as a proof of concept. Other places will follow later.
|
1.225 | 09-May-2024 |
rillig | lint: in C23 mode, support the nullptr constant
|
1.224 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.223 | 01-May-2024 |
rillig | lint: support _Alignas and __attribute__((__aligned(4)))
|
1.222 | 12-Apr-2024 |
rillig | lint: clean up and speed up the check for snprintb
|
1.221 | 29-Mar-2024 |
rillig | lint: clean up
|
1.220 | 28-Mar-2024 |
rillig | lint: clean up
|
1.219 | 09-Mar-2024 |
rillig | lint: use fewer struct keywords
|
1.218 | 03-Mar-2024 |
rillig | lint: check for unreachable bits and fields in snprintb formats
While here, clean up a few existing checks.
|
1.217 | 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.216 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.215 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.214 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.213 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.212 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.211 | 11-Jan-2024 |
rillig | lint: correctly set system-header flag on cast-expression
When a cast-expression comes partly from a system header, determine at the ')' whether the whole cast-expression comes from the system header. Previously, it was based on the operand, which contradicted the documentation of tn_sys.
Mainly affects strict bool mode (where expressions from system headers are handled more leniently), as well as query 9 for parenthesized return expressions.
Discovered upon manual inspection, as calling expr_alloc_tnode should never be necessary when creating an expression node with operands; there's build_op for that purpose.
|
1.210 | 09-Jan-2024 |
rillig | lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not identifiers but designator sequences, such as in 'offsetof(struct stat, st_atim.tv_sec)', so make lint accept them as well.
|
1.209 | 10-Dec-2023 |
rillig | lint: allow querying for 'static' followed by non-'static' declaration
|
1.208 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.207 | 02-Aug-2023 |
rillig | lint: remove unused string literals
|
1.206 | 02-Aug-2023 |
rillig | lint: fix handling of unnamed function parameters
|
1.205 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.204 | 01-Aug-2023 |
rillig | lint: improve debug logging for declarators
|
1.203 | 30-Jul-2023 |
rillig | lint: in debug mode, default to indenting the debug log
Only the 'parsing' lines are not indented, as line breaks are independent from the structure of the code.
|
1.202 | 29-Jul-2023 |
rillig | lint: condense code for ending a function
No functional change.
|
1.201 | 29-Jul-2023 |
rillig | lint: constify
|
1.200 | 29-Jul-2023 |
rillig | lint: use standard function attribute for noreturn functions
|
1.199 | 28-Jul-2023 |
rillig | lint: extract 'vararg' and 'prototype' flags from global 'dcs'
These flags are only relevant for parameter lists, so add a separate type for it.
No functional change.
|
1.198 | 15-Jul-2023 |
rillig | lint: clean up duplicate code for finding struct/union members
|
1.197 | 15-Jul-2023 |
rillig | lint: fix use-after-free bug in GCC statement expressions
|
1.196 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.195 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.194 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.193 | 13-Jul-2023 |
rillig | lint: reduce code size for handling lint comments
|
1.192 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.191 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.190 | 07-Jul-2023 |
rillig | lint: warn about function definitions without header declaration
The existing warning was only issued for function declarations, not for function definitions.
The interesting change in the tests is in msg_351.c. Many other tests use non-static functions due to their syntactic brevity. In these tests, the warning is disabled individually, to allow new functions to be added without generating warning 351.
|
1.189 | 07-Jul-2023 |
rillig | lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only combining them if actually desired.
|
1.188 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.187 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.186 | 02-Jul-2023 |
rillig | lint: extend debug logging for declaration levels
Indent the debug logging according to the declaration level.
Since there are a few cases where the enclosing declaration levels are modified, log the whole declaration level stack whenever a level begins or ends.
|
1.185 | 01-Jul-2023 |
rillig | lint: clean up duplicate and dead code for integer constants
No functional change.
|
1.184 | 01-Jul-2023 |
rillig | lint: fix initialization of unnamed union member
|
1.183 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.182 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.181 | 30-Jun-2023 |
rillig | lint: clean up handling of declarations
No functional change.
|
1.180 | 29-Jun-2023 |
rillig | lint: clean up function names
No functional change.
|
1.179 | 29-Jun-2023 |
rillig | lint: clean up completion of struct, union and enum declarations
No functional change.
|
1.178 | 24-Jun-2023 |
rillig | lint: remove redundant 'extern' from function declarations
No binary change.
|
1.177 | 23-Apr-2023 |
rillig | lint: be strict when parsing command line for excluded message IDs
Previously, lint accepted -X '1, 2, 3', while the manual page lists the IDs without spaces.
On 32-bit platforms, lint accepted -X -4294967295, and on 64-bit platforms, it accepted the corresponding larger numbers.
The code for parsing message IDs and query IDs conceptually does the same, but the implementations differed for no reason.
|
1.176 | 11-Apr-2023 |
rillig | lint: in debug mode, use different names for macro and function
No functional change.
|
1.175 | 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.174 | 18-Feb-2023 |
rillig | lint: remove unused internal_error
|
1.173 | 06-Feb-2023 |
rillig | lint: eliminate unnecessary indirection
No functional change.
|
1.172 | 29-Jan-2023 |
rillig | lint: rename functions for function definition
No functional change.
|
1.171 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.170 | 01-Oct-2022 |
rillig | lint: reduce pointer indirection for unnamed entities
No functional change.
|
1.169 | 28-Aug-2022 |
rillig | lint: inline previous_declaration for nonconstant message IDs
This adds back the compile-time printf validation in debug mode that was missing before.
|
1.168 | 28-Aug-2022 |
rillig | lint: clean up visual clutter
No functional change.
|
1.167 | 28-Aug-2022 |
rillig | lint: rename functions to be clearer
No need anymore to keep external identifiers at the "6 significant initial characters" mandated by C90.
|
1.166 | 28-Aug-2022 |
rillig | lint: rename dcs manipulation functions to be clearer
No functional change.
|
1.165 | 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.164 | 03-Jul-2022 |
rillig | lint: add debug logging for struct and enum details
|
1.163 | 01-Jul-2022 |
rillig | lint: move error handling code from main1.c to err.c
No functional change.
|
1.162 | 15-Jun-2022 |
rillig | lint: rename mod_t.m_requires_bool to m_compares_with_zero
The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict bool mode, in default mode they accept any scalar expression and compare it with zero. The new names are more accurate.
No functional change.
|
1.161 | 15-Jun-2022 |
rillig | lint: unexport lint's messages
There was only a single place where a message was used directly, instead of calling one of the several functions for this purpose.
|
1.160 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.159 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.158 | 30-Apr-2022 |
rillig | lint: document why C11 keywords are available in C99 mode as well
|
1.157 | 30-Apr-2022 |
rillig | lint: inline macro c11flag
No functional change.
|
1.156 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.155 | 16-Apr-2022 |
rillig | lint: model C language levels in a future-compatible way
The options -t, -s and -S are confusing because they are used inconsistently. The option -S enables C99 features, but when using it instead of -s, it also doesn't enable all checks required by C90 and later. Prepare fixing of these inconsistencies by replacing the flag variables with language levels that can be extended in a straight-forward way as new C standards arrive.
| option | allow_trad | allow_c90 | allow_c99 | allow_c11 | |--------|------------|-----------|-----------|-----------| | -t | x | - | - | - | | (none) | x | x | - | - | | -s | - | x | - | - | | -S | - | x | x | - | | -Ac11 | - | x | x | x |
Each usage of the old flag variables will be inspected and migrated individually, to clean up the subtle variations in the conditions and to provide a simpler model.
When lint was created in 1995, its focus was migrating traditional C code to C90 code. Lint does not help in migrating from C90 to C99 or from C99 to C11 since there are only few silent changes, and simply because nobody took the time to implement these migration aids. If necessary, such migration modes could be added separately.
There is a small functional change: when the option -s is combined with either -S or -Ac11, lint now only keeps the last of these options. Previously, these options could be combined, leading to a mixture of language levels, halfway between C90, C99 and C11. Especially combining traditional C with C11 doesn't make sense, but xlint currently allows it.
The 3 tests that accidentally specified multiple language levels have been adjusted to a single language level.
|
1.154 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.153 | 09-Apr-2022 |
rillig | lint: rename length to length_in_bits
No functional change.
|
1.152 | 02-Apr-2022 |
rillig | lint: inline setcomplete
No functional change.
|
1.151 | 02-Apr-2022 |
rillig | lint: add debug logging for the declaration stack
To track down the wrong edge cases in decl_direct_abstract.c.
|
1.150 | 13-Mar-2022 |
rillig | lint: rename function 'cleanup' to be more expressive
No functional change.
|
1.149 | 01-Mar-2022 |
rillig | lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and debug_symtab can be called as needed during a debug session.
|
1.148 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in function names
No functional change.
|
1.147 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.146 | 26-Feb-2022 |
rillig | lint: fix memory corruption in statement expressions (since 2021-12-17)
The commit that introduced the assertion failure looks innocent, it only adds a few predefined functions for GCC mode. Nevertheless, before that commit, lint consistently complained about 'error: void type illegal in expression [109]', which doesn't make sense either.
This fix also removes the creative use of the initialization stack to store the type of the statement expression. Having a separate stack for these statement expressions makes the code easier to understand.
|
1.145 | 26-Feb-2022 |
rillig | lint: extract code for handling statement expressions from the grammar
This prepares the fix of the memory corruption bug that is demonstrated in t_integration.sh, test case assertion_failures.
No functional change.
|
1.144 | 21-Dec-2021 |
rillig | lint: rename debug_indent to debug_print_indent
The previous name could be mistaken to mean "increase the indentation of the debug output". Instead, the function prints the current indentation.
In externs1.h, the macro definition was a duplicate, the macros were sorted differently than the functions a few lines above.
No binary change.
|
1.143 | 20-Dec-2021 |
rillig | lint: add grammar rule for the beginning of a designation
This will be necessary to properly implement handling of initializers and braced initializer-lists.
No functional change for now since the designation is already reset after each expression and '}'. To handle initializations properly, the designation must not be reset after each expression, it must advance to the next member instead.
|
1.142 | 16-Dec-2021 |
rillig | lint: narrow down parameter of build_name
Passing an arbitrary tokenizer symbol left too much freedom and uncertainty to the caller, and 0 was a magic number in this context.
No functional change.
|
1.141 | 15-Dec-2021 |
rillig | lint: unexport struct_or_union_member
Strangely, lint2 didn't notice this unnecessary export.
|
1.140 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.139 | 16-Nov-2021 |
rillig | lint: rename attron to in_gcc_attribute
No functional change.
|
1.138 | 31-Aug-2021 |
rillig | lint: remove unused function for generic messages
The function message_at is still used, for information about previous occurrences of a symbol.
|
1.137 | 29-Aug-2021 |
rillig | lint: add __sync_ and _mm_ as prefixes for builtin functions
These two additions cover all cases that occur in the current NetBSD build on x86_64. This allows build_name to use the usual pattern 'if Sflag then error else if sflag then warning'. That function currently issues a warning in C99 as well, even though C99 prohibits implicit function declarations.
|
1.136 | 28-Aug-2021 |
rillig | lint: do not emit GCC builtin functions
Lint1 no longer emits declarations of GCC builtin functions and calls to them.
Previously, lint generated 3421 useless warnings in a default NetBSD build, like this:
__atomic_load_n, arg 1 used inconsistently acl.c(216)[pointer to unsigned int] rbtdb.c(921)[pointer to unsigned short]
This was because lint just doesn't understand that these functions are type-generic, which is indeed unusual in C.
These useless warnings made the lint output more frightening than it should actually be. Together with the strange formatting of the diagnostics (space-space-tab after the main message, two spaces and two colons between the occurrences, symbols are listed in hashcode order), this creates the impression that lint is not intended to be a user-friendly tool.
For now, fix the excess warnings, leaving the other items for later.
|
1.135 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types in convert_integer
There was no need to have two separate magic values (0 and -1) to mean the same.
No functional change.
|
1.134 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types
Lint does not need to support any types larger than 256 MB since they don't occur in practice. Practically, such large types have never been supported at all since the function type_size_in_bits used int for the internal calculations, resulting in overflows.
|
1.133 | 28-Aug-2021 |
rillig | lint: fix a few lint warnings about type conversions
A simple 'unsigned int' is more than enough for representing the size of a bit-field, as well as the maximum alignment of any type.
No functional change.
|
1.132 | 23-Aug-2021 |
rillig | lint: inline msb
This reduces the binary size on x86_64 by about 500 bytes.
No functional change.
|
1.131 | 23-Aug-2021 |
rillig | lint: remove unnecessary width parameter for msb
No functional change.
|
1.130 | 22-Aug-2021 |
rillig | lint: remove Tflag and pflag from common declarations
These flags are only needed by lint1 and lint2, but not by the driver xlint.
No functional change.
|
1.129 | 19-Aug-2021 |
rillig | lint: change return type of 'msb' from int to bool
No functional change.
|
1.128 | 01-Aug-2021 |
rillig | lint: merge duplicate debugging code
The functions 'debug_node' and 'display_expression' were similar enough to be merged.
Migrate debug_node to use the existing debug logging functions.
Remove the now unused option 'd' from the options string.
|
1.127 | 01-Aug-2021 |
rillig | lint: remove option -d, clean up debug logging
The command line option -d was not used by /usr/bin/lint, and it only triggered a handful of debug messages. Move this debug logging over to the compile-time -DDEBUG setting.
Move display_expression further up to avoid the forward declaration.
|
1.126 | 31-Jul-2021 |
rillig | lint: do not evaluate arguments of debug_step
To analyze the unexpected test failure of op_shl_lp64, I had reverted debug_step to evaluate its arguments. I then accidentally committed that without running the tests again.
Anyway, the previous commit can now be used as a demonstration that initdecl is indeed missing the initialization for __uint128_t, which leads to the internal error in op_shl_lp64.
|
1.125 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.124 | 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.123 | 31-Jul-2021 |
rillig | lint: add debugging output for the grammar tokens
No functional change outside debug mode.
|
1.122 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.121 | 25-Jul-2021 |
rillig | lint: move scl_name from print.c to decl.c
It is only needed there.
|
1.120 | 20-Jul-2021 |
rillig | lint: use consistent naming scheme for functions that build nodes
No functional change.
|
1.119 | 20-Jul-2021 |
rillig | lint: split 'build' into build_binary and build_unary
No functional change.
|
1.118 | 15-Jul-2021 |
rillig | lint: replace call to ttos with type_name
Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as ttos and more expressive. It can also be called multiple times without invalidating the returned strings.
Used only in debug mode.
|
1.117 | 14-Jul-2021 |
rillig | lint: extract build_member_access from the grammar
No functional change.
|
1.116 | 10-Jul-2021 |
rillig | lint: rename clrtyp/deftyp to begin_type/end_type
The abbreviations clr/def did not make it obvious that these two functions or grammar rules form pairs.
No functional change.
|
1.115 | 06-Jul-2021 |
rillig | lint: rename type generic_association_types to generic_association
The word 'types' was misleading and unnecessary.
No functional change.
|
1.114 | 29-Jun-2021 |
rillig | lint: rename xsign to convert_integer
The term sign-extend was too specific, the function actually does a broader conversion.
No functional change.
|
1.113 | 28-Jun-2021 |
rillig | lint: rename pqinf_t to qual_ptr and clean up code
The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing.
The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'.
No functional change.
|
1.112 | 27-Jun-2021 |
rillig | lint: fix result type of _Generic expressions
|
1.111 | 20-Jun-2021 |
rillig | lint: remove unused print_tnode
The function display_expression serves the same purpose and prints more details.
|
1.110 | 19-Jun-2021 |
rillig | lint: in debug mode, print name of the "storage class"
This helps in tracking down the internal errors related to declarations, found by running afl.
|
1.109 | 15-Jun-2021 |
rillig | lint: replace array access with function calls
First and foremost, the test d_c99_complex_split accessed the array qlmasks out-of-bounds, with an index of 128 for the type 'double _Complex'. This invoked undefined behavior since the maximum allowed index was 64.
Replacing the raw array accesses with function calls allows for bounds checks to catch these errors early.
Determining the value bits for a 'double _Complex' does not make sense at all since it is not an integer type. This means that lint didn't handle these types correctly for several years. Support for int128_t has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex has been added in inittyp.c 1.9 from 2008-04-26.
Determining the value bits for an int128_t would make sense, but the unit tests don't contain examples for this type since at the moment all unit tests must produce the same results on 32-bit and 64-bit platforms, and the 32-bit platforms don't support int128_t.
|
1.108 | 18-Apr-2021 |
rillig | lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
|
1.107 | 18-Apr-2021 |
rillig | lint: add error_at, warning_at, message_at
Right now there are several places in the code that use the global variable curr_pos for passing a parameter to the diagnostic functions. That's not what global variables are for.
Make it easy for the code to migrate to the parameter-passing style.
No functional change.
|
1.106 | 18-Apr-2021 |
rillig | lint: do not allow the diagnostics to be modified
|
1.105 | 14-Apr-2021 |
rillig | lint: add option to accept C11 features
The list of available letters for the command line options gets shorter and shorter. Most of the interesting letters are already used for some warning categories. Curiously, -A, -W and -E were all still available.
The option -A nicely matches the intention of the option, which is to allow a certain set of language features. To keep the option available for further extensions, define -Ac11 as the currently only valid option of that kind. This allows straight-forward extension for C17 and future language standards, as well as independent feature-sets. The options -W and -E may someday complement the -A option, using the allow/warn/error categories.
|
1.104 | 14-Apr-2021 |
rillig | lint: add support for C11-isms such as int[static 3]
|
1.103 | 09-Apr-2021 |
rillig | lint: clean up handling of preprocessing output lines
No functional change.
|
1.102 | 08-Apr-2021 |
rillig | lint: in code from included files, print stack trace
Previously, the standard NetBSD build generated several lint warnings in lhash.h from OpenSSL, without providing any hint as to which file actually included that header. In cases like these, lint now interprets the line number information in the preprocessor output from GCC to reconstruct the exact include path to the file in question.
The program check-expect.lua had to be rewritten almost completely since it assumed that all diagnostics would come from the main file. In all existing tests, this was true, but these tests did not cover all cases that occurred in practice. Now it records the complete location of the diagnostic instead of just the line number.
|
1.101 | 06-Apr-2021 |
rillig | lint: move check for strict bool mode into separate file
No functional change.
|
1.100 | 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.99 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.98 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.97 | 02-Apr-2021 |
rillig | lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the scope of the current expression. This was misleading before since the other related functions all have a 't' (probably for 'temporary') in their names.
Also encode in the function name that the returned memory is zeroed out as that could not be inferred from the old name.
No functional change.
|
1.96 | 02-Apr-2021 |
rillig | lint: rename mbl to memory_block
No functional change.
|
1.95 | 30-Mar-2021 |
rillig | lint: rewrite handling of initializations, fixing several bugs
The previous implementation had a wrong model of how initialization happens in C99, its assertions failed in all kind of edge cases and it was not possible to fix the remaining bugs one at a time without running into even more obscure assertion failures.
The debug logging was detailed but did not help to clarify the situation. After about 20 failed attempts at fixing the small details I decided to start all over and rewrite the initialization code from scratch. I left the low-level parts of handling designators, the code that is independent of brace_level and the high-level parts of how the parser calls into this module. Everything else is completely new.
The concept of a brace level stays since that is how C99 describes initialization. The previous code could not handle multi-level designations (see d_init_pop_member.c). There are no more assertion failures in the initialization code.
Some TODO comments have been left in the tests to keep the line numbers the same in this commit. These will be cleaned up in a follow-up commit.
The new implementation does not handle initialization with "missing" braces. This is an edge case that both GCC and Clang warn about, so it is not widely used. If necessary, it may be added later.
The new implementation does not use any global variables in the vast majority of the functions, to make all dependencies and possible modifications obvious.
|
1.94 | 28-Mar-2021 |
rillig | lint: sprinkle const on function declarations
No functional change.
|
1.93 | 28-Mar-2021 |
rillig | lint: rename public designator functions
Their previous names were too similar to the actual implementation functions, which was confusing.
No functional change.
|
1.92 | 27-Mar-2021 |
rillig | lint: rename decl1ext, reduce visibility
No functional change.
|
1.91 | 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.90 | 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.89 | 27-Mar-2021 |
rillig | lint: rename fnaddreplsrcdir to something less cryptic
No functional change.
|
1.88 | 27-Mar-2021 |
rillig | lint: remove unused fnalloc
|
1.87 | 26-Mar-2021 |
rillig | lint: rename pushctrl and popctrl to be more expressive
While here, remove the magic number 0 that in this context means "function body".
No functional change.
|
1.86 | 26-Mar-2021 |
rillig | lint: rename pushdecl and popdecl to be more expressive
The previous names were highly ambiguous. The 'decl' could have meant 'declaration', which would be the usual abbreviation. It could also be split into 'dec' and 'l', meaning 'declaration level', which would make more sense in this particular context.
To avoid having to guess anything about these names, rename the functions. Instead of 'push' and 'pop', I renamed them to 'begin' and 'end' since these are the high-level operation that are of interest. That the hierarchy of declaration levels is implemented as a stack is nice to know but not as important to understand the whole situation.
No functional change.
|
1.85 | 25-Mar-2021 |
rillig | lint: fix names of functions dealing with designations
These functions modify the whole designation, not only a single designator.
No functional change.
|
1.84 | 23-Mar-2021 |
rillig | lint: fix wrong error message about type mismatch in compound literal
Now that the code contains explicit markers for starting and ending an initialization, and having the guarantee that an assertion fails whenever some code accesses the state of the "current initialization" even though there is no ongoing initialization gives me much more confidence in the correctness of the code. The calls to begin_initialization and end_initialization always appear in pairs, enclosing the minimal amount of code necessary for initialization.
In a nutshell, global modifiable state is error-prone and hard to understand.
A nice side effect is that the grammar no longer needs a special rule for the outermost initializer since the functions for the debug logging are now called explicitly.
The code that misuses the initialization state just because it needs to temporarily store a sym_t somewhere is now clearly marked as such. A GCC statement expression can appear anywhere and is therefore independent of the initialization. Most probably the code can simply refer to the local variable in the grammar rule itself, or this variable needs to be encoded in the grammar %union. For sure there is a better way to handle this.
There is no longer a need that the function 'declare' initializes the initialization state, it was just the wrong place to do this.
|
1.83 | 23-Mar-2021 |
rillig | lint: add indirection for accessing the current initialization
This indirection will be needed to handle nested initializations, which are a new feature of C99. These are currently not handled correctly, see msg_171.c.
No functional change.
|
1.82 | 21-Mar-2021 |
rillig | lint: invert 'rchflag', call it warn_about_unreachable instead
No functional change.
|
1.81 | 21-Mar-2021 |
rillig | lint: rename functions for handling control statements
No functional change.
|
1.80 | 20-Mar-2021 |
rillig | lint: rename ftflg to seen_fallthrough
One less abbreviation to remember when reading the code.
No functional change.
|
1.79 | 19-Mar-2021 |
rillig | lint: use standard form of statement macro for debug_node
No functional change.
|
1.78 | 19-Mar-2021 |
rillig | lint: rename tsize to type_size_in_bits
The shorter name size_in_bits was already taken by the function-like macro with argument type tspec_t.
No functional change.
|
1.77 | 19-Mar-2021 |
rillig | lint: rename push_member and pop_member
These two functions are supposed to model the designator that is used for initializing structs and arrays. The implementation is still buggy and does not work at all for C99 designators with multiple names, see d_init_pop_member.c.
For now, just rename the functions to head in the right direction.
No functional change.
|
1.76 | 17-Mar-2021 |
rillig | lint: add debug logging for C99-style initialization of arrays
No functional change outside debug mode.
|
1.75 | 17-Mar-2021 |
rillig | lint: move to_int_constant from the grammar to decl.c
This way, the code is covered by running 'make lint'. The code from the grammar is not covered, therefore it still uses int instead of bool in a few places.
Inline the comparison functions for uint64_t. These functions didn't add any clarity to the code.
No functional change.
|
1.74 | 17-Mar-2021 |
rillig | lint: move main part of idecl over to decl.c and rename it
No functional change.
|
1.73 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.72 | 28-Feb-2021 |
rillig | lint: rename getbound to alignment_in_bits
No functional change.
|
1.71 | 21-Feb-2021 |
rillig | lint: extract check_non_constant_initializer from init_using_expr
No functional change.
|
1.70 | 21-Feb-2021 |
rillig | lint: fix definition of debug_node in non-debug mode
|
1.69 | 21-Feb-2021 |
rillig | lint: indent node details in debug mode
|
1.68 | 20-Feb-2021 |
rillig | lint: extend debugging for initializing objects
No functional change outside debug mode.
|
1.67 | 20-Feb-2021 |
rillig | lint: rename mkinit to init_using_expr
No functional change outside debug mode.
|
1.66 | 19-Feb-2021 |
rillig | lint: warn about mismatch in getopt handling
|
1.65 | 31-Jan-2021 |
rillig | lint: don't warn about constant condition in 'do { } while (0)'
|
1.64 | 30-Jan-2021 |
rillig | lint: rename incompl to is_incomplete
No functional change.
|
1.63 | 24-Jan-2021 |
rillig | lint: expand abbreviations in lexer function names
No functional change.
|
1.62 | 23-Jan-2021 |
rillig | lint: apply strict bool mode to lex.c
There are 2 remaining expressions:
In line 244, !(kw->kw_deco & deco) is a bitwise and. This is already allowed for enums, it needs to be allowed for arbitrary integer expressions as well. This covers the many places where plain integers are used for bit fields, together with #define. This pattern is not as typesafe as using enums, still it is common practice.
In line 769, the expression !finite(f) is a legitimate use of a function that has return type int for traditional reasons. It's the same as for ferror.
There are several other functions like unlink, open or strcmp that have return type int as well, but with a different meaning. It is not yet clear what the best way is to handle these different meanings. Having to write finite(f) == 0 in strict bool mode doesn't look idiomatic, on the other hand, !strcmp(s1, s2) is exactly the pattern that strict bool mode wants to avoid.
|
1.61 | 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.60 | 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.59 | 18-Jan-2021 |
rillig | lint: expand abbreviations in function names
|
1.58 | 17-Jan-2021 |
rillig | lint: allow system headers to use int as bool, even in strict bool mode
|
1.57 | 17-Jan-2021 |
rillig | lint: fix return type of conaddr
|
1.56 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.55 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.54 | 11-Jan-2021 |
rillig | lint: sprinkle a few const modifiers throughout the code
|
1.53 | 10-Jan-2021 |
rillig | lint: change return type of eqptrtype to bool
|
1.52 | 10-Jan-2021 |
rillig | lint: rename functions with short names
|
1.51 | 10-Jan-2021 |
rillig | lint: rename cvtcon to convert_constant
No functional change.
|
1.50 | 09-Jan-2021 |
rillig | lint: change return type of typeok to bool
No functional change.
|
1.49 | 09-Jan-2021 |
rillig | lint: rename ename to enumeration_constant
|
1.48 | 03-Jan-2021 |
rillig | lint: rename funcarg and funccall to longer names
From the previous short names, it was no obvious that these functions create a new tree node.
The function named funccall in lint2 has been left as-is, since it has a completely different prototype.
|
1.47 | 03-Jan-2021 |
rillig | lint: rename functions that create nodes
|
1.46 | 03-Jan-2021 |
rillig | lint: rename prflstrg to printflike_argnum, likewise for scflstrg
|
1.45 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.44 | 02-Jan-2021 |
rillig | lint: convert bitfieldtype_ok from int to bool
No functional change intended, except for the output in debug mode.
|
1.43 | 01-Jan-2021 |
rillig | lint: split label handling into separate functions
The only thing these cases have in common is the name "label" and the "reached = 1" assignment. That's not reason enough to combine completely unrelated functions.
|
1.42 | 30-Dec-2020 |
rillig | lint: split cluparg into separate functions
That function did more than its short name could express, and the things it did were not related in any way.
|
1.41 | 30-Dec-2020 |
rillig | lint: reduce verbosity of assertions
Having 2 lines of source code per assertion is too much, especially since most of this code is redundant anyway. Extract the common code and the additional negation into a simple function instead.
|
1.40 | 29-Dec-2020 |
rillig | lint: split complete_tag into separate functions
|
1.39 | 29-Dec-2020 |
rillig | lint: rename functions for handling the initialization stack
|
1.38 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.37 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.36 | 28-Dec-2020 |
rillig | lint: rename confusing function setcompl
The previous function name suggested that it would set the complete flag of the type, but it was the exact opposite. To reduce confusion, negate the meaning of the parameter.
|
1.35 | 06-Mar-2017 |
christos | fix typeof, add __builtin_offsetof
|
1.34 | 27-Dec-2016 |
christos | branches: 1.34.2; teach lint __attribute__((__unused__))
|
1.33 | 24-Dec-2016 |
christos | Add -R (source filename remapping) for MKREPRO
|
1.32 | 18-Apr-2014 |
christos | branches: 1.32.6; Handle the rest of gcc __attribute__ s.
|
1.31 | 19-Apr-2013 |
christos | branches: 1.31.4; Allow linted comments to take an argument that defines which error to suppress.
|
1.30 | 05-Feb-2011 |
christos | branches: 1.30.4; 1.30.10; as promised make the last ops table auto-generated.
|
1.29 | 02-Oct-2009 |
christos | branches: 1.29.2; compute sizes by the new tsize() function.
|
1.28 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.27 | 02-May-2009 |
christos | Add __alignof__.
|
1.26 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.25 | 02-Mar-2009 |
christos | Don't produce type mismatch warnings if one side of ?: is "[qual] void *" and the other side is "[qual] pointer".
|
1.24 | 16-Nov-2008 |
dholland | branches: 1.24.2; WARNS=4
|
1.23 | 31-Jul-2008 |
christos | 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.
|
1.22 | 14-Oct-2006 |
christos | branches: 1.22.18; Fix c99 initialization issues. Now the regression tests work.
|
1.21 | 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.20 | 02-Nov-2002 |
perry | add c99ism(), by analogy to gnuism(), for c99 construct (un)warnings
|
1.19 | 22-Oct-2002 |
christos | add support for ({}) gcc shit.
|
1.18 | 22-Oct-2002 |
christos | add C9X/GCC compound literal expressions.
|
1.17 | 22-Oct-2002 |
christos | add variable array dimension.
|
1.16 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.15 | 13-Sep-2002 |
christos | 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.
|
1.14 | 05-Feb-2002 |
thorpej | 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.
|
1.13 | 18-Jan-2002 |
thorpej | Centralize the initialization/declaration of the ttab.
|
1.12 | 03-Jan-2002 |
thorpej | * 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.
|
1.11 | 28-May-2001 |
lukem | 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.
|
1.10 | 11-Oct-2000 |
is | More format string cleanup by sommerfeld.
|
1.9 | 06-Jul-2000 |
christos | new function and new flag...
|
1.8 | 22-Feb-1998 |
christos | branches: 1.8.2; 1.8.10; WARNSify
|
1.7 | 02-Oct-1995 |
jpo | don't print warnings about unused variables or arguments in compound statements which contain asm statements.
|
1.6 | 02-Oct-1995 |
jpo | 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.
|
1.5 | 02-Oct-1995 |
jpo | support asm statements and asm modifiers in declarations
asm statements consist of an asm keyword, an optional qualifier, a left paren, a list of tokens up to and including the matching right paren, and a semicolon.
asm modifiers consist of an asm keyword, an left paren, a string and a right paren.
asm statements and modifiers have no semantic for lint(1), they exist only to avoid complaints about them.
|
1.4 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.3 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
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.8.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.8.2.1 | 19-Oct-2000 |
he | Pull up revision 1.10 (requested by he): Format string cleanup.
|
1.22.18.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.24.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.29.2.1 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.30.10.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.30.10.1 | 23-Jun-2013 |
tls | resync from head
|
1.30.4.1 | 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.31.4.1 | 10-Aug-2014 |
tls | Rebase.
|
1.32.6.2 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.32.6.1 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.34.2.1 | 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.230.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.196 | 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.195 | 07-Jul-2025 |
rillig | lint: disable message 207 about 'loop not entered at top'
The purpose of the message is unclear, and it produces several warnings in legitimate code.
|
1.194 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.193 | 10-Apr-2025 |
rillig | lint: do not warn about constant operand of '!'
Like its related warning about a constant condition, the purpose of this warning is unclear, and suppressing the warning requires special lint comments, thus cluttering the code.
The message itself is still kept in err.c to keep the '-X 239' option valid. These LINTFLAGS will be removed in a follow-up commit.
The lint comments /* CONSTCOND */, as well as its more verbose forms /* CONSTANTCOND */ and /* CONSTANTCONDITION */ are no longer needed and can be removed.
|
1.192 | 10-Mar-2025 |
rillig | lint: in C99 mode and later, warn about non-prototype functions
Suggested by Christos Zoulas.
|
1.191 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.190 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.189 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.188 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.187 | 12-May-2024 |
rillig | branches: 1.187.2; lint: in strict bool mode, allow do-while-0
Even though 0 is not a boolean constant, allow this common idiom, to help in those cases where the C preprocessor used by lint does not mark tokens as coming from system headers (Clang).
|
1.186 | 29-Mar-2024 |
rillig | lint: clean up
|
1.185 | 27-Mar-2024 |
rillig | lint: don't use 'long' in diagnostics
The size of 'long' differs between 64-bit and 32-bit platforms. Eliminate this possible platform-dependency.
|
1.184 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.183 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.182 | 09-Mar-2024 |
rillig | lint: internally store case label values in order of appearance
|
1.181 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.180 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.179 | 06-Jan-2024 |
rillig | lint: remove redundant parentheses, braces and comments
Rename the functions for folding constant expressions, to make the comments redundant.
|
1.178 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.177 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.176 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.175 | 02-Dec-2023 |
rillig | lint: remove redundant empty lines
No functional change.
|
1.174 | 06-Aug-2023 |
rillig | lint: since C99, a non-void function must return a value
|
1.173 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.172 | 29-Jul-2023 |
rillig | lint: condense code for ending a function
No functional change.
|
1.171 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.170 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.169 | 13-Jul-2023 |
rillig | lint: reduce code size for handling lint comments
|
1.168 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.167 | 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.166 | 09-Jul-2023 |
rillig | lint: clean up the wording of a few diagnostics
|
1.165 | 03-Jul-2023 |
rillig | lint: invert the -u, -v and -z flags
Now they behave the same as in the manual page.
No functional change.
|
1.164 | 03-Jul-2023 |
rillig | lint: rename uppercase QUAD to LLONG
No binary change.
|
1.163 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.162 | 02-Jul-2023 |
rillig | lint: extend debug logging for declaration levels
Indent the debug logging according to the declaration level.
Since there are a few cases where the enclosing declaration levels are modified, log the whole declaration level stack whenever a level begins or ends.
|
1.161 | 01-Jul-2023 |
rillig | lint: clean up duplicate and dead code for integer constants
No functional change.
|
1.160 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.159 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.158 | 29-Jun-2023 |
rillig | lint: clean up function names
No functional change.
|
1.157 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.156 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.155 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.154 | 11-May-2023 |
rillig | lint: fix type name in diagnostic for enum as controlling expression
Previously, the type was reported as 'int' instead of 'enum'.
Continue to only report the type simple for pointer types, as the exact pointer type is irrelevant to this message.
|
1.153 | 15-Apr-2023 |
rillig | lint: add query for parenthesized return value
|
1.152 | 15-Apr-2023 |
rillig | lint: extract checking the return value to separate function
No functional change.
|
1.151 | 28-Mar-2023 |
rillig | lint: clean up comments for handling 'linted' comments
No functional change.
|
1.150 | 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.149 | 21-Feb-2023 |
rillig | lint: fix null pointer dereference in invalid case expression
|
1.148 | 18-Feb-2023 |
rillig | lint: remove redundant comments
|
1.147 | 29-Jan-2023 |
rillig | lint: properly clean up when leaving a function definition
|
1.146 | 29-Jan-2023 |
rillig | lint: rename functions for function definition
No functional change.
|
1.145 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.144 | 28-Aug-2022 |
rillig | lint: inline previous_declaration for nonconstant message IDs
This adds back the compile-time printf validation in debug mode that was missing before.
|
1.143 | 03-Jul-2022 |
rillig | lint: verify that comment above warning_at matches the message
No binary change.
|
1.142 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.141 | 20-Jun-2022 |
rillig | lint: add quotes around several placeholders in messages
|
1.140 | 15-Jun-2022 |
rillig | lint: rename mod_t.m_requires_bool to m_compares_with_zero
The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict bool mode, in default mode they accept any scalar expression and compare it with zero. The new names are more accurate.
No functional change.
|
1.139 | 11-Jun-2022 |
rillig | lint: add quotes around placeholders for a few more messages
|
1.138 | 26-May-2022 |
rillig | lint: rename olwarn and LWARN_BAD to be more expressive
No functional change.
|
1.137 | 22-May-2022 |
rillig | lint: fix wrong warning about unhandled enum constants in switch
|
1.136 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.135 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.134 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.133 | 30-Apr-2022 |
rillig | lint: inline macro Sflag in cases of expected behavior
In the grammar rules 'enums_with_opt_comma' and 'block_item_list', checking for allow_c99 was redundant since c99ism does not warn in C99 mode.
In the grammar rule 'designator', align the two actions structurally.
No functional change.
|
1.132 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.131 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.130 | 02-Apr-2022 |
rillig | lint: try harder to recover after syntax errors
lint: assertion "false" failed in declarator_name at decl.c:1596 near msg_022.c:22
|
1.129 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.128 | 27-Feb-2022 |
rillig | lint: unabbreviate some fields in sym_t
No functional change.
|
1.127 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.126 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.125 | 16-Nov-2021 |
rillig | lint: rename attron to in_gcc_attribute
No functional change.
|
1.124 | 04-Sep-2021 |
rillig | lint: remove redundant and duplicate code
|
1.123 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.122 | 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.121 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.120 | 22-Aug-2021 |
rillig | lint: use standard quotes in messages 203 and 271
|
1.119 | 03-Aug-2021 |
rillig | lint: add quotes around placeholder in message 214
function '%s' expects to return value
|
1.118 | 01-Aug-2021 |
rillig | lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault, probably related to the symbol table. To better understand this part, log insertions and deletions.
The other debug log messages do not need to mention the current file position anymore, this is what lex_next_line takes care of since scan.l 1.113 from 2021-01-05.
|
1.117 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.116 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.115 | 23-Jul-2021 |
rillig | lint: rename cstk_t to control_statement
Rename the variables as well. Their previous name 'ci' was not easy to understand, the 'i' may have meant 'stack item'. The new name 'cs' simply means 'control statement'.
No functional change.
|
1.114 | 20-Jul-2021 |
rillig | lint: split 'build' into build_binary and build_unary
No functional change.
|
1.113 | 04-Jul-2021 |
rillig | lint: in strict bool mode, continue after error message
If a controlling expression is not of type bool but of any other scalar type, keep the expression. Its value is still useful for control flow analysis.
This prevents an assertion failure when running lint on the generated scan.c, which contains a "while (1)" that does not stem from a system header. If it did, lint would accept it, see tn_from_system_header. But "scan.c" is not considered a system header. Maybe lint's definition of a system header needs to be revisited.
After fixing this, there is another assertion failure though, so scan.c is not yet ready to be inspected by lint.
|
1.112 | 30-Jun-2021 |
rillig | lint: invert condition in control flow analysis of switch statements
The condition previously contained many negations, which was hard to understand.
No functional change.
|
1.111 | 19-Jun-2021 |
rillig | lint: fix assertion after malformed for loop
Found using afl.
|
1.110 | 19-Jun-2021 |
rillig | lint: fix assertion failure after malformed statement
Found using afl.
|
1.109 | 19-Jun-2021 |
rillig | lint: fix crash in malformed initialization
|
1.108 | 15-May-2021 |
rillig | lint: warn about unreachable case labels for '&&'
See octeon_gmxreg.h 1.2 from 2020-06-18 for an example, where RXN_RX_INBND_SPEED was cleaned up without adjusting the corresponding code in octeon_gmx.c.
|
1.107 | 03-May-2021 |
rillig | branches: 1.107.2; lint: allow variables to be named 'pcs'
|
1.106 | 19-Apr-2021 |
rillig | lint: add debug logging for reachability
|
1.105 | 18-Apr-2021 |
rillig | lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
|
1.104 | 18-Apr-2021 |
rillig | lint: migrate global_clean_up_decl to warning_at
|
1.103 | 10-Apr-2021 |
rillig | lint: prepare renaming of 'struct type'
It's confusing to have the same struct tag in both lint1 and lint2, with mostly the same members, but also some differences. Before actually changing this, I reviewed all occurrences of the word 'type' in the code.
No functional change.
|
1.102 | 02-Apr-2021 |
rillig | lint: rename getopname to op_name
There are several functions called 'get' that allocate memory. Remove this possible confusion.
No functional change.
|
1.101 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.100 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.99 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.98 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.97 | 26-Mar-2021 |
rillig | lint: rename members of struct control_statement to be more expressive
C99 does not define names for the head parts of the 'for' statements, it just calls them clause-1, expression-2 and expression-3. Therefore the rather abstract name 'expr3'.
No functional change.
|
1.96 | 26-Mar-2021 |
rillig | lint: rename pushctrl and popctrl to be more expressive
While here, remove the magic number 0 that in this context means "function body".
No functional change.
|
1.95 | 21-Mar-2021 |
rillig | lint: warn about unreachable statement after joining the 'if' branches
|
1.94 | 21-Mar-2021 |
rillig | lint: invert 'rchflag', call it warn_about_unreachable instead
No functional change.
|
1.93 | 21-Mar-2021 |
rillig | lint: reduce number of places where 'reached' is set
When determining the reachability of a statement, the idea was that whenever 'reached' was set to false, 'rchflg' (the abbreviation for "do not warn about unreachable statements") would be reset as well.
In some (trivial) cases, this was done, but many more interesting cases simply forgot to set this second variable. To prevent this in the future, encapsulate this in a simple helper function.
Now even if a statement is reachable, 'rchflg' gets reset. This does not hurt since as long as the current statement is reachable, the value of 'rchflg' does not matter.
No functional change. There would be quite a big functional change though if check_statement_reachable were to reset 'rchflg' instead of 'reached', as the comment already suggests. In that case, with the current code, many legitimate warnings about unreachable statements would be skipped, especially those involving 'if' statements, since these didn't reset 'rchflg' properly before.
|
1.92 | 21-Mar-2021 |
rillig | lint: fix reachability for while (0)
|
1.91 | 21-Mar-2021 |
rillig | lint: fix reachability for constant controlling expression in for loop
|
1.90 | 21-Mar-2021 |
rillig | lint: fix reachability for if-then-else statements
|
1.89 | 21-Mar-2021 |
rillig | lint: rename functions for handling control statements
No functional change.
|
1.88 | 21-Mar-2021 |
rillig | lint: fix reachability computation in if statements
Previously, only loop statements were considered for reachability. This ignored the possibility of an early return in an if statement, or unreachable branches.
|
1.87 | 21-Mar-2021 |
rillig | lint: rename c_rchif to c_reached_end_of_then
No functional change.
|
1.86 | 21-Mar-2021 |
rillig | lint: document why an unreachable statement is set to reachable
No functional change.
|
1.85 | 21-Mar-2021 |
rillig | lint: rename c_cont to c_continue
No functional change.
|
1.84 | 21-Mar-2021 |
rillig | lint: rename i_infinite to i_maybe_endless
Not every loop that has 'while (1)' is an endless loop. It may still contain a 'return' somewhere.
|
1.83 | 21-Mar-2021 |
rillig | lint: fix wrong 'falls off bottom' after return in do-while
|
1.82 | 21-Mar-2021 |
rillig | lint: remove redundant braces in doreturn
No functional change.
|
1.81 | 21-Mar-2021 |
rillig | lint: rename d_fargs, d_fdpos and d_fpsyms to be less abbreviated
No functional change.
|
1.80 | 21-Mar-2021 |
rillig | lint: rename d_rdcsym to d_redeclared_symbol
No functional change.
|
1.79 | 21-Mar-2021 |
rillig | lint: rename clst to case_labels
No functional change.
|
1.78 | 20-Mar-2021 |
rillig | lint: rename ftflg to seen_fallthrough
One less abbreviation to remember when reading the code.
No functional change.
|
1.77 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.76 | 10-Mar-2021 |
rillig | lint: disable check for enum type mismatch in switch statement
This check has been too quick and broke the lint build. Among others, lib/libpuffs has -w included in LINTFLAGS, which means that the build can fail even for new warnings, not only for errors.
libpuffs compares a uint16_t with constants from an unnamed enum type. Since the enum type is completely unnamed (neither a tag nor a typedef), there is no way to define a struct member having this type. This was a scenario that I just didn't consider when I added the check to lint.
For now, disable the new check completely. The previously existing lint checks stay enabled, including the one that warns about mismatched anonymous enum types in the '==' operator, which is very similar to the now disabled check.
|
1.75 | 05-Mar-2021 |
rillig | lint: warn about enum/enum or enum/int type mismatch in switch
This is something that neither GCC 10 nor Clang 8 do, even though it seems useful. Lint didn't do it up to now, but that was probably an oversight since it is easy to miss the implicit '==' operator in the switch statement.
|
1.74 | 28-Feb-2021 |
rillig | lint: rename is_nonzero to constant_is_nonzero
The new function name emphasizes that the given node must have the operator CON.
No functional change.
|
1.73 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.72 | 21-Feb-2021 |
rillig | lint: fix wrong warning about main falling off the bottom in C99 mode
This gets lint a small step closer to implementing C99.
|
1.71 | 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.70 | 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.69 | 19-Feb-2021 |
rillig | lint: replace cryptic sym.s_rimpl with expressive name
No functional change.
|
1.68 | 19-Feb-2021 |
rillig | lint: warn about mismatch in getopt handling
|
1.67 | 31-Jan-2021 |
rillig | lint: don't warn about constant condition in 'do { } while (0)'
|
1.66 | 30-Jan-2021 |
rillig | lint: rename incompl to is_incomplete
No functional change.
|
1.65 | 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.64 | 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.63 | 18-Jan-2021 |
rillig | lint: clean up member names of control_structure and comments
|
1.62 | 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.61 | 17-Jan-2021 |
rillig | lint: fix type mismatch for strict bool mode
No functional change.
|
1.60 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.59 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.58 | 15-Jan-2021 |
rillig | lint: merge duplicate code for non-zero detection
|
1.57 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.56 | 10-Jan-2021 |
rillig | lint: rename cvtcon to convert_constant
No functional change.
|
1.55 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.54 | 09-Jan-2021 |
rillig | lint: expand abbreviations in grammar rules
stmnt -> statement comp -> compound
The abbreviation "stmnt" was non-standard, and "comp" was ambiguous since it is used for "comparison" as well.
|
1.53 | 08-Jan-2021 |
rillig | lint: fix function as controlling expression (since 2020-12-31)
It's perfectly valid to directly use a function name as the controlling expression of an if statement. That function name is converted implicitly to a pointer to that function, and that is a scalar value then.
Spotted by christos in lib/libpthread/pthread.c:634.
|
1.52 | 08-Jan-2021 |
rillig | lint: demonstrate wrong message 204 (since 2020-12-31)
In func.c 1.39 from 2020-12-31 18:51:28, the check that controlling expressions are indeed scalar was extended from while and for loops to if statements as well. It just seemed to have been an oversight.
This revealed a bug in lint, which didn't accept the following valid code snippet from lib/libpthread/pthread.c:634:
void _malloc_thread_cleanup(void) __weak; ... if (_malloc_thread_cleanup) _malloc_thread_cleanup();
Testing a function (instead of a function pointer) for truthiness is probably rare since most functions are defined unconditionally. For weak functions it comes in handy though.
Clang-Tidy suggests to prefix the function with '&' to silence its warning. Doing that revealed a non-obvious behavior in build_ampersand, which does not add the AMPER node to the expression even though it is clearly mentioned in the code. That is left for further research.
Once the original bug is fixed, it probably doesn't matter whether the AMPER is discarded or retained since check_controlling_expression would add it back. There's probably a reason though to sometimes discard the AMPER and sometimes retain it.
|
1.51 | 05-Jan-2021 |
rillig | lint: clean up comments
|
1.50 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.49 | 03-Jan-2021 |
rillig | lint: rename prflstrg to printflike_argnum, likewise for scflstrg
|
1.48 | 03-Jan-2021 |
rillig | lint: rename cstk to cstmt
Most of the code that deals with control statements is only interested in the innermost control statement, and not if that is a stack or not. Therefore, emphasize that part in the variable name.
The member c_next was confusing since the "direction" of this "next element" was ambiguous. In a sequence of if statements, the "next" element could have equally been the following one, not the surrounding one.
|
1.47 | 02-Jan-2021 |
rillig | lint: convert bitfieldtype_ok from int to bool
No functional change intended, except for the output in debug mode.
|
1.46 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.45 | 01-Jan-2021 |
rillig | lint: complete message 203 for case labels
|
1.44 | 01-Jan-2021 |
rillig | lint: rename tokens for left and right parentheses
|
1.43 | 01-Jan-2021 |
rillig | lint: extract main part of case_label into separate function
|
1.42 | 01-Jan-2021 |
rillig | lint: split label handling into separate functions
The only thing these cases have in common is the name "label" and the "reached = 1" assignment. That's not reason enough to combine completely unrelated functions.
|
1.41 | 01-Jan-2021 |
rillig | lint: replace some more LERROR with lint_assert
|
1.40 | 01-Jan-2021 |
rillig | lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format strings from the actual arguments prevents the compiler from cross-checking them.
|
1.39 | 31-Dec-2020 |
rillig | lint: check that in "if (cond)", cond is scalar
|
1.38 | 30-Dec-2020 |
rillig | lint: split cluparg into separate functions
That function did more than its short name could express, and the things it did were not related in any way.
|
1.37 | 30-Dec-2020 |
rillig | lint: spell check comments
|
1.36 | 30-Dec-2020 |
rillig | lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
|
1.35 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.34 | 30-Dec-2020 |
rillig | lint: rename remaining _nxt members to _next
|
1.33 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.32 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.31 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.30 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.29 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.28 | 28-Dec-2020 |
rillig | lint: spell check
|
1.27 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.26 | 19-Aug-2016 |
christos | be less aggressive in clearing blocks to protect against:
int main(int argc, char *argv[]) { int rv;
if ((rv = ({ int _ret = 1; if (argc == 1) {} _ret; })) != 0) printf("%d\n", rv); return 0; }
|
1.25 | 19-Apr-2013 |
christos | Allow linted comments to take an argument that defines which error to suppress.
|
1.24 | 16-Nov-2008 |
dholland | branches: 1.24.8; 1.24.14; WARNS=4
|
1.23 | 25-Jul-2008 |
dsl | 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!
|
1.22 | 24-Sep-2005 |
perry | branches: 1.22.22; in several comments: implizit -> implicit explizit -> explicit
|
1.21 | 20-Jun-2004 |
jmc | 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
|
1.20 | 23-Oct-2002 |
christos | branches: 1.20.2; forgot to commit those.
|
1.19 | 22-Oct-2002 |
christos | add variable array dimension.
|
1.18 | 13-Sep-2002 |
christos | 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.
|
1.17 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.16 | 03-Jan-2002 |
thorpej | * 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.
|
1.15 | 21-Nov-2001 |
wiz | Explicitly write explicitly without a second e.
|
1.14 | 28-May-2001 |
lukem | 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.
|
1.13 | 24-May-2001 |
lukem | minor whitespace/knf
|
1.12 | 23-Nov-1998 |
christos | 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.
|
1.11 | 10-Oct-1998 |
itohy | Eliminate memory leaks at case labels.
|
1.10 | 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.9 | 07-Apr-1998 |
tv | Fix __RCSID() macro
|
1.8 | 22-Feb-1998 |
christos | WARNSify
|
1.7 | 02-Oct-1995 |
jpo | don't print warnings about unused variables or arguments in compound statements which contain asm statements.
|
1.6 | 02-Oct-1995 |
jpo | 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.
|
1.5 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.4 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.3 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.20.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.21 (requested by jmc in ticket #527): 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
|
1.22.22.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.24.14.1 | 23-Jun-2013 |
tls | resync from head
|
1.24.8.1 | 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.107.2.1 | 31-May-2021 |
cjep | sync with head
|
1.187.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.2 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.1 | 03-Jan-2002 |
thorpej | * 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.
|
1.275 | 11-Jul-2025 |
rillig | lint: fix warning about enum array index
Seen in openssh/fmt_scaled.c, scale_chars.
|
1.274 | 04-May-2025 |
rillig | lint: add more details to message about discarding qualifiers
The name of the function (or, if not available, its type) is useful in lines that contain more than one function call.
|
1.273 | 12-Apr-2025 |
rillig | lint: reword messages that apply to traditional C
|
1.272 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.271 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.270 | 29-Aug-2024 |
rillig | lint: support GCC's __auto_type
Fixes PR toolchain/58654.
|
1.269 | 09-May-2024 |
rillig | branches: 1.269.2; lint: add details to message about too many initializers
|
1.268 | 30-Mar-2024 |
rillig | lint: do not convert array subscripts from size_t to ptrdiff_t
The C standards do not specify a fixed type for an array subscript, it just has to be an integer type. Previously, query 4 fired for the ubiquitous expression 'ptr[sz]' when sz had type 'size_t'.
The test platform_ilp32_long is unaffected by this change, as the integer constant 0x80000000 has type 'unsigned int', while size_t is 'unsigned long' on those platforms, and even though the types 'unsigned int' and 'unsigned long' have the same value space, there's still a conversion, at least for now.
|
1.267 | 30-Mar-2024 |
rillig | lint: reword messages about array subscripts to sound more natural
|
1.266 | 29-Mar-2024 |
rillig | lint: clean up
|
1.265 | 29-Mar-2024 |
rillig | lint: fix wording of warning about bit-field initializer
|
1.264 | 27-Mar-2024 |
rillig | lint: don't use 'long' in diagnostics
The size of 'long' differs between 64-bit and 32-bit platforms. Eliminate this possible platform-dependency.
|
1.263 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.262 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.261 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.260 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.259 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.258 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.257 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.256 | 13-Jan-2024 |
rillig | lint: clean up grammar for initializers
|
1.255 | 11-Jan-2024 |
rillig | lint: clean up enum constants for designators
In intializers and offsetof, both struct and union members are handled in the same way, thus there is no need to distinguish them.
|
1.254 | 09-Jan-2024 |
rillig | lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not identifiers but designator sequences, such as in 'offsetof(struct stat, st_atim.tv_sec)', so make lint accept them as well.
|
1.253 | 10-Dec-2023 |
rillig | lint: clean up comments
No functional change.
|
1.252 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.251 | 02-Dec-2023 |
rillig | lint: remove redundant empty lines
No functional change.
|
1.250 | 30-Jul-2023 |
rillig | lint: in debug mode, default to indenting the debug log
Only the 'parsing' lines are not indented, as line breaks are independent from the structure of the code.
|
1.249 | 21-Jul-2023 |
rillig | lint: reword message about non-constant initializer
|
1.248 | 15-Jul-2023 |
rillig | lint: clean up duplicate code for finding struct/union members
|
1.247 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.246 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.245 | 10-Jul-2023 |
rillig | lint: clean up wchar_t and hash tables
|
1.244 | 01-Jul-2023 |
rillig | lint: fix initialization of unnamed union member
|
1.243 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.242 | 22-May-2023 |
rillig | lint: fix emitted type for arrays of unknown size
|
1.241 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.240 | 06-Feb-2023 |
rillig | lint: eliminate unnecessary indirection
No functional change.
|
1.239 | 06-Feb-2023 |
rillig | lint: condense code for handling initializations
Remove the assertion for a non-null initialization, as each code path immediately dereferences it.
No functional change.
|
1.238 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.237 | 28-Aug-2022 |
rillig | lint: clean up visual clutter
No functional change.
|
1.236 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.235 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.234 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.233 | 02-Apr-2022 |
rillig | lint: clean up style
Remove outdated ARGSUSED (the one in tree.c had been wrong since 1995), remove unused argument.
No functional change.
|
1.232 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in function names
No functional change.
|
1.231 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.230 | 22-Dec-2021 |
rillig | lint: clean up initialization
No functional change.
|
1.229 | 22-Dec-2021 |
rillig | lint: fix handling of initializations
The implementation from March 2021 added proper support for designators but didn't model the brace levels correctly. In particular, it could not handle additional braces or omitted braces. In such a case, lint skipped the remaining initializers from the initialization. Due to this, type errors in the remaining initializers went unnoticed. Another effect was that arrays of unknown size were wrongly reported as having size 0.
Both GCC and Clang recommend placing braces around each sub-type that is initialized, such as a struct, union or array. Postfix does not follow these recommendations, therefore lint had to be disabled in external/ibm-public/postfix/Makefile.inc. This commit fixes the bugs mentioned there.
|
1.228 | 21-Dec-2021 |
rillig | lint: reword message 187 about too long string literal for initializer
The previous message was imprecise in that it didn't distinguish between non-terminating and terminating null bytes.
|
1.227 | 21-Dec-2021 |
rillig | lint: treat incomplete union in the same way as incomplete struct
The newly added tests triggered the assertion in begin_designation since for incomplete types the initialization is stopped before handling the first brace.
|
1.226 | 21-Dec-2021 |
rillig | lint: rename debug_indent to debug_print_indent
The previous name could be mistaken to mean "increase the indentation of the debug output". Instead, the function prints the current indentation.
In externs1.h, the macro definition was a duplicate, the macros were sorted differently than the functions a few lines above.
No binary change.
|
1.225 | 21-Dec-2021 |
rillig | lint: make function names a bit more concise
No binary change.
|
1.224 | 21-Dec-2021 |
rillig | lint: rename parameters in check_init_expr
An initialization has a left-hand and a right-hand side, reflect this in the parameter names to avoid confusion.
No binary change.
|
1.223 | 20-Dec-2021 |
rillig | lint: add grammar rule for the beginning of a designation
This will be necessary to properly implement handling of initializers and braced initializer-lists.
No functional change for now since the designation is already reset after each expression and '}'. To handle initializations properly, the designation must not be reset after each expression, it must advance to the next member instead.
|
1.222 | 19-Dec-2021 |
rillig | lint: split local variable in initialization_end_brace_level
No functional change.
|
1.221 | 19-Dec-2021 |
rillig | lint: add typedef for types in initializations
No binary change except for line numbers in assertions.
|
1.220 | 18-Dec-2021 |
rillig | lint: document wrong data structures for modelling initializations
No functional change.
|
1.219 | 18-Dec-2021 |
rillig | lint: move maximum seen subscript from brace level to initialization
There is no need to store this information at every brace level since in any translation unit that survives a conforming C99 compiler, an array of unknown size is only possible once per initialization, not once per brace level.
|
1.218 | 18-Dec-2021 |
rillig | lint: use vector instead of list for designation in initialization
This change is a prerequisite for fixing the current bugs in handling initializations. Part of the fix will be designation_pop, which is costly for a singly linked list.
As a side benefit, memory management becomes simpler and needs fewer malloc calls.
No functional change.
|
1.217 | 17-Dec-2021 |
rillig | lint: reduce code for beginning an initialization
No functional change.
|
1.216 | 17-Dec-2021 |
rillig | lint: inline sub-cases of brace_level_sub_type
Having the code in separate functions did not add to the clarity of the code. The additional information from the function names can be grasped as easily from the case labels.
No functional change.
|
1.215 | 17-Dec-2021 |
rillig | lint: fix initialization with few braces from function
Seen in Postfix, smtp_proto.c.
|
1.214 | 17-Dec-2021 |
rillig | lint: fix initialization of array with fewer braces
Seen in Postfix, cleanup_strerror.c.
|
1.213 | 17-Dec-2021 |
rillig | lint: work around lint bug in initialization with few braces
Needs a proper fix later, but for now, this workaround allows to run lint on Postfix again.
|
1.212 | 17-Dec-2021 |
rillig | lint: rename is_string_array to is_character_array
The old name was too confusing.
No functional change.
|
1.211 | 16-Dec-2021 |
rillig | lint: narrow down parameter of build_name
Passing an arbitrary tokenizer symbol left too much freedom and uncertainty to the caller, and 0 was a magic number in this context.
No functional change.
|
1.210 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.209 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.208 | 14-Aug-2021 |
rillig | lint: allow initialization of struct with constant member
The operator INIT, just like RETURN and FARG, initializes an object with an expression. The target object of such an initialization may be a struct with constant members.
The operator ASSIGN, on the other hand, is entirely different. It overwrites the existing value of the object, and this is not allowed for structs that have a constant member. Therefore it was wrong to use the operator ASSIGN for initialization.
|
1.207 | 10-Aug-2021 |
rillig | lint: fix 3 of the 4 wrong messages about lvalue in initial assignment
|
1.206 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.205 | 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.204 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.203 | 20-Jul-2021 |
rillig | lint: use consistent naming scheme for functions that build nodes
No functional change.
|
1.202 | 20-Jul-2021 |
rillig | lint: split 'build' into build_binary and build_unary
No functional change.
|
1.201 | 02-Jul-2021 |
rillig | lint: fix initialization of array of unknown size
The size of the resulting array was computed wrong.
|
1.200 | 29-Jun-2021 |
rillig | lint: do not modify tnode_t->tn_type in check_init_expr
This is a very small step towards having all shared type_t objects only referenced via const pointers. Since the types may be shared, it is a bad idea to try to modify them, so better let the compiler check this. It's a long way to reach this goal, but this small step is already possible.
No functional change.
|
1.199 | 19-Jun-2021 |
rillig | lint: replace undefined behavior with assertion failure
Triggered by this malformed code:
struct{int;
|
1.198 | 18-Apr-2021 |
rillig | lint: extend documentation about handling initializations
|
1.197 | 18-Apr-2021 |
rillig | lint: remove redundant test for tflag in initialization handling
|
1.196 | 18-Apr-2021 |
rillig | lint: fix storage class of compound literal in initializer
A compound literal that occurs at block_level 0 does not have storage class AUTO. Instead, its storage class is either EXTERN or STATIC.
While removing the temporary objects from the symbol table had prevented the assertion, it did not properly fix the underlying problem, which was that since C99 the initializers can contain references to unnamed objects that are created on-the-fly. For C90 it was correct to always use AUTO as the storage class of a temporary symbol.
|
1.195 | 17-Apr-2021 |
rillig | lint: fix assertion failure for temporary objects in initialization
|
1.194 | 09-Apr-2021 |
rillig | lint: fix initialization with brace-enclosed string literal
C99 allows this form in 6.7.8p14 and p15.
The previous lint tests did not cover the case of an array at the top level of the object to be initialized, they only covered the error cases (d_c99_init.c, variables 'prefixed_message' and 'message_with_suffix').
Lint is now more generous than strictly required by C99, but since GCC and Clang already cover the case of 'message_with_suffix', this is ok.
The test d_init_array_using_string.c was wrong before in rejecting the initializer for 'extra_braces'. I had tested that Clang generated a warning for this, but I had not inspected its warning carefully enough. Clang had not warned about the extra braces but only about a type mismatch since I tested on a platform where wchar_t was 16 bit.
|
1.193 | 02-Apr-2021 |
rillig | lint: reorder struct members to be in comprehension order
No functional change.
|
1.192 | 02-Apr-2021 |
rillig | lint: rename members of brace_level
The terms 'member' and 'subscript' are distinctive enough.
No functional change.
|
1.191 | 02-Apr-2021 |
rillig | lint: remove unused brace_level.bl_array_of_unknown_size
Since init.c 1.177 from 2021-03-29, the type of the object to be initialized is no longer modified in the middle of the initialization, as required by C99 6.7.8p22. Therefore it is no longer necessary to keep this redundant information around.
No functional change.
|
1.190 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.189 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.188 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.187 | 02-Apr-2021 |
rillig | lint: rename mbl to memory_block
No functional change.
|
1.186 | 02-Apr-2021 |
rillig | lint: make debug logging compatible with C90
The previous code used the GCC-style varargs macros, which did not even conform to C99.
No functional change.
|
1.185 | 01-Apr-2021 |
rillig | lint: do not error out of a struct is initialized without braces
This allows to process lib/libc/gen/sysctl.c 1.38 from 2021-03-30, as well as its precedessor 1.37, which had a workaround just for lint.
While unusual, C99 allows these.
|
1.184 | 30-Mar-2021 |
rillig | lint: clean up duplicate code in handling of initialization
No functional change.
|
1.183 | 30-Mar-2021 |
rillig | lint: add error about out-of-bounds array subscripts
This check is not strictly necessary since any C99 compiler must diagnose them as well, it is rather meant for demonstrating how to do the check in lint, and for symmetry with the 'unknown member' error message. These provide insight into how the data structures in init.c are meant to be accessed.
|
1.182 | 30-Mar-2021 |
rillig | lint: add type information for message about unknown member name
|
1.181 | 30-Mar-2021 |
rillig | lint: reword message for very unlikely .member in array initialization
|
1.180 | 30-Mar-2021 |
rillig | lint: add type information to message 175
|
1.179 | 30-Mar-2021 |
rillig | lint: rewrite handling of initializations, fixing several bugs
The previous implementation had a wrong model of how initialization happens in C99, its assertions failed in all kind of edge cases and it was not possible to fix the remaining bugs one at a time without running into even more obscure assertion failures.
The debug logging was detailed but did not help to clarify the situation. After about 20 failed attempts at fixing the small details I decided to start all over and rewrite the initialization code from scratch. I left the low-level parts of handling designators, the code that is independent of brace_level and the high-level parts of how the parser calls into this module. Everything else is completely new.
The concept of a brace level stays since that is how C99 describes initialization. The previous code could not handle multi-level designations (see d_init_pop_member.c). There are no more assertion failures in the initialization code.
Some TODO comments have been left in the tests to keep the line numbers the same in this commit. These will be cleaned up in a follow-up commit.
The new implementation does not handle initialization with "missing" braces. This is an edge case that both GCC and Clang warn about, so it is not widely used. If necessary, it may be added later.
The new implementation does not use any global variables in the vast majority of the functions, to make all dependencies and possible modifications obvious.
|
1.178 | 29-Mar-2021 |
rillig | lint: rename variable 'level' to 'bl'
For consistency with its type prefix and the other variables. This variable is used so often that it makes sense to abbreviate it.
No functional change.
|
1.177 | 29-Mar-2021 |
rillig | lint: add helper functions
No functional change.
|
1.176 | 29-Mar-2021 |
rillig | lint: rename struct members in init.c
No functional change.
|
1.175 | 29-Mar-2021 |
rillig | lint: remove outdated comments, clean up style
No functional change.
|
1.174 | 28-Mar-2021 |
rillig | lint: add assertions for aggregate initialization
No functional change.
|
1.173 | 28-Mar-2021 |
rillig | lint: add test for assertion failure in initialization
The 'cnt = level->bl_type->t_tspec == STRUCT ? 2 : 1;' in initialization_push_struct_or_union is obviously wrong since not every struct has exactly 1 remaining member after the first member that has an initializer with designation.
This bug started its life in init.c 1.12 from 2002-10-21, a little over 18 years ago.
|
1.172 | 28-Mar-2021 |
rillig | lint: split complicated function for looking up struct members
No functional change.
|
1.171 | 28-Mar-2021 |
rillig | lint: inline variable in initialization_init_array_using_string
No functional change.
|
1.170 | 28-Mar-2021 |
rillig | lint: clean up initialization_init_array_using_string
No functional change.
|
1.169 | 28-Mar-2021 |
rillig | lint: clean up initialization_expr
No functional change.
|
1.168 | 28-Mar-2021 |
rillig | lint: extract duplicate code to is_string_array
No functional change.
|
1.167 | 28-Mar-2021 |
rillig | lint: add is_struct_or_union
No functional change.
|
1.166 | 28-Mar-2021 |
rillig | lint: extract brace_level_subtype
No functional change.
|
1.165 | 28-Mar-2021 |
rillig | lint: extract initialization_end_brace_level
No functional change.
|
1.164 | 28-Mar-2021 |
rillig | lint: extract check_no_auto_aggregate
No functional change.
|
1.163 | 28-Mar-2021 |
rillig | lint: clean up type handling in initialization
No functional change.
|
1.162 | 28-Mar-2021 |
rillig | lint: remove wrong warning about wrong initializer type
The following code is valid:
int valid = {{{ 3 }}};
C90 3.5.7 and C99 6.7.8 both say that the "initializer for a scalar shall be a single expression, optionally enclosed in braces". They don't put any upper bound on the amount of braces, not even in the "Translation limits" section.
|
1.161 | 28-Mar-2021 |
rillig | lint: sprinkle const on function declarations
No functional change.
|
1.160 | 28-Mar-2021 |
rillig | lint: move code for extending an array of unknown size further up
No functional change.
|
1.159 | 28-Mar-2021 |
rillig | lint: move code for checking init expressions further up
It did not make sense to have this code between the code for the designation and the brace level. Since it is independent of all these types, move it to the top.
No functional change.
|
1.158 | 28-Mar-2021 |
rillig | lint: group functions according to their main object
No functional change.
|
1.157 | 28-Mar-2021 |
rillig | lint: rename public designator functions
Their previous names were too similar to the actual implementation functions, which was confusing.
No functional change.
|
1.156 | 28-Mar-2021 |
rillig | lint: inline initsym
No functional change.
|
1.155 | 28-Mar-2021 |
rillig | lint: replace initstack_push_array with brace_level_push_array
The designator is no longer logged at this point because it is irrelevant.
No functional change.
|
1.154 | 28-Mar-2021 |
rillig | lint: clean up debug logging, use consistent variable names
No functional change.
|
1.153 | 28-Mar-2021 |
rillig | lint: omit unnecessary calls to current_init
No functional change.
|
1.152 | 28-Mar-2021 |
rillig | lint: move brace level functions further up
No functional change.
|
1.151 | 28-Mar-2021 |
rillig | lint: clean up debug logging for initialization
No functional change.
|
1.150 | 28-Mar-2021 |
rillig | lint: inline initerr in code for handling initializations
No functional change.
|
1.149 | 28-Mar-2021 |
rillig | lint: inline brace level in initialization
No functional change.
|
1.148 | 28-Mar-2021 |
rillig | lint: replace global variables with function parameters
No functional change.
|
1.147 | 28-Mar-2021 |
rillig | lint: move more functions to the global-variables-free section
No functional change.
|
1.146 | 28-Mar-2021 |
rillig | lint: reorder code for handling initializations
First the primitives for debug logging, then the functions that do not access any global variables, finally everything else.
No functional change.
|
1.145 | 28-Mar-2021 |
rillig | lint: move debug primitives to the top of the code
No functional change.
|
1.144 | 27-Mar-2021 |
rillig | lint: extract brace_level_next_member from initstack_pop_item_unnamed
No functional change.
|
1.143 | 27-Mar-2021 |
rillig | lint: extract brace level code into separate functions
No functional change.
|
1.142 | 27-Mar-2021 |
rillig | lint: prepare support for adding array designators
No functional change.
|
1.141 | 27-Mar-2021 |
rillig | lint: add function for setting the initialization error
No functional change.
|
1.140 | 27-Mar-2021 |
rillig | lint: remove unnecessary typedefs
No functional change.
|
1.139 | 27-Mar-2021 |
rillig | lint: rename initstack_element to brace_level
No functional change.
|
1.138 | 27-Mar-2021 |
rillig | lint: extract look_up_member from initstack_push_struct_or_union
No functional change.
|
1.137 | 27-Mar-2021 |
rillig | lint: clean up initstack_pop_item_named_member
Previously, the code accessed the global variable for the designator several times, even though the designator cannot change during this part of the code. Make this obvious by passing this designator as a parameter instead.
No functional change.
|
1.136 | 27-Mar-2021 |
rillig | lint: fix and update comments about initialization
|
1.135 | 27-Mar-2021 |
rillig | lint: merge duplicate code in initialization
No functional change.
|
1.134 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.133 | 25-Mar-2021 |
rillig | lint: fix initialization for arrays with designators
From the previous commit, there was an off-by-one error left, which was due to the interaction between designation_add_subscript and extend_if_array_of_unknown_size.
The other crucial point was to call initstack_pop_nobrace before accessing the "current initialization stack element". Without this call, in msg_168.c the "current element" would point to the initializer level for 'const char *' instead of the one for 'array of const char *'.
One more step towards supporting C99.
|
1.132 | 25-Mar-2021 |
rillig | lint: improve initialization of arrays with designators
Initialization is still buggy but better than before. The remaining bug is that only the first designator determines the array size, and after that, the array is no longer considered of unknown size. This contradicts C99. More improvements to come.
|
1.131 | 25-Mar-2021 |
rillig | lint: fix names of functions dealing with designations
These functions modify the whole designation, not only a single designator.
No functional change.
|
1.130 | 25-Mar-2021 |
rillig | lint: free the designator as soon as it is no longer needed
One of the latest "refactorings" introduced a small and practically unimportant memory leak. If the last initializer in an initialization had a designator, that designator was not freed.
When the "current initialization" was still a global variable with unlimited lifetime, it was freed at the beginning of the next initialization. After the refactorings, this "next initialization" could no longer see anything from the previous initialization since all references have been cleaned up at that point. Freeing the memory so late and in an almost totally unrelated place was a bad idea anyway.
|
1.129 | 25-Mar-2021 |
rillig | lint: distinguish between read and write access to initstk
There are far too many places that modify the top element of the initializer stack. Each of these places should get its own logging, as long as the code is still complicated. These places are now clearly marked with initstk_lvalue.
No functional change.
|
1.128 | 25-Mar-2021 |
rillig | lint: replace namlist with designation and designator
This makes it possible to accurately model C99 initializers, including their optional designators. Previously, array subscripts had not been modeled at all.
In the previous commit, debug_designation crashed immediately since I had not run the code in debug mode even once. The condition 'name != head' was a left-over from the old times where the designator was still a circular list.
No functional change outside debug mode.
|
1.127 | 25-Mar-2021 |
rillig | lint: remove over-engineered doubly-linked circular list
The designation only needs to be navigated from head to tail, not the other way round.
No functional change.
|
1.126 | 25-Mar-2021 |
rillig | lint: rename debug_named_member to debug_designation
No functional change outside debug mode.
|
1.125 | 25-Mar-2021 |
rillig | lint: rename i_current_object to i_next_member
No functional change outside debug mode.
|
1.124 | 25-Mar-2021 |
rillig | lint: rename the few remaining instances of 'namedmem'
No functional change.
|
1.123 | 25-Mar-2021 |
rillig | lint: split current_namedmem into lvalue and rvalue form, rename them
This is a small step towards using the terminology from C99.
No functional change.
|
1.122 | 25-Mar-2021 |
rillig | lint: inline macro 'namedmem' for C99 designators
No functional change.
|
1.121 | 25-Mar-2021 |
rillig | lint: free memory at the end of an initialization
No functional change, just more clarity in the code.
|
1.120 | 25-Mar-2021 |
rillig | lint: condense debug output for initializations
This way it does not look more impressive than it really is.
No functional change outside debug mode.
|
1.119 | 25-Mar-2021 |
rillig | lint: add comments about things left to do, from code review
No functional change.
|
1.118 | 25-Mar-2021 |
rillig | lint: fix C99 initialization with expression of type 'struct'
This has been a long-standing limitation of lint. Now it is almost ready for C99, see the list of "major changes" in the foreword of C99.
One known remaining bug in the area of initialization is designators with several levels, such as '.member[2].member.member'. Oh, and designators for arrays are only supported in the parser but not in the type checker. There's still some work to do.
|
1.117 | 25-Mar-2021 |
rillig | lint: remove outdated comment from init_using_expr
Since C99, an aggregate type can be initialized without braces.
No functional change.
|
1.116 | 25-Mar-2021 |
rillig | lint: extract check_init_expr from init_using_expr
No functional change.
|
1.115 | 23-Mar-2021 |
rillig | lint: fix wrong warning about initialization using string literal
Missing braces after 'if', since init.c 1.68 from 2021-02-20.
GCC 10 doesn't complain about this even with -Wmisleading-indentation since at least one of the involved lines is a macro invocation (in this case both lines). GCC 11 will warn about this.
Clang warns about this, but the regular Clang build currently fails for other reasons, so this problem didn't show up there either.
|
1.114 | 23-Mar-2021 |
rillig | lint: extract init_using_assign from init_using_expr
No functional change.
|
1.113 | 23-Mar-2021 |
rillig | lint: merge duplicate code in init_using_expr
No functional change.
|
1.112 | 23-Mar-2021 |
rillig | lint: fix documentation about optional braces in initializers
|
1.111 | 23-Mar-2021 |
rillig | lint: fix wrong error message about type mismatch in compound literal
Now that the code contains explicit markers for starting and ending an initialization, and having the guarantee that an assertion fails whenever some code accesses the state of the "current initialization" even though there is no ongoing initialization gives me much more confidence in the correctness of the code. The calls to begin_initialization and end_initialization always appear in pairs, enclosing the minimal amount of code necessary for initialization.
In a nutshell, global modifiable state is error-prone and hard to understand.
A nice side effect is that the grammar no longer needs a special rule for the outermost initializer since the functions for the debug logging are now called explicitly.
The code that misuses the initialization state just because it needs to temporarily store a sym_t somewhere is now clearly marked as such. A GCC statement expression can appear anywhere and is therefore independent of the initialization. Most probably the code can simply refer to the local variable in the grammar rule itself, or this variable needs to be encoded in the grammar %union. For sure there is a better way to handle this.
There is no longer a need that the function 'declare' initializes the initialization state, it was just the wrong place to do this.
|
1.110 | 23-Mar-2021 |
rillig | lint: add indirection for accessing the current initialization
This indirection will be needed to handle nested initializations, which are a new feature of C99. These are currently not handled correctly, see msg_171.c.
No functional change.
|
1.109 | 22-Mar-2021 |
rillig | lint: reduce visibility of variables for initializations
No functional change.
|
1.108 | 20-Mar-2021 |
rillig | lint: fix assertion failure after error in designation
In d_c99_init.c, the initialization of array_with_designator failed. The designator '.member' from that initialization was not cleaned up before starting the next initialization.
|
1.107 | 20-Mar-2021 |
rillig | lint: replace segmentation fault with assertion failure
|
1.106 | 19-Mar-2021 |
rillig | lint: improve debug loggin for initialization
|
1.105 | 19-Mar-2021 |
rillig | lint: rename designator_pop_name to designator_shift_name
The entries are removed from the beginning, not from the end.
No functional change.
|
1.104 | 19-Mar-2021 |
rillig | lint: replace assertion in initialization with proper error message
|
1.103 | 19-Mar-2021 |
rillig | lint: rename push_member and pop_member
These two functions are supposed to model the designator that is used for initializing structs and arrays. The implementation is still buggy and does not work at all for C99 designators with multiple names, see d_init_pop_member.c.
For now, just rename the functions to head in the right direction.
No functional change.
|
1.102 | 19-Mar-2021 |
rillig | lint: extend documentation about initialization
No functional change.
|
1.101 | 19-Mar-2021 |
rillig | lint: split initstack_pop_item into separate functions
No functional change.
|
1.100 | 19-Mar-2021 |
rillig | lint: improve debug logging in initstack_push
No functional change outside debug mode.
|
1.99 | 18-Mar-2021 |
rillig | lint: split initstack_push into smaller functions
No functional change.
|
1.98 | 18-Mar-2021 |
rillig | lint: clean up control flow in initstack_push
No functional change.
|
1.97 | 18-Mar-2021 |
rillig | lint: extract extend_if_array_of_unknown_size from initstack_push
No functional change.
|
1.96 | 18-Mar-2021 |
rillig | lint: replace undefined behavior during initialization with assertion
This only affects code that is already rejected by the compiler.
|
1.95 | 18-Mar-2021 |
rillig | lint: improve debug logging during initialization
No functional change outside debug mode.
|
1.94 | 18-Mar-2021 |
rillig | lint: reduce debug logging for initialization, update documentation
No functional change outside debug mode.
|
1.93 | 18-Mar-2021 |
rillig | lint: document how initialization works, improve debug logging
No functional change outside debug mode.
|
1.92 | 18-Mar-2021 |
rillig | lint: document the initialization of an object in more detail
This will help fixing the bugs that are currently demonstrated in msg_168.c and d_struct_init_nested.c.
|
1.91 | 17-Mar-2021 |
rillig | lint: add debug logging for C99-style initialization of arrays
No functional change outside debug mode.
|
1.90 | 17-Mar-2021 |
rillig | lint: move debug logging for the designator to the top of the code
The debugging code is needed by the soon-to-be-added proper handling of array subscript initializers such as '.member[123].member = 12345'.
No functional change.
|
1.89 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.88 | 22-Feb-2021 |
rillig | lint: improve debug message and comment
|
1.87 | 21-Feb-2021 |
rillig | lint: extract check_non_constant_initializer from init_using_expr
No functional change.
|
1.86 | 21-Feb-2021 |
rillig | lint: extract check_bit_field_init from init_using_expr
No functional change.
|
1.85 | 21-Feb-2021 |
rillig | lint: add debug logging for initializing an array of unknown size
It is possible that the type name 'array[unknown_size]' may spill into the user-visible diagnostics. The current test suite does not cover such a case. Anyway, saying 'array[unknown_size]' is still better than saying 'array[0]', which would be misleading.
|
1.84 | 21-Feb-2021 |
rillig | lint: rename and condense initstack_check_too_many
No functional change.
|
1.83 | 21-Feb-2021 |
rillig | lint: remove redundant debug logging
In initstack_pop_nobrace, if anything happens to the initstack, it will be logged by initstack_pop_item.
In init_using_expr, the address of the node is irrelevant, the node's contents has already been logged above.
|
1.82 | 21-Feb-2021 |
rillig | lint: document i_brace, add comments, rename initstack_string
No functional change outside debug mode.
|
1.81 | 21-Feb-2021 |
rillig | lint: always initialize return values of constant_addr
Before, the caller was responsible for initializing the return values from the function. This was an unexpected burden.
Ensure that in each branch that returns true, both return values are properly set.
Strangely, the only caller of that function, init_using_expr, uses neither of the return values. It just tests whether the expression is constant or not.
No functional change.
|
1.80 | 21-Feb-2021 |
rillig | lint: clean up debug logging in initstack_pop_item
The debug logging contained much redundant information and was misleading in a few places. For example, "pop" did not actually pop an item, plus there are several things that could be popped, so that didn't help either.
Sprinkle some comments in places where the code needs to become clearer.
No functional change outside debug mode. The condition 'istk->i_remaining >= 0' was redundant due to the assertion directly above it.
|
1.79 | 21-Feb-2021 |
rillig | lint: rename istk to initstack_element
The longer name is more expressive and more correct. The previous name called each stack element a stack itself, which was unnecessarily confusing.
No functional change.
|
1.78 | 21-Feb-2021 |
rillig | lint: reduce amount of debug output during initialization
|
1.77 | 21-Feb-2021 |
rillig | lint: rename members of struct istk to be more expressive
No functional change outside debug mode.
|
1.76 | 21-Feb-2021 |
rillig | lint: indent node details in debug mode
|
1.75 | 20-Feb-2021 |
rillig | lint: fix lint warning 'expression has null effect'
|
1.74 | 20-Feb-2021 |
rillig | lint: fix lint warnings
No functional change.
|
1.73 | 20-Feb-2021 |
rillig | lint: in debug mode, print the initialization stack
This is the central data structure of the initializations, it keeps track of the objects that still need to be initialized. Seeing its contents in debug mode helps in finding and understanding the still incomplete C99 support.
|
1.72 | 20-Feb-2021 |
rillig | lint: define debug_named_member only in debug mode
In non-debug mode it was an expensive no-op.
|
1.71 | 20-Feb-2021 |
rillig | lint: document an assumption that has turned wrong with C99
|
1.70 | 20-Feb-2021 |
rillig | lint: extend debugging for initializing objects
No functional change outside debug mode.
|
1.69 | 20-Feb-2021 |
rillig | lint: rename mkinit to init_using_expr
No functional change outside debug mode.
|
1.68 | 20-Feb-2021 |
rillig | lint: add hierarchical debug logging for initializations
No functional change for default mode.
|
1.67 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.66 | 31-Jan-2021 |
rillig | lint: don't warn about constant condition in 'do { } while (0)'
|
1.65 | 30-Jan-2021 |
rillig | lint: rename incompl to is_incomplete
No functional change.
|
1.64 | 17-Jan-2021 |
rillig | lint: fix return type of conaddr
|
1.63 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.62 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.61 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.60 | 03-Jan-2021 |
rillig | lint: rename functions that create nodes
|
1.59 | 03-Jan-2021 |
rillig | lint: rename type.t_isfield to t_bitfield
|
1.58 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.57 | 02-Jan-2021 |
rillig | lint: fix buffer truncation for type names
Previously, most type names had been cut off after 63 significant characters. In some cases, 127 characters survived, or 255. And for the debugging messages, sometimes even 1023. This inconsistency was useless.
It was wrong in the first place to make the caller of the function tyname responsible for handling the buffer. That's not something a caller of such a simple function should do. These callers have better things to do.
The API of the new function type_name is as simple as possible.
In the implementation, the name of the type is generated anew each time. I just didn't know whether the type details could change, once the type is initialized, and I didn't want to find out. To be on the safe side, the resulting type name is cached, independently of the type it was generated for. Using a trivial, unbalanced binary tree should be good enough for now.
All this work is necessary to support adding new debug logging, without being distracted by irrelevant implementation details such as these buffer sizes. Adding new debug messages should be fun and easy; up to now, it was overly bureaucratic.
|
1.56 | 02-Jan-2021 |
rillig | lint: use bool instead of u_int:1 in structures
Better late than never.
|
1.55 | 01-Jan-2021 |
rillig | lint: add debug logging for initialization using named members
|
1.54 | 01-Jan-2021 |
rillig | lint: document that C99-style initialization is necessarily buggy
|
1.53 | 01-Jan-2021 |
rillig | lint: un-export struct istk
|
1.52 | 01-Jan-2021 |
rillig | lint: fix wrong warning about bitfield in C99 structure initialization
The variable namemem is supposed to be a circular list, which is "documented" implicitly in push_member.
The implementation was buggy though. In pop_member, the circular list was destroyed though. Given the list (capital, major, favorite_color, green), removing capital made major point to itself in the forward direction, even though it should not have been modified at all.
In the test, I had been too optimistic to quickly understand the code around variable initialization. I was wrong though, so I had to adjust the comments there to reality.
|
1.51 | 01-Jan-2021 |
rillig | lint: demonstrate bug in handling of nested C9X struct initializers
|
1.50 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.49 | 01-Jan-2021 |
rillig | lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format strings from the actual arguments prevents the compiler from cross-checking them.
|
1.48 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_field, s_keyw and s_xsym
|
1.47 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.46 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.45 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.44 | 30-Dec-2020 |
rillig | lint: reduce verbosity of assertions
Having 2 lines of source code per assertion is too much, especially since most of this code is redundant anyway. Extract the common code and the additional negation into a simple function instead.
|
1.43 | 29-Dec-2020 |
rillig | lint: rename istk_t.i_cnt to i_remaining
|
1.42 | 29-Dec-2020 |
rillig | lint: untangle conditions in initstack_next_nobrace
|
1.41 | 29-Dec-2020 |
rillig | lint: clean up debug logging for initializations
|
1.40 | 29-Dec-2020 |
rillig | lint: make debug output for initializations more uniform
|
1.39 | 29-Dec-2020 |
rillig | lint: remove redundant function prototypes
|
1.38 | 29-Dec-2020 |
rillig | lint: improve debug output for initializing structs
Still trying to find out where the wrong warning in d_struct_init_nested comes from.
|
1.37 | 29-Dec-2020 |
rillig | lint: split initstack_next into separate functions
|
1.36 | 29-Dec-2020 |
rillig | lint: split initstack_pop into separate functions
|
1.35 | 29-Dec-2020 |
rillig | lint: rename functions for handling the initialization stack
|
1.34 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.33 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.32 | 28-Dec-2020 |
rillig | lint: rename confusing function setcompl
The previous function name suggested that it would set the complete flag of the type, but it was the exact opposite. To reduce confusion, negate the meaning of the parameter.
|
1.31 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.30 | 28-Dec-2020 |
rillig | lint: realign code
|
1.29 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.28 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.27 | 28-Jul-2015 |
christos | fix member list deallocation; remove #if 0'ed code.
|
1.26 | 20-Nov-2014 |
christos | Always set i_brace in the struct case. Cleanup some debugging.
|
1.25 | 17-Apr-2014 |
christos | Don't free memory; it is used later.
|
1.24 | 02-Oct-2009 |
christos | branches: 1.24.6; 1.24.12; 1.24.22; change initialization from non const of regular variables to c99 instead of gnu since c99 now has it.
|
1.23 | 26-Apr-2008 |
christos | fix "long double" type recognition which broke with the complex changes.
|
1.22 | 20-Jan-2007 |
ad | branches: 1.22.10; pushinit(): fix a use-after-free bug.
|
1.21 | 15-Oct-2006 |
christos | branches: 1.21.2; 1.21.6; in the same way that we need an extra level for arrays, do the same for struct.
|
1.20 | 15-Oct-2006 |
christos | previous fix broke array initializers.
|
1.19 | 14-Oct-2006 |
christos | Fix c99 initialization issues. Now the regression tests work.
|
1.18 | 20-Jun-2004 |
jmc | 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
|
1.17 | 06-Dec-2002 |
thorpej | branches: 1.17.2; Include <string.h> for prototypes.
|
1.16 | 13-Nov-2002 |
christos | PR/18896: Jason Thorpe: C99 structure member initializers broken for arrays. XXX: The checking done does not work, but the code passes.
|
1.15 | 23-Oct-2002 |
christos | forgot to commit those.
|
1.14 | 22-Oct-2002 |
christos | handle free-ing of temp symbols properly. Don't segv on bad node types.
|
1.13 | 22-Oct-2002 |
christos | fix spelling in comment.
|
1.12 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.11 | 13-Sep-2002 |
christos | 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.
|
1.10 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.9 | 18-Sep-2001 |
wiz | Give initiali[sz]e all the "i"s it deserves.
|
1.8 | 16-Sep-2001 |
wiz | Spell 'occurred' with two 'r's.
|
1.7 | 28-May-2001 |
lukem | 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.
|
1.6 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.5 | 22-Feb-1998 |
christos | WARNSify
|
1.4 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.3 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
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.17.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.18 (requested by jmc in ticket #527): 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
|
1.21.6.1 | 18-Aug-2009 |
bouyer | Pull up following revision(s) (requested by msaitoh in ticket #1353): usr.bin/xlint/lint1/init.c: revision 1.22 pushinit(): fix a use-after-free bug.
|
1.21.2.1 | 18-Aug-2009 |
bouyer | Pull up following revision(s) (requested by msaitoh in ticket #1353): usr.bin/xlint/lint1/init.c: revision 1.22 pushinit(): fix a use-after-free bug.
|
1.22.10.1 | 18-May-2008 |
yamt | sync with head.
|
1.24.22.1 | 10-Aug-2014 |
tls | Rebase.
|
1.24.12.1 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.24.6.1 | 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.269.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.239 | 12-Apr-2025 |
rillig | lint: save a few bytes of memory
The longest entry in the table had been CONSTANTCONDITION, which was removed a few days ago.
|
1.238 | 12-Apr-2025 |
rillig | lint: reword messages that apply to traditional C
|
1.237 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.236 | 10-Apr-2025 |
rillig | lint: remove now-unnecessary CONSTCOND comments
|
1.235 | 10-Apr-2025 |
rillig | lint: do not warn about constant operand of '!'
Like its related warning about a constant condition, the purpose of this warning is unclear, and suppressing the warning requires special lint comments, thus cluttering the code.
The message itself is still kept in err.c to keep the '-X 239' option valid. These LINTFLAGS will be removed in a follow-up commit.
The lint comments /* CONSTCOND */, as well as its more verbose forms /* CONSTANTCOND */ and /* CONSTANTCONDITION */ are no longer needed and can be removed.
|
1.234 | 10-Mar-2025 |
rillig | lint: only warn about do-while macro if the 'do' is a keyword
|
1.233 | 27-Feb-2025 |
rillig | lint: normalize whitespace
|
1.232 | 08-Dec-2024 |
rillig | lint: warn about do-while macros that end with a semicolon
|
1.231 | 29-Nov-2024 |
rillig | lint: in a query, treat 00 as an octal integer constant
Even though the value of the constant is 0 and thus the same as in the decimal interpretation, it is syntactically an octal number and contains a redundant leading digit, which may be interesting to detect.
|
1.230 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.229 | 29-Aug-2024 |
rillig | lint: support GCC's __auto_type
Fixes PR toolchain/58654.
|
1.228 | 12-May-2024 |
rillig | branches: 1.228.2; lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.227 | 12-May-2024 |
rillig | lint: don't call memcpy with null pointer
Even copying 0 bytes from a null pointer invokes undefined behavior.
|
1.226 | 12-May-2024 |
rillig | lint: move code for parsing balanced token sequences to lex.c
To access yytext from lex.c, the lexer needs to be in %pointer mode, which was specified in IEEE Std 1003.1, 2004 Edition and thus should be old enough to be available on platforms other than NetBSD, for use in tools/lint1 where lint1 is built before yacc and lex.
|
1.225 | 09-May-2024 |
rillig | lint: in C23 mode, support the nullptr constant
|
1.224 | 07-May-2024 |
rillig | lint: in C23 mode, support the keywords 'bool', 'false' and 'true'
|
1.223 | 29-Mar-2024 |
rillig | lint: clean up
|
1.222 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.221 | 02-Mar-2024 |
rillig | lint: remove custom wrappers around <ctype.h> functions
|
1.220 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.219 | 01-Mar-2024 |
rillig | lint: fix type error in strict bool mode (since yesterday)
|
1.218 | 29-Feb-2024 |
rillig | lint1: remove redundant type table for integer constant suffixes
|
1.217 | 08-Feb-2024 |
rillig | lint: clean up variable names, parameter order, comments
No functional change.
|
1.216 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.215 | 07-Feb-2024 |
rillig | lint: use consistent variable names, reduce code for reading a byte
No functional change.
|
1.214 | 07-Feb-2024 |
rillig | lint: unify rules for determining the type of an integer constant
Previously, in traditional C mode, large decimal numbers were treated as unsigned, which disagreed with the book from 1978.
|
1.213 | 03-Feb-2024 |
rillig | lint: warn about short octal escape followed by '8' or '9'
These mistakes is typically found in snprintb format directives but is probably a typo everywhere else as well.
|
1.212 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.211 | 03-Feb-2024 |
rillig | lint: allow hexadecimal character escapes up to UINT_MAX
Previously, any value larger than INT_MAX was regarded as negative and thus terminated the loop around get_escaped_char.
|
1.210 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.209 | 03-Feb-2024 |
rillig | lint: remove unused code for converting multibyte character sequences
|
1.208 | 03-Feb-2024 |
rillig | lint: allow larger numbers in escapes for wide characters and strings
|
1.207 | 02-Feb-2024 |
rillig | lint: make newline in a string literal an error in C90 and later
|
1.206 | 01-Feb-2024 |
rillig | lint: reuse buffer editing code across lint1
Fix cat_strings to update the capacity of the buffer, to prevent quadratic runtime when concatenating string literals.
|
1.205 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.204 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.203 | 27-Jan-2024 |
rillig | lint: fix type of large integer constants
|
1.202 | 27-Jan-2024 |
rillig | lint: split determining the type of an integer constant
No functional change.
|
1.201 | 27-Jan-2024 |
rillig | lint: extract signedness detection from lexing an integer constant
An integer constant that is signed in traditional C but unsigned since C90 is an edge case that should not clutter the main code of determining the resulting type of the constant.
The code for lexing an integer constant doesn't implement the C99 rules yet, which convert a constant to the 'long long' types if the 'long' types don't suffice.
|
1.200 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.199 | 19-Jan-2024 |
rillig | lint: allow '\e' only in GCC mode
|
1.198 | 19-Jan-2024 |
christos | add \e
|
1.197 | 07-Jan-2024 |
rillig | lint: allow querying for invisible characters in literals and constants
|
1.196 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.195 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.194 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.193 | 02-Dec-2023 |
rillig | lint: rename NOSCL to NO_SCL
For symmetry with NO_TSPEC. No functional change.
|
1.192 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.191 | 12-Aug-2023 |
rillig | lint: clean up lexing of preprocessing lines
The relation between 'c' and 'cp' was tricky to follow.
No functional change.
|
1.190 | 01-Aug-2023 |
rillig | lint: improve debug logging for declarators
|
1.189 | 30-Jul-2023 |
rillig | lint: in debug mode, default to indenting the debug log
Only the 'parsing' lines are not indented, as line breaks are independent from the structure of the code.
|
1.188 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.187 | 15-Jul-2023 |
rillig | lint: add debug logging for memory management and the symbol table
|
1.186 | 14-Jul-2023 |
rillig | lint: document which keywords are available in which language levels
|
1.185 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.184 | 13-Jul-2023 |
rillig | lint: in C23 mode, recognize the keyword 'thread_local'
|
1.183 | 13-Jul-2023 |
rillig | lint: _Thread_local is a storage class, not a type qualifier
|
1.182 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.181 | 13-Jul-2023 |
rillig | lint: clean up reading lint comments
|
1.180 | 13-Jul-2023 |
rillig | lint: reduce code size for handling lint comments
|
1.179 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.178 | 12-Jul-2023 |
rillig | lint: reduce runtime relocations
|
1.177 | 12-Jul-2023 |
rillig | lint: reject _Noreturn if it occurs in invalid places
C11 introduced _Noreturn as a function-specifier, not as a type attribute. The latter may occur in more places.
|
1.176 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.175 | 12-Jul-2023 |
rillig | lint: condense keyword table
This prepares for modelling 'inline' not as a storage class, but more correctly as a function specifier.
|
1.174 | 10-Jul-2023 |
rillig | lint: add debug logging for symbol kinds in the parser
An identifier can refer to a variable, type, member, tag or label. Switching between these namespaces is tightly coupled with the evaluation order of the grammar rules.
|
1.173 | 10-Jul-2023 |
rillig | lint: clean up wchar_t and hash tables
|
1.172 | 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.171 | 09-Jul-2023 |
rillig | lint: clean up wording in diagnostics
Use the term 'parameter' as defined in C99 3.15.
|
1.170 | 09-Jul-2023 |
rillig | lint: clean up the wording of a few diagnostics
|
1.169 | 08-Jul-2023 |
rillig | lint: fix handling of 'long double' in cross-compiled mode
When lint is compiled on x86-64 (where 'long double' has a 64-bit mantissa) and targets arm (where 'long double' has a 53-bit mantissa), warn if a constant cannot fit in the 'long double' of the target platform, not of the host platform.
|
1.168 | 03-Jul-2023 |
rillig | lint: clean up redundant casts
|
1.167 | 03-Jul-2023 |
rillig | lint: rename uppercase QUAD to LLONG
No binary change.
|
1.166 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.165 | 02-Jul-2023 |
rillig | lint: extend debug logging for declaration levels
Indent the debug logging according to the declaration level.
Since there are a few cases where the enclosing declaration levels are modified, log the whole declaration level stack whenever a level begins or ends.
|
1.164 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.163 | 30-Jun-2023 |
rillig | lint: replace macro for unique identifiers with function
No functional change.
|
1.162 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.161 | 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.160 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.159 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.158 | 11-Apr-2023 |
rillig | lint: don't wrongly warn about overflow in complex constants
Seen in lib/libm.
|
1.157 | 07-Apr-2023 |
rillig | lint: reduce clutter in parsing preprocessor lines
No functional change.
|
1.156 | 05-Apr-2023 |
rillig | lint: fix duplicate warning when parsing big float constants
|
1.155 | 31-Mar-2023 |
rillig | lint: allow querying for octal integer constants
|
1.154 | 19-Feb-2023 |
rillig | lint: do not warn about traditional C migration in C99 mode
For large integer constants, the resulting type could differ between traditional C and C90. In C99 mode, this difference is no longer relevant since it is too far away from traditional C.
|
1.153 | 19-Feb-2023 |
rillig | tests/lint: fix and extend tests for C90 migration warning
|
1.152 | 18-Feb-2023 |
rillig | lint: remove dead code from lex_floating_constant
Neither traditional C nor C11 allows a trailing 'd' or 'D' on floating point constants. Java does, but lint does not cover Java programs.
|
1.151 | 18-Feb-2023 |
rillig | lint: reduce scope of local variables
No functional change.
|
1.150 | 18-Feb-2023 |
rillig | lint: use strtold for parsing floating constants
Supported since C99.
|
1.149 | 18-Feb-2023 |
rillig | lint: remove compat code for lexing hex floating point literals
Hex floating literals are required by C99.
|
1.148 | 02-Feb-2023 |
rillig | lint: clean up
In symtab_search, most of the conditions were redundant, so remove them.
In read_byte, using CHAR_MASK was conceptually wrong, as that constant is from the target platform while the lexical analysis happens on the host platform. It was unnecessary as well, as a hypothetical host platform with 36-bit chars might encode the characters from the basic source character set as numbers higher than 0x0_0000_00ff. Since lint assumes that both the source character set as well as the execution character set are the same and based on 8-bit bytes, nothing changes.
No functional change.
|
1.147 | 29-Jan-2023 |
rillig | lint: inline an expression, clean up comments
No functional change.
|
1.146 | 22-Jan-2023 |
rillig | lint: clean up the lexer
No functional change.
|
1.145 | 22-Jan-2023 |
rillig | lint: prevent undefined behavior for signed '<<'
Found by manual code inspection, verified by MKSANITIZER=yes USE_SANITIZER=undefined.
|
1.144 | 21-Jan-2023 |
rillig | lint: use more expressive variable names in lexer
The name 't' could easily be mistaken to mean a tspec_t.
No functional change.
|
1.143 | 21-Jan-2023 |
rillig | lint: reduce clutter in lexer
No functional change.
|
1.142 | 21-Jan-2023 |
rillig | lint: add support for C11 '_Atomic' as atomic-type-specifier
Following the C11 grammar, the keyword '_Atomic' needs to be a separate syntactic category, to avoid further conflicts in the grammar.
The two newly added conflicts in the grammar would come into play when mixing traditional C with C11, in a type name without an implicit 'int'. If the type '_Atomic(int)*' were parsed as '_Atomic int(int)*', the trailing '*' would be a syntax error.
|
1.141 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.140 | 21-Jan-2023 |
rillig | lint: use simpler integers for parsing hex escapes
No functional change.
|
1.139 | 21-Jan-2023 |
rillig | lint: use longer variable names, don't count digits in hex escapes
No functional change.
|
1.138 | 21-Jan-2023 |
rillig | lint: eliminate forward declaration for get_escaped_char
No functional change.
|
1.137 | 21-Jan-2023 |
rillig | lint: extract reading of escaped character constants
No functional change.
|
1.136 | 21-Jan-2023 |
rillig | lint: extract parsing character escapes into separate functions
No functional change.
|
1.135 | 08-Jan-2023 |
rillig | lint: document how reading tokens from the input works
Rename inpc to read_byte, to make the name more expressive. Since C99, lint is no longer required to use overly short identifiers.
No functional change.
|
1.134 | 01-Oct-2022 |
rillig | lint: miscellaneous cleanup
No functional change.
|
1.133 | 25-Aug-2022 |
rillig | lint: remove explicit list of known GCC attributes
Most GCC attributes consist of a single identifier. Up to now, it was necessary to list each of these identifiers in the grammar, even those that only apply to a single target architecture.
Instead, parse the general form of attributes, matching the few attributes that lint handles by name instead. While here, rename the grammar rules to use the GCC terms.
To avoid conflicts between the global function 'printf' and the GCC attribute of the same name, do not add GCC attributes to the symbol table, and don't make these symbols 'extern' either.
ok christos@.
|
1.132 | 11-Jun-2022 |
rillig | lint: make definition of type keywords simpler
The only type keyword that is available in more than one variant is 'signed', which can also be written '__signed'. Neither of the type keywords is declared as being specific to GCC, even though __int128_t and __uint128_t actually are non-standard.
No binary change.
|
1.131 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.130 | 12-May-2022 |
rillig | lint: fix support for __alignof__, add support for __alignof
Broken since lex.c 1.129 from yesterday.
|
1.129 | 11-May-2022 |
christos | gcc also allows __alignof
|
1.128 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.127 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.126 | 30-Apr-2022 |
rillig | lint: document why in GCC mode, C99 keywords are enabled
|
1.125 | 30-Apr-2022 |
rillig | lint: document why C11 keywords are available in C99 mode as well
|
1.124 | 30-Apr-2022 |
rillig | lint: move GCC attributes to the bottom of the list
These identifiers have a simpler definition than the other keywords since they do not define when they were introduced.
No functional change.
|
1.123 | 16-Apr-2022 |
rillig | lint: remove null marker from keyword table
No functional change.
|
1.122 | 16-Apr-2022 |
rillig | lint: prepare keyword table for C11
The C11 keywords had been listed as being C99 keywords. Instead of initializing the individual fields separately, merge them by specifying the year of the standard in which they appeared.
No binary change, except for line numbers in assertions.
|
1.121 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.120 | 16-Apr-2022 |
rillig | lint: clean up keyword definitions for the lexer
There is only one specialized keyword that is also a GCC attribute, it's "section". All other keywords passed 0 in that macro argument.
No binary change.
|
1.119 | 13-Apr-2022 |
rillig | lint: fix lint warning on platforms where size_t == unsigned int
lex.c(1451): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
A more thorough fix would be to change the type of block_level from int to size_t, to match mem_block_level, but that change would generate further signedness warnings because the type of sym_t.s_block_level would have to be changed from int to size_t as well, but some symbols have s_block_level == -1, so that's a larger and more error-prone change. Leave that for later.
Whether message 259 makes sense at all in C99 mode is an entirely different question that needs to be answered separately.
No functional change.
|
1.118 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.117 | 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.116 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.115 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.114 | 02-Apr-2022 |
rillig | lint: add debug logging for the declaration stack
To track down the wrong edge cases in decl_direct_abstract.c.
|
1.113 | 13-Mar-2022 |
rillig | lint: clean up comments, explain assertion in inssym
|
1.112 | 13-Mar-2022 |
rillig | lint: use an unsigned counter for temporary variable names
No functional change.
|
1.111 | 13-Mar-2022 |
rillig | lint: improve debug logging for the symbol table
Only print the heading for the symbol table level if there is actually a symbol on that level.
Ensure that no symbol with block level -1 is ever in the symbol table (see rmsym).
|
1.110 | 13-Mar-2022 |
rillig | lint: fix off-by-one error in symbol table
No functional change since the error was in the "safe" direction.
|
1.109 | 13-Mar-2022 |
rillig | lint: rename function 'cleanup' to be more expressive
No functional change.
|
1.108 | 01-Mar-2022 |
rillig | lint: remove redundant assignments to string buffer length
No functional change.
|
1.107 | 01-Mar-2022 |
rillig | lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and debug_symtab can be called as needed during a debug session.
|
1.106 | 28-Feb-2022 |
rillig | lint: constify lexer keywords
No functional change.
|
1.105 | 27-Feb-2022 |
rillig | lint: reorganize lexer functions
Move the keywords table to the top, reduce forward declarations.
No functional change.
|
1.104 | 27-Feb-2022 |
rillig | lint: group symbol table functions
No functional change.
|
1.103 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.102 | 27-Feb-2022 |
rillig | lint: unabbreviate some fields in sym_t
No functional change.
|
1.101 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.100 | 27-Feb-2022 |
rillig | lint: clean up memory management for string buffers
There is no reason to duplicate all the work that is already done by the memory allocator.
No functional change.
|
1.99 | 27-Feb-2022 |
rillig | lint: clean up memory allocation
No functional change.
|
1.98 | 26-Feb-2022 |
rillig | lint: improve debug logging for symbol kinds
|
1.97 | 26-Dec-2021 |
christos | Add clang's optnone attribute.
|
1.96 | 25-Dec-2021 |
rillig | lint: don't try to trick mathematics by defining ZERO to a nonzero value
No binary change.
|
1.95 | 22-Dec-2021 |
rillig | lint: remove redundant EOF tests in lexer
No functional change.
|
1.94 | 22-Dec-2021 |
rillig | lint: clean up lex.c
Rename 'struct kwtab' to 'struct keyword' since a single keyword is not a whole keyword table.
Sync comment for lex_name with reality: sbuf_t no longer contains the hash value.
Remove redundant tests for EOF, as EOF is neither a space nor a digit nor an xdigit.
No functional change.
|
1.93 | 22-Dec-2021 |
rillig | lint: remove spaces around bit-field colon
As seen in /usr/share/misc/style.
No binary change.
|
1.92 | 22-Dec-2021 |
rillig | lint: rename C89 to C90 in variable names
No binary change.
|
1.91 | 22-Dec-2021 |
rillig | lint: use C90 instead of C89 when referring to the C standard
|
1.90 | 15-Dec-2021 |
christos | Add more attributes
|
1.89 | 14-Dec-2021 |
christos | Improve restrict handling.
|
1.88 | 27-Nov-2021 |
christos | Add target attribute
|
1.87 | 16-Nov-2021 |
rillig | lint: finish renaming of fcon to lex_floating_constant
|
1.86 | 16-Nov-2021 |
rillig | lint: rename attron to in_gcc_attribute
No functional change.
|
1.85 | 01-Nov-2021 |
rillig | lint: move all declarations above statements
All code that is used by src/tools is supposed to be compatible with C90.
No functional change.
|
1.84 | 18-Sep-2021 |
jmcneill | use isfinite(3) instead of finite(3) for portability
Fixes tools build on macOS 11.6 arm64 hosts.
|
1.83 | 17-Sep-2021 |
christos | Extra commit to fix the actual wrong comment before: Add _Static_assert grammar and keyword
|
1.82 | 17-Sep-2021 |
christos | remove the lint kludges
|
1.81 | 05-Sep-2021 |
rillig | lint: fix lint warnings
|
1.80 | 29-Aug-2021 |
rillig | lint: allow 'fallthrough' as alternative spelling of FALLTHROUGH
Seen in unbound/lookup3.c.
No change to the documentation since the canonical spelling is still the same.
|
1.79 | 29-Aug-2021 |
rillig | lint: accept keyword variant FALL THROUGH as alias to FALLTHROUGH
Seen in archive_string.c, macro WRITE_UC.
No documentation change since the canonical spelling of this keyword stays the same.
|
1.78 | 28-Aug-2021 |
rillig | lint: clean up hash functions
No functional change.
|
1.77 | 28-Aug-2021 |
rillig | lint: remove unreachable code for parsing integer constants
The largest possible type of an integer constant is 'unsigned long long'. Any larger type can only be expressed using casts.
See also https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html.
|
1.76 | 28-Aug-2021 |
rillig | lint: fold constants in hash functions
All platforms supported by lint have sizeof(unsigned int) == 4 and CHAR_BIT == 8. There is no need to encode these expressions in a hash function, they only made the code harder to read.
No functional change.
|
1.75 | 28-Aug-2021 |
rillig | lint: replace obsolete strtouq with equivalent strtoull
|
1.74 | 28-Aug-2021 |
rillig | lint: fix lexing of character constants
The final value of the character constant must be determined by the target platform, not the host platform.
This allows to run the tests for a target platform with different signedness of characters, by editing targparam.h and t_integration.
Lint is not completely cross-compileable though. 64-bit host platforms can run lint for 32-bit platforms, but not vice versa, since 32-bit GCC does not provide 128-bit integer types.
|
1.73 | 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.72 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types in convert_integer
There was no need to have two separate magic values (0 and -1) to mean the same.
No functional change.
|
1.71 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.70 | 25-Aug-2021 |
rillig | lint: add __attribute__ regparm
Seen in libexec/ld.elf_so/rtld.h.
|
1.69 | 23-Aug-2021 |
rillig | lint: inline msb
This reduces the binary size on x86_64 by about 500 bytes.
No functional change.
|
1.68 | 23-Aug-2021 |
rillig | lint: remove unnecessary width parameter for msb
No functional change.
|
1.67 | 22-Aug-2021 |
rillig | lint: use unsigned integers for storing hash values
The computation of the hash values is unchanged, only the resulting value (which is always less than 1009 anyway, see HSHSIZ2) is stored as unsigned as well.
No functional change.
|
1.66 | 22-Aug-2021 |
rillig | lint: save some memory
Before lint1.h 1.47 from 2021-01-02, adjacent bit-field struct members shared storage. Restore that using smaller types.
No functional change.
|
1.65 | 19-Aug-2021 |
rillig | lint: change return type of 'msb' from int to bool
No functional change.
|
1.64 | 19-Aug-2021 |
rillig | lint: clean up lex_integer_constant
When lexing an integer constant, it does not make sense to check for 'struct', 'void' or other types. Furthermore, the constants were listed in some random-looking order, which made the code hard to read.
|
1.63 | 19-Aug-2021 |
christos | Add returns_nonnull attribute
|
1.62 | 01-Aug-2021 |
rillig | lint: remove hash value from symbol buffer
Conceptually, a symbol buffer does not need to remember its hash value since that belongs to the symbol table. This makes the code for the symbol table simpler. The number of hash calculations increases by about 5%, which is negligible.
No functional change.
|
1.61 | 01-Aug-2021 |
rillig | lint: merge duplicate code for removing a symbol from the table
No functional change.
|
1.60 | 01-Aug-2021 |
rillig | lint: extract duplicate code for modifying the symbol table
No functional change.
|
1.59 | 01-Aug-2021 |
rillig | lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault, probably related to the symbol table. To better understand this part, log insertions and deletions.
The other debug log messages do not need to mention the current file position anymore, this is what lex_next_line takes care of since scan.l 1.113 from 2021-01-05.
|
1.58 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.57 | 31-Jul-2021 |
rillig | lint: reduce indentation in 'search'
No functional change.
|
1.56 | 23-Jul-2021 |
rillig | lint: write canonical form of keywords
For keywords that have a single spelling variant (such as __packed), write this form in the source, to make it searchable. This also avoids a few calls to malloc.
Previously, some keywords had leading underscores and some hadn't, this was inconsistent.
No functional change.
|
1.55 | 11-Jul-2021 |
rillig | lint: support __attribute__((hot))
The corresponding attribute 'cold' was already added in cgram.y 1.84 from 2016-12-29.
|
1.54 | 10-Jul-2021 |
rillig | lint: rename y_sb to y_name
That buffer is only used for names of identifiers, so be more specific.
No functional change.
|
1.53 | 08-Jul-2021 |
rillig | lint: remove double negation in comment
No functional change.
|
1.52 | 08-Jul-2021 |
rillig | lint: constify keyword in lexer
No functional change.
|
1.51 | 06-Jul-2021 |
rillig | lint: __real__ and __imag__ are GNU extensions
https://gcc.gnu.org/onlinedocs/gcc/Complex.html
|
1.50 | 30-Jun-2021 |
rillig | lint: inline 'sign' into convert_integer
No functional change.
|
1.49 | 29-Jun-2021 |
rillig | lint: rename xsign to convert_integer
The term sign-extend was too specific, the function actually does a broader conversion.
No functional change.
|
1.48 | 29-Jun-2021 |
rillig | lint: clean up lex_character_constant
No functional change.
|
1.47 | 29-Jun-2021 |
rillig | lint: fix lexical analysis of character constants in traditional C
The code now follows the wording of the C Reference Manual from 1978.
|
1.46 | 20-Jun-2021 |
rillig | lint: rename val_t.v_unsigned to avoid confusion
The name v_unsigned suggested that the value would be interpreted as unsigned, which was wrong. Whether a value is signed or unsigned is decided by v_tspec instead.
Revert the previous commit for boolen constants since their value is already interpreted as unsigned, and there is no need for any warning about differences between traditional C and ANSI C since the _Bool type has only been added ten years later in C99.
The code for printing a tree node was also confused by this struct member, even with its old name v_ansiu. That code will be fixed in a follow-up commit.
No functional change.
|
1.45 | 20-Jun-2021 |
rillig | lint: rename val_t.v_ansiu to v_unsigned
When lint was written in 1995, traditional C was still nearby since C90 had been around for only 5 years. 26 years later, almost all code adheres to C90 or even C99 or C11, therefore "C90 or later" can safely be assumed as the default.
No functional change.
|
1.44 | 20-Jun-2021 |
rillig | lint: fix confusing variable name in lex_wide_character_constant
By convention, i is an index, not a count.
No functional change.
|
1.43 | 20-Jun-2021 |
rillig | lint: reduce indentation in lexer for character constants
No functional change.
|
1.42 | 20-Jun-2021 |
rillig | lint: fix check for empty wide character constant
This bug got almost 26 years old, it was already there at the initial commit in 1995.
|
1.41 | 19-Jun-2021 |
rillig | lint: fix endless loop on unfinished comment at EOF
Found using afl.
|
1.40 | 19-Jun-2021 |
rillig | lint: fix endless loop when scanning string or character literals
If the code contains an unfinished string or character literal at the EOF, the lexer got into an endless loop. Curiously, inpc() returned 0 in such a case instead of the common EOF.
Found by making lint1 with CC=afl-gcc and then running:
afl-fuzz \ -m 200 \ -i in_dir \ -o lint1 \ $src/usr.bin/xlint/lint1/lint1 @@ /dev/null
|
1.39 | 19-Jun-2021 |
rillig | lint: revert fix for endless loop in lexer for string literals
String literals may contain null bytes, and these must be passed further on.
This reintroduces the endless loop in the lexer, but that must be fixed in another way that doesn't destroy the error handling.
|
1.38 | 18-Jun-2021 |
rillig | lint: fix hang on unfinished string literal at end-of-file
The input file that triggered this bug was:
a"b"c"d
Found using afl.
|
1.37 | 15-Jun-2021 |
rillig | lint: replace array access with function calls
First and foremost, the test d_c99_complex_split accessed the array qlmasks out-of-bounds, with an index of 128 for the type 'double _Complex'. This invoked undefined behavior since the maximum allowed index was 64.
Replacing the raw array accesses with function calls allows for bounds checks to catch these errors early.
Determining the value bits for a 'double _Complex' does not make sense at all since it is not an integer type. This means that lint didn't handle these types correctly for several years. Support for int128_t has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex has been added in inittyp.c 1.9 from 2008-04-26.
Determining the value bits for an int128_t would make sense, but the unit tests don't contain examples for this type since at the moment all unit tests must produce the same results on 32-bit and 64-bit platforms, and the 32-bit platforms don't support int128_t.
|
1.36 | 03-May-2021 |
rillig | lint: undefine macros for defining keywords after use
No functional change.
|
1.35 | 03-May-2021 |
rillig | lint: remove redundancy when defining classic keywords
No functional change.
|
1.34 | 03-May-2021 |
rillig | lint: reduce redundancy when defining GCC attributes
This macro would have prevented the unintended inconsistency in the attribute 'pcs' (for ARM).
No functional change. The generated code is the same, except for the line numbers in lint_assert.
|
1.33 | 03-May-2021 |
rillig | lint: allow variables to be named 'pcs'
|
1.32 | 03-May-2021 |
rillig | lint: fix compiler warning about signedness mismatch
No functional change.
|
1.31 | 01-May-2021 |
christos | put back nonnull. I meant to just sort it.
|
1.30 | 30-Apr-2021 |
christos | - add nonstring attribute - allow attributes after labels (for unused) XXX: split the attributes into function, variable, etc attributes so that we don't accept all attributes in all places (only where they make sense)
|
1.29 | 20-Apr-2021 |
christos | Add common attribute
|
1.28 | 18-Apr-2021 |
rillig | lint: fix storage class of compound literal in initializer
A compound literal that occurs at block_level 0 does not have storage class AUTO. Instead, its storage class is either EXTERN or STATIC.
While removing the temporary objects from the symbol table had prevented the assertion, it did not properly fix the underlying problem, which was that since C99 the initializers can contain references to unnamed objects that are created on-the-fly. For C90 it was correct to always use AUTO as the storage class of a temporary symbol.
|
1.27 | 12-Apr-2021 |
christos | Add attribute fallthrough
|
1.26 | 09-Apr-2021 |
rillig | lint: clean up handling of preprocessing output lines
No functional change.
|
1.25 | 08-Apr-2021 |
rillig | lint: in code from included files, print stack trace
Previously, the standard NetBSD build generated several lint warnings in lhash.h from OpenSSL, without providing any hint as to which file actually included that header. In cases like these, lint now interprets the line number information in the preprocessor output from GCC to reconstruct the exact include path to the file in question.
The program check-expect.lua had to be rewritten almost completely since it assumed that all diagnostics would come from the main file. In all existing tests, this was true, but these tests did not cover all cases that occurred in practice. Now it records the complete location of the diagnostic instead of just the line number.
|
1.24 | 06-Apr-2021 |
rillig | lint: sync comment with reality after renaming several functions
No functional change.
|
1.23 | 02-Apr-2021 |
rillig | lint: reduce memory usage
No functional change.
|
1.22 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.21 | 28-Mar-2021 |
rillig | lint: sprinkle const on function declarations
No functional change.
|
1.20 | 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.19 | 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.18 | 27-Mar-2021 |
rillig | lint: remove space between 'sizeof ('
No functional change.
|
1.17 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.16 | 23-Mar-2021 |
christos | Add _Alignas()
|
1.15 | 21-Mar-2021 |
rillig | lint: rename functions for handling control statements
No functional change.
|
1.14 | 20-Mar-2021 |
rillig | lint: make lint's own code pass the strict bool mode
No functional change.
|
1.13 | 20-Mar-2021 |
rillig | lint: use macro for initializing keywords table
Since today, lint's strict bool mode requires initializers to have the correct type. The flags in kwtab are of type bool and were initialized with an int, for brevity. Keep the brevity and do the conversion from int to bool in a macro.
By defining several macros for the different kinds of keywords, reduce the clutter of having 2 additional zeroes per line. The macros also remove the redundancy and thereby the possible inconsistency of filling the wrong fields since these depend on the token type.
No functional change. The only change to the binary is due to the changed line numbers in the calls to lint_assert.
|
1.12 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.11 | 01-Mar-2021 |
rillig | lint: only warn once about integer constant overflow on 32-bit
Previously, the test msg_056.c warned twice about the integer literal, but only on 32-bit platforms. On 64-bit platforms, there was only a single warning since the integer constant was converted to type __uint128_t, and this prevented the second warning. On 32-bit targets, there is no __uint128_t though.
Fixes part of PR bin/55976.
|
1.10 | 28-Feb-2021 |
rillig | lint: rename members and access macros of the basic types
Having the measurement unit in the variable name prevents accidental confusion between bits and bytes, especially since usually the word 'size' means the size in bytes, while 'width' means the size in bits, at least for integer types.
No functional change.
|
1.9 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.8 | 20-Feb-2021 |
rillig | lint: make parsing of GCC line directives stricter
The previous code accepted '# 123 "file.c" 23' as specifying a system header, just because that number ends with '3'. The original intention was to compare the complete word, not its suffix. Fix that.
No practical change since the only flags that are used by GCC are all single-digit.
|
1.7 | 24-Jan-2021 |
rillig | lint: fix build on Cygwin
Cygwin does not conform to C99, which says that MB_CUR_MAX has type size_t.
Instead, Cygwin defines it as type int. This leads to compile errors because comparing signed with unsigned expressions is surprising in C.
|
1.6 | 24-Jan-2021 |
rillig | lint: expand abbreviations in lexer function names
No functional change.
|
1.5 | 24-Jan-2021 |
rillig | lint: explain why !finite(x) is not allowed in strict bool mode
|
1.4 | 24-Jan-2021 |
christos | fix the build
|
1.3 | 23-Jan-2021 |
rillig | lint: apply strict bool mode to lex.c
There are 2 remaining expressions:
In line 244, !(kw->kw_deco & deco) is a bitwise and. This is already allowed for enums, it needs to be allowed for arbitrary integer expressions as well. This covers the many places where plain integers are used for bit fields, together with #define. This pattern is not as typesafe as using enums, still it is common practice.
In line 769, the expression !finite(f) is a legitimate use of a function that has return type int for traditional reasons. It's the same as for ferror.
There are several other functions like unlink, open or strcmp that have return type int as well, but with a different meaning. It is not yet clear what the best way is to handle these different meanings. Having to write finite(f) == 0 in strict bool mode doesn't look idiomatic, on the other hand, !strcmp(s1, s2) is exactly the pattern that strict bool mode wants to avoid.
|
1.2 | 23-Jan-2021 |
rillig | lint: clean up comments and variable names in lex.c
|
1.1 | 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.228.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.4 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.3 | 03-Jan-2002 |
thorpej | Make sure the tspec_t enum starts at 0, and declare NTSPEC in the enum proper.
|
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.237 | 11-Jul-2025 |
rillig | lint: fix warning about enum array index
Seen in openssh/fmt_scaled.c, scale_chars.
|
1.236 | 14-May-2025 |
rillig | lint: extract type_attributes functions from grammar
|
1.235 | 10-Apr-2025 |
rillig | lint: remove now-unnecessary CONSTCOND comments
|
1.234 | 10-Apr-2025 |
rillig | lint: do not warn about constant operand of '!'
Like its related warning about a constant condition, the purpose of this warning is unclear, and suppressing the warning requires special lint comments, thus cluttering the code.
The message itself is still kept in err.c to keep the '-X 239' option valid. These LINTFLAGS will be removed in a follow-up commit.
The lint comments /* CONSTCOND */, as well as its more verbose forms /* CONSTANTCOND */ and /* CONSTANTCONDITION */ are no longer needed and can be removed.
|
1.233 | 20-Feb-2025 |
rillig | lint: support __attribute__((__mode__(TI)))
This fixes the wrong lint warnings about the shift amount being greater than the type size in compiler_rt/popcountti2.c.
|
1.232 | 03-Jan-2025 |
rillig | lint: add detail to message about obsolete identifier list
|
1.231 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.230 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.229 | 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.228 | 28-Sep-2024 |
rillig | lint: handle __attribute__((__unused__)) for functions and variables
Previously, lint ignored the '__unused' marker, requiring its own /* ARGSUSED */ marker instead.
Previously, attributes were interpreted as soon as the closing parenthesis was parsed. For a function definition such as '__unused static void f(void) {}', this was too early, as the attribute was not connected to the function, as the function was not parsed yet.
Now, the 'unused' attribute is passed around by the parser, until it is merged into the declarator where it belongs. Due to an inaccuracy in the grammar, the 'used' attribute has to be passed through a parameter_list, even though a parameter list is not related to attributes. Still, it's better than before.
|
1.227 | 11-May-2024 |
rillig | branches: 1.227.2; lint: parse but otherwise ignore C23 attributes
The C23 attributes are only parsed before an expression in an expression statement, as a proof of concept. Other places will follow later.
|
1.226 | 09-May-2024 |
rillig | lint: in C23 mode, support the nullptr constant
|
1.225 | 07-May-2024 |
rillig | lint: in C23 mode, support the keywords 'bool', 'false' and 'true'
|
1.224 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.223 | 01-May-2024 |
rillig | lint: support _Alignas and __attribute__((__aligned(4)))
|
1.222 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.221 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.220 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.219 | 09-Mar-2024 |
rillig | lint: clean up comments, use typedefs
|
1.218 | 09-Mar-2024 |
rillig | lint: internally store case label values in order of appearance
|
1.217 | 09-Mar-2024 |
rillig | lint: remove unneeded checks for left and right operands
|
1.216 | 09-Mar-2024 |
rillig | lint: use fewer struct keywords
|
1.215 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.214 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.213 | 03-Feb-2024 |
rillig | lint: remove excessive empty lines
|
1.212 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.211 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.210 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.209 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.208 | 11-Jan-2024 |
rillig | lint: clean up enum constants for designators
In intializers and offsetof, both struct and union members are handled in the same way, thus there is no need to distinguish them.
|
1.207 | 09-Jan-2024 |
rillig | lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not identifiers but designator sequences, such as in 'offsetof(struct stat, st_atim.tv_sec)', so make lint accept them as well.
|
1.206 | 06-Jan-2024 |
rillig | lint: remove redundant parentheses, braces and comments
Rename the functions for folding constant expressions, to make the comments redundant.
|
1.205 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.204 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.203 | 02-Dec-2023 |
rillig | lint: rename NOSCL to NO_SCL
For symmetry with NO_TSPEC. No functional change.
|
1.202 | 14-Sep-2023 |
rillig | lint: remove preprocessor magic from definition of operators
No binary change.
|
1.201 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.200 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.199 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.198 | 01-Aug-2023 |
rillig | lint: clear global variable 'dcs' after use
Having unnecessarily set members is confusing during debugging.
|
1.197 | 29-Jul-2023 |
rillig | lint: only generate err-msgs.h in debug mode
|
1.196 | 28-Jul-2023 |
rillig | lint: extract 'vararg' and 'prototype' flags from global 'dcs'
These flags are only relevant for parameter lists, so add a separate type for it.
No functional change.
|
1.195 | 19-Jul-2023 |
rillig | lint: work around a possible compiler error on arm and powerpc
|
1.194 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.193 | 14-Jul-2023 |
rillig | lint: clean up comments, add a test for the '?:' operator
|
1.192 | 13-Jul-2023 |
rillig | lint: merge duplicate code for checking duplicate type qualifiers
|
1.191 | 13-Jul-2023 |
rillig | lint: use separate types for parsing pointer types and type qualifiers
The documentation of the previous 'qual_ptr_t' was misleading, as that type was used for other type qualifier lists as well, even if these were not related to pointer types.
|
1.190 | 13-Jul-2023 |
rillig | lint: _Thread_local is a storage class, not a type qualifier
|
1.189 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.188 | 13-Jul-2023 |
rillig | lint: reduce code size for handling lint comments
|
1.187 | 12-Jul-2023 |
rillig | lint: reject _Noreturn if it occurs in invalid places
C11 introduced _Noreturn as a function-specifier, not as a type attribute. The latter may occur in more places.
|
1.186 | 12-Jul-2023 |
rillig | lint: don't treat 'inline' as a storage class
The additional conflict in the grammar is in the same place as the other conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.
No functional change.
|
1.185 | 11-Jul-2023 |
rillig | lint: update wording in diagnostic for C99
|
1.184 | 10-Jul-2023 |
rillig | lint: merge duplicate code for getting the name of an operator
|
1.183 | 10-Jul-2023 |
rillig | lint: add debug logging for symbol kinds in the parser
An identifier can refer to a variable, type, member, tag or label. Switching between these namespaces is tightly coupled with the evaluation order of the grammar rules.
|
1.182 | 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.181 | 03-Jul-2023 |
rillig | lint: clean up redundant casts
|
1.180 | 03-Jul-2023 |
rillig | lint: rename uppercase QUAD to LLONG
No binary change.
|
1.179 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.178 | 02-Jul-2023 |
rillig | lint: clean up variable names relating to structure padding
|
1.177 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.176 | 02-Jul-2023 |
rillig | lint: use unsigned int for struct alignment
This gets rid of 'unsigned short', which saved a few bytes of memory but was inconvenient to deal with.
No functional change.
|
1.175 | 02-Jul-2023 |
rillig | lint: clean up variable names
|
1.174 | 01-Jul-2023 |
rillig | lint: clean up comments in lint1.h
|
1.173 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.172 | 30-Jun-2023 |
rillig | lint: replace macro for unique identifiers with function
No functional change.
|
1.171 | 30-Jun-2023 |
rillig | lint: clean up handling of declarations
No functional change.
|
1.170 | 29-Jun-2023 |
rillig | lint: clean up member names of declaration levels
No functional change outside debug mode.
|
1.169 | 29-Jun-2023 |
rillig | lint: use standard terminology for bit-field width
No functional change.
|
1.168 | 29-Jun-2023 |
rillig | lint: enhance debug output for diagnostics
Only print the debug message if the diagnostic is active, which is relevant for c99ism, c11ism and gnuism.
Print more details about the diagnostic or query.
|
1.167 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.166 | 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.165 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.164 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.163 | 21-Feb-2023 |
rillig | lint: use __printflike
|
1.162 | 18-Feb-2023 |
rillig | lint: replace INTERNAL_ERROR with plain assert
|
1.161 | 21-Jan-2023 |
rillig | lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that will be added later.
|
1.160 | 14-Jan-2023 |
rillig | lint: use fewer abbreviations
No binary change except for line numbers in assertions in decl.c.
|
1.159 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.158 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.157 | 28-Aug-2022 |
rillig | lint: rename dcs manipulation functions to be clearer
No functional change.
|
1.156 | 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.155 | 01-Jul-2022 |
rillig | lint: move error handling code from main1.c to err.c
No functional change.
|
1.154 | 26-May-2022 |
rillig | lint: rename olwarn and LWARN_BAD to be more expressive
No functional change.
|
1.153 | 16-Apr-2022 |
rillig | lint: investigate why lint only warns about some constant conditions
Noticed in lex.c, in the macro kwdef, where lint complains about the condition containing '||' but not about the conditions containing only '>' or '=='.
|
1.152 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.151 | 10-Apr-2022 |
rillig | lint: fix assertion failure on duplicate qualifiers from __typeof__
|
1.150 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.149 | 09-Apr-2022 |
rillig | lint: rename dinfo_t.d_offset to d_offset_in_bits
Most often, offsets are measured in bytes, so better embed the unit in the variable name.
No functional change.
|
1.148 | 09-Apr-2022 |
rillig | lint: extract is_member into separate function
No functional change.
|
1.147 | 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.146 | 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.145 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.144 | 02-Apr-2022 |
rillig | lint: use appropriate alignment on both the host and target platform
|
1.143 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.142 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.141 | 27-Feb-2022 |
rillig | lint: unabbreviate two more members of sym_t
No functional change.
|
1.140 | 27-Feb-2022 |
rillig | lint: remove unused enumeration details from symbol type
No functional change.
|
1.139 | 27-Feb-2022 |
rillig | lint: unabbreviate some fields in sym_t
No functional change.
|
1.138 | 27-Feb-2022 |
rillig | lint: clean up memory management for string buffers
There is no reason to duplicate all the work that is already done by the memory allocator.
No functional change.
|
1.137 | 27-Feb-2022 |
rillig | lint: clean up memory allocation
No functional change.
|
1.136 | 27-Feb-2022 |
rillig | lint: rename ARG to OLD_STYLE_ARG
Pre-C90 argument declarations have been old for more than 30 years now, so mention that fact in the constant name. This reduces potential confusion with other occurrences of the words 'arg' or 'argument'.
No functional change.
|
1.135 | 07-Feb-2022 |
rillig | lint: drop compatibility with C90
Since tools/README 1.5 from 2022-02-03, the tools no longer need to be compatible with C90, they may now use C99 features. Lint had used <stdbool.h> and snprintf already.
No functional change.
|
1.134 | 25-Dec-2021 |
rillig | lint: don't try to trick mathematics by defining ZERO to a nonzero value
No binary change.
|
1.133 | 22-Dec-2021 |
rillig | lint: clean up lex.c
Rename 'struct kwtab' to 'struct keyword' since a single keyword is not a whole keyword table.
Sync comment for lex_name with reality: sbuf_t no longer contains the hash value.
Remove redundant tests for EOF, as EOF is neither a space nor a digit nor an xdigit.
No functional change.
|
1.132 | 22-Dec-2021 |
rillig | lint: remove spaces around bit-field colon
As seen in /usr/share/misc/style.
No binary change.
|
1.131 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.130 | 01-Nov-2021 |
rillig | lint: enter full C90 compatibility mode
The C99 comment in tree.c:3468 has been there since 2017-03-06, without anyone complaining that their compiler would not handle it.
Strangely, running GCC 10.3.0 in '-std=c90' mode does not complain about declarations after statements, '-Wdeclaration-after-statement' is needed separately.
No functional change.
|
1.129 | 14-Sep-2021 |
rillig | lint: allow [*] everywhere where [] and [integer] are allowed
It's a seldom used feature, but now it's at least consistent.
|
1.128 | 31-Aug-2021 |
rillig | lint: remove unused function for generic messages
The function message_at is still used, for information about previous occurrences of a symbol.
|
1.127 | 28-Aug-2021 |
rillig | lint: fix a few lint warnings about type conversions
A simple 'unsigned int' is more than enough for representing the size of a bit-field, as well as the maximum alignment of any type.
No functional change.
|
1.126 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.125 | 23-Aug-2021 |
rillig | lint: expand macro in string concatenation
No functional change.
|
1.124 | 23-Aug-2021 |
rillig | lint: inline msb
This reduces the binary size on x86_64 by about 500 bytes.
No functional change.
|
1.123 | 22-Aug-2021 |
rillig | lint: merge duplicate code for binary operator
No functional change.
|
1.122 | 22-Aug-2021 |
rillig | lint: save some memory
Before lint1.h 1.47 from 2021-01-02, adjacent bit-field struct members shared storage. Restore that using smaller types.
No functional change.
|
1.121 | 01-Aug-2021 |
rillig | lint: remove hash value from symbol buffer
Conceptually, a symbol buffer does not need to remember its hash value since that belongs to the symbol table. This makes the code for the symbol table simpler. The number of hash calculations increases by about 5%, which is negligible.
No functional change.
|
1.120 | 31-Jul-2021 |
rillig | lint: improve support for __int128_t and __uint128_t
For the .ln files, I chose the letter 'J' to represent the 128-bit integer types since it is close to 'I' for int. The naming of 'L' for 'long' is obvious, but 'Q' for 64-bit integers is a quad-16-bit word, which is an unusual measurement unit nowadays. One benefit of choosing 'J' is that the next letter, 'K' can then be used for 256-bit integer types.
Support for 128-bit integer types is still very basic. Plus, it is only supported on LP64 platforms, which means that lint cannot be cross-compiled to check for an LP64 platform while running on an ILP32 platform.
|
1.119 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.118 | 23-Jul-2021 |
rillig | lint: rename cstk_t to control_statement
Rename the variables as well. Their previous name 'ci' was not easy to understand, the 'i' may have meant 'stack item'. The new name 'cs' simply means 'control statement'.
No functional change.
|
1.117 | 23-Jul-2021 |
rillig | lint: remove a few unnecessary abbreviations
No functional change.
|
1.116 | 23-Jul-2021 |
rillig | lint: make offset and alignment positive numbers
There's no use case for negative alignment or offsets in structures.
No functional change.
|
1.115 | 15-Jul-2021 |
rillig | lint: rename grammar rule 'declaration' to 'declaration_or_error'
This prepares for merging the duplicate code from top_level_declaration. The code coverage outside cgram.y is exactly the same as before.
No functional change.
|
1.114 | 10-Jul-2021 |
rillig | lint: rename clrtyp/deftyp to begin_type/end_type
The abbreviations clr/def did not make it obvious that these two functions or grammar rules form pairs.
No functional change.
|
1.113 | 08-Jul-2021 |
rillig | lint: constify keyword in lexer
No functional change.
|
1.112 | 06-Jul-2021 |
rillig | lint: rename type generic_association_types to generic_association
The word 'types' was misleading and unnecessary.
No functional change.
|
1.111 | 05-Jul-2021 |
rillig | lint: rename dinfo_t.d_stralign to d_sou_align_in_bits
When talking about alignment, offset and size of a type, the measurement unit must be mentioned in the variable name, especially when it differs from the standard unit of measurement, which is a byte, not a bit.
No functional change.
|
1.110 | 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.109 | 02-Jul-2021 |
rillig | lint: document lint1_type.t_is_enum
Enum types are subject to implicit conversions, as opposed to struct, union, pointer and function types.
|
1.108 | 28-Jun-2021 |
rillig | lint: rename pqinf_t to qual_ptr and clean up code
The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing.
The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'.
No functional change.
|
1.107 | 27-Jun-2021 |
rillig | lint: fix result type of _Generic expressions
|
1.106 | 27-Jun-2021 |
rillig | lint: fix type of pqinf.p_pcnt
A counter that can either be 0 or 1 and is never incremented is not really a counter, it's a flag.
No functional change.
|
1.105 | 20-Jun-2021 |
rillig | lint: rename val_t.v_unsigned to avoid confusion
The name v_unsigned suggested that the value would be interpreted as unsigned, which was wrong. Whether a value is signed or unsigned is decided by v_tspec instead.
Revert the previous commit for boolen constants since their value is already interpreted as unsigned, and there is no need for any warning about differences between traditional C and ANSI C since the _Bool type has only been added ten years later in C99.
The code for printing a tree node was also confused by this struct member, even with its old name v_ansiu. That code will be fixed in a follow-up commit.
No functional change.
|
1.104 | 20-Jun-2021 |
rillig | lint: rename val_t.v_ansiu to v_unsigned
When lint was written in 1995, traditional C was still nearby since C90 had been around for only 5 years. 26 years later, almost all code adheres to C90 or even C99 or C11, therefore "C90 or later" can safely be assumed as the default.
No functional change.
|
1.103 | 19-Jun-2021 |
rillig | lint: replace undefined behavior with assertion failure
Triggered by this malformed code:
struct{int;
|
1.102 | 15-Jun-2021 |
rillig | lint: replace array access with function calls
First and foremost, the test d_c99_complex_split accessed the array qlmasks out-of-bounds, with an index of 128 for the type 'double _Complex'. This invoked undefined behavior since the maximum allowed index was 64.
Replacing the raw array accesses with function calls allows for bounds checks to catch these errors early.
Determining the value bits for a 'double _Complex' does not make sense at all since it is not an integer type. This means that lint didn't handle these types correctly for several years. Support for int128_t has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex has been added in inittyp.c 1.9 from 2008-04-26.
Determining the value bits for an int128_t would make sense, but the unit tests don't contain examples for this type since at the moment all unit tests must produce the same results on 32-bit and 64-bit platforms, and the 32-bit platforms don't support int128_t.
|
1.101 | 15-May-2021 |
rillig | lint: warn about unreachable case labels for '&&'
See octeon_gmxreg.h 1.2 from 2020-06-18 for an example, where RXN_RX_INBND_SPEED was cleaned up without adjusting the corresponding code in octeon_gmx.c.
|
1.100 | 18-Apr-2021 |
rillig | branches: 1.100.2; lint: remove redundant CONSTCOND
In do-while-0 loops, these are no longer needed since tree.c 1.202 from 2021-01-31.
|
1.99 | 18-Apr-2021 |
rillig | lint: rename parameter to diagnostic functions and macros
The first parameter is not just an arbitrary number, it's a message ID.
|
1.98 | 18-Apr-2021 |
rillig | lint: align the member access macros for tnode_t
|
1.97 | 18-Apr-2021 |
rillig | lint: add error_at, warning_at, message_at
Right now there are several places in the code that use the global variable curr_pos for passing a parameter to the diagnostic functions. That's not what global variables are for.
Make it easy for the code to migrate to the parameter-passing style.
No functional change.
|
1.96 | 18-Apr-2021 |
rillig | lint: document wrong location information in diagnostics
|
1.95 | 14-Apr-2021 |
rillig | lint: add support for C11-isms such as int[static 3]
|
1.94 | 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.93 | 10-Apr-2021 |
rillig | lint: prepare renaming of 'struct type'
It's confusing to have the same struct tag in both lint1 and lint2, with mostly the same members, but also some differences. Before actually changing this, I reviewed all occurrences of the word 'type' in the code.
No functional change.
|
1.92 | 02-Apr-2021 |
rillig | lint: reduce memory usage
No functional change.
|
1.91 | 02-Apr-2021 |
rillig | lint: rename mbl to memory_block
No functional change.
|
1.90 | 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.89 | 26-Mar-2021 |
rillig | lint: rename members of struct control_statement to be more expressive
C99 does not define names for the head parts of the 'for' statements, it just calls them clause-1, expression-2 and expression-3. Therefore the rather abstract name 'expr3'.
No functional change.
|
1.88 | 26-Mar-2021 |
rillig | lint: rename pushctrl and popctrl to be more expressive
While here, remove the magic number 0 that in this context means "function body".
No functional change.
|
1.87 | 21-Mar-2021 |
rillig | lint: fix reachability for constant controlling expression in for loop
|
1.86 | 21-Mar-2021 |
rillig | lint: fix reachability computation in if statements
Previously, only loop statements were considered for reachability. This ignored the possibility of an early return in an if statement, or unreachable branches.
|
1.85 | 21-Mar-2021 |
rillig | lint: rename c_rchif to c_reached_end_of_then
No functional change.
|
1.84 | 21-Mar-2021 |
rillig | lint: rename c_cont to c_continue
No functional change.
|
1.83 | 21-Mar-2021 |
rillig | lint: document the precise meaning of control_statement.c_break
No functional change.
|
1.82 | 21-Mar-2021 |
rillig | lint: rename i_infinite to i_maybe_endless
Not every loop that has 'while (1)' is an endless loop. It may still contain a 'return' somewhere.
|
1.81 | 21-Mar-2021 |
rillig | lint: fix wrong 'falls off bottom' after return in do-while
|
1.80 | 21-Mar-2021 |
rillig | lint: rename d_fargs, d_fdpos and d_fpsyms to be less abbreviated
No functional change.
|
1.79 | 21-Mar-2021 |
rillig | lint: rename d_nedecl to d_nonempty_decl
No functional change.
|
1.78 | 21-Mar-2021 |
rillig | lint: rename d_rdcsym to d_redeclared_symbol
No functional change.
|
1.77 | 21-Mar-2021 |
rillig | lint: rename clst to case_labels
No functional change.
|
1.76 | 20-Mar-2021 |
rillig | lint: document the struct for declarations more precisely
No functional change.
|
1.75 | 19-Mar-2021 |
rillig | lint: rename in_bit to in_bits
No functional change.
|
1.74 | 18-Mar-2021 |
rillig | lint: document the initialization of an object in more detail
This will help fixing the bugs that are currently demonstrated in msg_168.c and d_struct_init_nested.c.
|
1.73 | 17-Mar-2021 |
rillig | lint: clean up documentation of dinfo_t
No functional change.
|
1.72 | 17-Mar-2021 |
rillig | lint: rename dinfo_t members to be more expressive
While here, sync redundant but diverging comments, split multi-assignments and initialize the members in declaration order.
No functional change.
|
1.71 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.70 | 07-Mar-2021 |
rillig | lint: fix off-by-one error in 'case 3...5'
According to the GCC documentation[1], the high end of the range is inclusive as well, which makes sense since otherwise there would be no way of specifying a range that includes the maximum representable number.
Since the range is not used at all in the code, none of the tests could possibly fail.
[1] https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
No functional change.
|
1.69 | 28-Feb-2021 |
rillig | lint: replace wrong comment with assertion
The broad type of a value is indeed stored in the value itself, in the member v_tspec. For nodes that refer to this value, it is redundantly stored, it always equals tn->tn_type->t_tspec.
After initialization, neither tn->tn_type nor val->v_tspec are modified. This is not ensured by the compiler but has to be analyzed manually.
No functional change.
|
1.68 | 28-Feb-2021 |
rillig | lint: rename is_nonzero to constant_is_nonzero
The new function name emphasizes that the given node must have the operator CON.
No functional change.
|
1.67 | 28-Feb-2021 |
rillig | lint: do not warn about constant expressions involving sizeof
These expressions are indeed constant for a specific platform, but on another platform their value may change. This makes them unsuspicious and legitimate for portable code.
Seen in rump_syscalls.c, as 'sizeof(int) > sizeof(register_t)'.
|
1.66 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.65 | 19-Feb-2021 |
rillig | lint: rename storage class constants to be more expressive
No functional change.
|
1.64 | 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.63 | 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.62 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.61 | 19-Feb-2021 |
rillig | lint: replace cryptic sym.s_rimpl with expressive name
No functional change.
|
1.60 | 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.59 | 18-Jan-2021 |
rillig | lint: clean up member names of control_structure and comments
|
1.58 | 17-Jan-2021 |
rillig | lint: extend a few message comments
|
1.57 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.56 | 16-Jan-2021 |
rillig | lint: in strict bool mode, integer constants do not have type bool
Previously, lint1 allowed integer constants such as 0 and 1 to be used as bool constants. This was only half-baked since after fixing all error messages from that strict mode, there may still be integer literals in the code that should be replaced with true or false. This would stop a migration from int to bool in the middle, leaving inconsistent code around.
To find the remaining type inconsistencies, treat integers and bool as completely incompatible, even for compile time constants.
|
1.55 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.54 | 15-Jan-2021 |
rillig | lint: merge duplicate code for non-zero detection
|
1.53 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.52 | 03-Jan-2021 |
rillig | lint: rename cstk to cstmt
Most of the code that deals with control statements is only interested in the innermost control statement, and not if that is a stack or not. Therefore, emphasize that part in the variable name.
The member c_next was confusing since the "direction" of this "next element" was ambiguous. In a sequence of if statements, the "next" element could have equally been the following one, not the surrounding one.
|
1.51 | 03-Jan-2021 |
rillig | lint: rename t_ispacked to t_packed and d_ispacked to d_packed
It's shorter, and the other flags of the type or declaration also don't have "is" in their names. Except for t_isenum, but that's because there is a macro named t_enum that would interfere with that name.
|
1.50 | 03-Jan-2021 |
rillig | lint: rename type.t_isfield to t_bitfield
|
1.49 | 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.48 | 02-Jan-2021 |
rillig | lint: fix lint warning 161 "constant in conditional context"
|
1.47 | 02-Jan-2021 |
rillig | lint: use bool instead of u_int:1 in structures
Better late than never.
|
1.46 | 01-Jan-2021 |
rillig | lint: un-export struct istk
|
1.45 | 30-Dec-2020 |
rillig | lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
|
1.44 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.43 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_field, s_keyw and s_xsym
|
1.42 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.41 | 30-Dec-2020 |
rillig | lint: rename remaining _nxt members to _next
|
1.40 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.39 | 30-Dec-2020 |
rillig | lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
|
1.38 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.37 | 30-Dec-2020 |
rillig | lint: reduce verbosity of assertions
Having 2 lines of source code per assertion is too much, especially since most of this code is redundant anyway. Extract the common code and the additional negation into a simple function instead.
|
1.36 | 29-Dec-2020 |
rillig | lint: rename istk_t.i_cnt to i_remaining
|
1.35 | 29-Dec-2020 |
rillig | lint: fix typo in comments
|
1.34 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.33 | 29-Dec-2020 |
rillig | lint: spell check
|
1.32 | 28-Dec-2020 |
rillig | lint1: remove unused t_field
|
1.31 | 04-Mar-2019 |
christos | Add __thread/tls_model attribute
|
1.30 | 27-Dec-2016 |
christos | branches: 1.30.14; teach lint __attribute__((__unused__))
|
1.29 | 20-Jul-2014 |
dholland | branches: 1.29.6; typo in comment
|
1.28 | 18-Apr-2014 |
christos | only fill memory with junk if BLKDEBUG
|
1.27 | 19-Apr-2013 |
christos | branches: 1.27.4; Allow linted comments to take an argument that defines which error to suppress.
|
1.26 | 17-Feb-2013 |
christos | rename enum_t to avoid rpc/types.h lossage.
|
1.25 | 24-Jun-2011 |
christos | branches: 1.25.2; 1.25.8; Always use our own align macro and explain a bit more why this is bogus.
|
1.24 | 02-Oct-2009 |
christos | recognize struct __packed x { }; in addition to struct x { } __packed;
|
1.23 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.22 | 10-Dec-2008 |
joerg | 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.
|
1.21 | 01-May-2008 |
christos | fix const and volatile printing in types.
|
1.20 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.19 | 24-Sep-2005 |
perry | branches: 1.19.20; in several comments: implizit -> implicit explizit -> explicit
|
1.18 | 17-Jul-2005 |
christos | Handle C99 array range initializers:
type a[] = { [lo ... hi] = c }:
|
1.17 | 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.16 | 21-Oct-2002 |
christos | fix typo
|
1.15 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.14 | 13-Sep-2002 |
christos | 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.
|
1.13 | 05-Feb-2002 |
thorpej | 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.
|
1.12 | 31-Jan-2002 |
tv | Provide a placebo default for ALIGN() for hosts which don't have this.
|
1.11 | 13-Dec-2001 |
augustss | 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.
|
1.10 | 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.9 | 03-Nov-1997 |
cgd | branches: 1.9.8; 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.
|
1.8 | 27-Dec-1996 |
pk | branches: 1.8.2; Splice a union in the type data structure. Some of the members can be `in use' simultaneously, e.g. an enumerated bit-field.
|
1.7 | 22-Dec-1996 |
cgd | * recognize that pointers to identical unnamed and untyped structs, unions, and enums are, in fact, identical. This is done by tagging each of unnamed and untyped structure, union and enum with a unique position of creation, which is used as a unique identifier that when determine whether or not a pair of structures, unions, or enums are identical.
|
1.6 | 02-Oct-1995 |
jpo | don't print warnings about unused variables or arguments in compound statements which contain asm statements.
|
1.5 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.4 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.3 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.8.2.1 | 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.9.8.1 | 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.19.20.1 | 18-May-2008 |
yamt | sync with head.
|
1.25.8.3 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.25.8.2 | 23-Jun-2013 |
tls | resync from head
|
1.25.8.1 | 25-Feb-2013 |
tls | resync with head
|
1.25.2.1 | 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.27.4.1 | 10-Aug-2014 |
tls | Rebase.
|
1.29.6.1 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.30.14.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.100.2.1 | 31-May-2021 |
cjep | sync with head
|
1.227.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.2 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.1 | 03-Jan-2002 |
thorpej | * 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.
|
1.84 | 24-Sep-2024 |
rillig | lint: exclude the GCC builtins from debug logging
Their source code is parsed for simplicity, and since the text is fixed, there is nothing surprising to be expected there. Instead, start debugging when the actual code begins.
|
1.83 | 12-May-2024 |
rillig | branches: 1.83.2; lint: remove unused flag '-u' from lint1
This flag is completely handled by lint2.
|
1.82 | 03-Feb-2024 |
rillig | lint: remove excessive empty lines
|
1.81 | 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.80 | 02-Feb-2024 |
rillig | lint: use the locale for interpreting wide character strings
|
1.79 | 21-Jan-2024 |
rillig | lint: create .ln output file even when queries are enabled
This allows to configure lint flags in mk.conf globally for a whole NetBSD build. Previously, this would have made the build fail due to missing .ln files.
The previous use case of rerunning lint with or without queries is easy enough to achieve by doing a 'make clean', in the same way as for lint warnings.
|
1.78 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.77 | 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.76 | 29-Jul-2023 |
rillig | lint: condense code for ending a function
No functional change.
|
1.75 | 29-Jul-2023 |
rillig | lint: use standard function attribute for noreturn functions
|
1.74 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.73 | 08-Jul-2023 |
rillig | lint: use consistent conditional compilation guards
|
1.72 | 07-Jul-2023 |
rillig | lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only combining them if actually desired.
|
1.71 | 03-Jul-2023 |
rillig | lint: sync usage messages with reality
|
1.70 | 03-Jul-2023 |
rillig | lint: invert the -u, -v and -z flags
Now they behave the same as in the manual page.
No functional change.
|
1.69 | 03-Jul-2023 |
rillig | lint: remove redundant comments for command line flags
|
1.68 | 03-Jul-2023 |
rillig | lint: fix C11 mode to not allow C23 features (since yesterday)
|
1.67 | 02-Jul-2023 |
rillig | lint: add initial support for C23
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
|
1.66 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.65 | 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.64 | 01-Jul-2022 |
rillig | lint: move error handling code from main1.c to err.c
No functional change.
|
1.63 | 30-May-2022 |
rillig | lint: report proper file name in assertion failures
When given the (obviously malformed) translation unit 'f=({;};}', lint runs into an assertion failure. It reported this as occurring near ':1'. This location was missing a filename since the input didn't contain a GCC line number directive such as '# 2 "input.c"'. In GCC mode, the GCC builtins are loaded first, in which case the reported location was ':9'.
Fix this by providing proper location information, even for input that does not come from the GCC C preprocessor.
|
1.62 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.61 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.60 | 16-Apr-2022 |
rillig | lint: model C language levels in a future-compatible way
The options -t, -s and -S are confusing because they are used inconsistently. The option -S enables C99 features, but when using it instead of -s, it also doesn't enable all checks required by C90 and later. Prepare fixing of these inconsistencies by replacing the flag variables with language levels that can be extended in a straight-forward way as new C standards arrive.
| option | allow_trad | allow_c90 | allow_c99 | allow_c11 | |--------|------------|-----------|-----------|-----------| | -t | x | - | - | - | | (none) | x | x | - | - | | -s | - | x | - | - | | -S | - | x | x | - | | -Ac11 | - | x | x | x |
Each usage of the old flag variables will be inspected and migrated individually, to clean up the subtle variations in the conditions and to provide a simpler model.
When lint was created in 1995, its focus was migrating traditional C code to C90 code. Lint does not help in migrating from C90 to C99 or from C99 to C11 since there are only few silent changes, and simply because nobody took the time to implement these migration aids. If necessary, such migration modes could be added separately.
There is a small functional change: when the option -s is combined with either -S or -Ac11, lint now only keeps the last of these options. Previously, these options could be combined, leading to a mixture of language levels, halfway between C90, C99 and C11. Especially combining traditional C with C11 doesn't make sense, but xlint currently allows it.
The 3 tests that accidentally specified multiple language levels have been adjusted to a single language level.
|
1.59 | 27-Feb-2022 |
rillig | lint: C99 has been released, so refer to it by its proper name
|
1.58 | 17-Dec-2021 |
rillig | lint: in GCC mode, declare alloca and variants
The prototype declarations define the correct parameter types of these functions so that they are no longer subject to the default argument promotions (C11 6.5.2.2p6).
The GCC builtins are only recognized in GCC mode (-g).
|
1.57 | 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.56 | 17-Aug-2021 |
rillig | lint: extract suppress_messages from main
No functional change.
|
1.55 | 17-Aug-2021 |
rillig | lint: sync usage message with reality
|
1.54 | 17-Aug-2021 |
rillig | lint: move GCC builtins into gcc_builtins
No functional change.
|
1.53 | 01-Aug-2021 |
rillig | lint: merge duplicate debugging code
The functions 'debug_node' and 'display_expression' were similar enough to be merged.
Migrate debug_node to use the existing debug logging functions.
Remove the now unused option 'd' from the options string.
|
1.52 | 01-Aug-2021 |
rillig | lint: remove option -d, clean up debug logging
The command line option -d was not used by /usr/bin/lint, and it only triggered a handful of debug messages. Move this debug logging over to the compile-time -DDEBUG setting.
Move display_expression further up to avoid the forward declaration.
|
1.51 | 01-Aug-2021 |
rillig | lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault, probably related to the symbol table. To better understand this part, log insertions and deletions.
The other debug log messages do not need to mention the current file position anymore, this is what lex_next_line takes care of since scan.l 1.113 from 2021-01-05.
|
1.50 | 31-Jul-2021 |
rillig | lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.
Remove the debug_step0 macro and its relatives since lint already uses enough other features from C99 that it essentially requires this standard, which supports varargs macro arguments. Among these features are __func__ and printf("%zu").
In non-debug mode, do not evaluate the arguments of debug_step. Evaluating the arguments had caused an internal error when running the test op_shl_lp64. This is indeed a bug since initdecl should have initialized the type table for __uint128_t. This had been forgotten when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.
No functional change.
|
1.49 | 04-Jul-2021 |
rillig | lint: sync stdout and stderr when compiled in debug mode
If lint is compiled with -DDEBUG, its debug output goes to stdout, no matter whether the option -d is given or not.
|
1.48 | 03-Jul-2021 |
rillig | lint: do not define 'long double' GCC builtins for traditional C
|
1.47 | 03-Jul-2021 |
rillig | lint: make stdout unbuffered in debug mode
Some debug log messages are on stdout, others on stderr. Make sure that they occur in the correct order, even when the output is redirected.
|
1.46 | 27-Jun-2021 |
rillig | lint: fix option -Ac11, add test for _Generic
Previously, selecting the option -Ac11 allowed features from C11 but at the same time prohibited 'long long', which was added in C99. This was caused by the option -s, which is interpreted as "allow features from C90, but no later".
The test for _Generic, which has been added in C11, demonstrates that the current implementation is broken. Lint currently thinks that the return type of a _Generic selection is the type of the expression, but it really is the type of the selected expression. In the current tests, this is always 'const char *', but C11 does not require that the types of a generic selection are compatible.
|
1.45 | 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.44 | 18-Apr-2021 |
rillig | lint: clean up option parsing
|
1.43 | 14-Apr-2021 |
rillig | lint: add option to accept C11 features
The list of available letters for the command line options gets shorter and shorter. Most of the interesting letters are already used for some warning categories. Curiously, -A, -W and -E were all still available.
The option -A nicely matches the intention of the option, which is to allow a certain set of language features. To keep the option available for further extensions, define -Ac11 as the currently only valid option of that kind. This allows straight-forward extension for C17 and future language standards, as well as independent feature-sets. The options -W and -E may someday complement the -A option, using the allow/warn/error categories.
|
1.42 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.41 | 28-Mar-2021 |
rillig | lint: only define GCC builtins if -g is given
This removes 7 wrong warnings when running lint in -t mode.
Surprisingly, this added a warning that had not been there before in msg_189.c. This is because check_variable_usage skips the checks when an error occurred before. All diagnostics that happened were warnings, but the -w option treats them as errors, see vwarning.
|
1.40 | 27-Mar-2021 |
rillig | lint: rename fnaddreplsrcdir to something less cryptic
No functional change.
|
1.39 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.38 | 20-Mar-2021 |
rillig | lint: remove redundant operator properties table
It's enough to have modtab, which describes the properties of the various operators. There is no need to have a second table imods that holds the same content. Rather make modtab constant as well.
The only possible functional change is that the names of the internal operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in diagnostics, where previously lint invoked undefined behavior by passing a null pointer for a '%s' conversion specifier.
|
1.37 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.36 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.35 | 12-Jan-2021 |
rillig | lint: update usage for lint1 and lint2
(Forgotten in the previous commit.)
|
1.34 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.33 | 10-Jan-2021 |
rillig | lint: remove redundant parentheses around return value
|
1.32 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.31 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.30 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.29 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.28 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.27 | 23-Dec-2018 |
christos | yydebug is now available only if YYDEBUG is set.
|
1.26 | 24-Dec-2016 |
christos | branches: 1.26.12; 1.26.14; Add -R (source filename remapping) for MKREPRO
|
1.25 | 18-Apr-2014 |
christos | branches: 1.25.6; provide a poor man's fmemopen()
|
1.24 | 18-Apr-2014 |
christos | don't include fmemopen in tools builds. Since tools does not define _NETBSD_SOURCE, we don't get the fmemopen prototype
|
1.23 | 18-Apr-2014 |
christos | builtins only for NetBSD since fmemopen is not portable.
|
1.22 | 18-Apr-2014 |
christos | Add some builtins
|
1.21 | 19-Apr-2013 |
christos | branches: 1.21.4; Allow linted comments to take an argument that defines which error to suppress.
|
1.20 | 27-Mar-2012 |
christos | branches: 1.20.2; more cross lint friendlyness XXX: needs more constants converted double/float
|
1.19 | 31-Jul-2008 |
christos | branches: 1.19.2; 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.
|
1.18 | 02-May-2008 |
christos | branches: 1.18.2; Since we cannot guarantee that all machines do ieee math, or that they have the proper math setup deal with SIGFPE directly.
|
1.17 | 08-Nov-2006 |
christos | branches: 1.17.16; - add debugging to track nowarns - make /*LINTED*/ take effect on unused functions
|
1.16 | 24-Sep-2005 |
perry | in several comments: implizit -> implicit explizit -> explicit
|
1.15 | 20-Jun-2004 |
jmc | 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
|
1.14 | 18-Apr-2003 |
lukem | branches: 1.14.2; clear errno before strto(u)l() if we're going to test it for ERANGE afterwards
|
1.13 | 21-Oct-2002 |
christos | support for c99 style and gnu style structure and union named initializers.
|
1.12 | 31-Jan-2002 |
tv | Use setprogname() in main().
|
1.11 | 29-Jan-2002 |
tv | Remove #include <err.h> (now in lint.h).
|
1.10 | 13-Dec-2001 |
augustss | 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.
|
1.9 | 04-Dec-2001 |
wiz | Replace some misuses of "then" with "than".
|
1.8 | 28-May-2001 |
lukem | 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.
|
1.7 | 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.6 | 20-Feb-2001 |
cgd | use getprogname()
|
1.5 | 06-Jul-2000 |
christos | add 3 new flags: -m print message list -X <id>[,<id>]... suppress error messages with give ids. -w treat warnings as errors.
|
1.4 | 22-Feb-1998 |
christos | WARNSify
|
1.3 | 02-Oct-1995 |
jpo | 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.
|
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.14.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.15 (requested by jmc in ticket #527): 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
|
1.17.16.1 | 18-May-2008 |
yamt | sync with head.
|
1.18.2.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.19.2.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.19.2.1 | 17-Apr-2012 |
yamt | sync with head
|
1.20.2.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.20.2.1 | 23-Jun-2013 |
tls | resync from head
|
1.21.4.1 | 10-Aug-2014 |
tls | Rebase.
|
1.25.6.1 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.26.14.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.26.12.1 | 26-Dec-2018 |
pgoyette | Sync with HEAD, resolve a few conflicts
|
1.83.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.11 | 08-Jun-2024 |
rillig | lint.7: abbreviate %lld to %d in the list of messages
|
1.10 | 11-May-2024 |
rillig | lint: warn when comparing an integer to a floating point constant
|
1.9 | 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.8 | 06-Feb-2024 |
rillig | lint.7: remove implementation details from message list
From a user's perspective, it's irrelevant whether a lint message is generated using '%s' or '%.*s'; same for the integer widths, as they are platform-dependent.
|
1.7 | 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.6 | 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.5 | 05-Sep-2021 |
rillig | lint: generate date of lint.7 from err.c
|
1.4 | 05-Sep-2021 |
rillig | lint.7: document removed messages
Having just an empty string as the message was confusing.
|
1.3 | 30-Apr-2008 |
martin | Convert TNF licenses to new 2 clause variant
|
1.2 | 19-Dec-2006 |
christos | branches: 1.2.10; No need to leave a lot of space between the error number and the message.
|
1.1 | 06-Jul-2000 |
christos | new script to generate a man page of error messages that lint generates
|
1.2.10.1 | 18-May-2008 |
yamt | sync with head.
|
1.5 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.4 | 28-May-2001 |
lukem | 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.
|
1.3 | 22-Feb-1998 |
christos | WARNSify
|
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.77 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.76 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.75 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.74 | 12-Aug-2023 |
rillig | lint: for each record in the output file, write the newline immediately
There's no point delaying the '\n' until the next line is written.
|
1.73 | 30-Jul-2023 |
rillig | lint: in memory debug mode, log the type of the nodes
First log all objects to be freed, then free them all at once. This allows cross references from the objects of a block independent of their allocation order.
|
1.72 | 29-Jul-2023 |
rillig | lint: fix use-after-free in memory debug mode
A node may be allocated before its type. Since the objects are freed in reverse allocation order, the type cannot be accessed anymore when the node is freed.
|
1.71 | 15-Jul-2023 |
rillig | lint: extend debug logging for memory management
|
1.70 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.69 | 15-Jul-2023 |
rillig | lint: add debug logging for memory management and the symbol table
|
1.68 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.67 | 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.66 | 30-Jun-2023 |
rillig | lint: clean up tree.c
No functional change.
|
1.65 | 11-Apr-2023 |
rillig | lint: condense code
No functional change.
|
1.64 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.63 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.62 | 02-Apr-2022 |
rillig | lint: use appropriate alignment on both the host and target platform
|
1.61 | 27-Feb-2022 |
rillig | lint: clean up code for handling filenames
No functional change.
|
1.60 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.59 | 27-Feb-2022 |
rillig | lint: clean up memory allocation
No functional change.
|
1.58 | 27-Feb-2022 |
rillig | lint: remove custom free list for memory blocks
Trust the system memory allocator to do its thing, including marking the memory as fresh or freed. One less thing to worry about.
|
1.57 | 25-Dec-2021 |
rillig | lint: don't try to trick mathematics by defining ZERO to a nonzero value
No binary change.
|
1.56 | 21-Dec-2021 |
rillig | lint: invert condition in build_name
No functional change.
|
1.55 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.54 | 16-Nov-2021 |
rillig | lint: remove outdated comment
The bug has been fixed in cgram.y 1.369 a few minutes ago.
|
1.53 | 16-Nov-2021 |
rillig | tests/lint: explain the missing error message in strict bool mode
There are 2 separate bugs that lead to the missing error message.
The first bug is that when parsing a name, the information about whether that name comes from a system header is not properly recorded for the last token before switching from or to a system header.
The second bug is that for determining whether the type of a function call expression is relaxed, the types of the function call arguments are taken into account, even though the type only depends on the function itself. The same idea applies to the operators '<<' and '>>', as their result type only depends on the left operand, at least since C90.
|
1.52 | 31-Aug-2021 |
rillig | lint: fix memory allocation (since 2021-08-28)
In mem1.c 1.50 and mem2.c 1.13 from 2021-08-28, I accidentally changed the initialization of mblklen from round_up to round_down, trying to avoid a division instruction.
On NetBSD x86_64 this resulted in a few more malloc calls, but on Cygwin with its 64k pagesize, mblklen became 0. Later, the function xalloc in lint2 called xalloc(mblklen) and blindly assumed that the returned memory would be large enough. This in turn led to out-of-bounds memory access and crashes. Lint1 was not affected since it adjust mblklen during runtime if it gets too small.
|
1.51 | 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.50 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types
Lint does not need to support any types larger than 256 MB since they don't occur in practice. Practically, such large types have never been supported at all since the function type_size_in_bits used int for the internal calculations, resulting in overflows.
|
1.49 | 10-Aug-2021 |
rillig | lint: remove redundant function prototypes
|
1.48 | 10-Aug-2021 |
rillig | lint: clean up comments
|
1.47 | 01-Aug-2021 |
rillig | lint: unexport nomem
No functional change.
|
1.46 | 01-Aug-2021 |
rillig | lint: remove xmapalloc
Just trust the standard malloc to be smart enough.
No functional change.
|
1.45 | 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.44 | 20-Jun-2021 |
rillig | lint: sprinkle const in memory management
No functional change.
|
1.43 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.42 | 02-Apr-2021 |
rillig | lint: rename members of struct memory_block
No functional change.
|
1.41 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.40 | 02-Apr-2021 |
rillig | lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the scope of the current expression. This was misleading before since the other related functions all have a 't' (probably for 'temporary') in their names.
Also encode in the function name that the returned memory is zeroed out as that could not be inferred from the old name.
No functional change.
|
1.39 | 02-Apr-2021 |
rillig | lint: extract filename ID counter into separate function
No functional change.
|
1.38 | 02-Apr-2021 |
rillig | lint: rename mbl to memory_block
No functional change.
|
1.37 | 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.36 | 27-Mar-2021 |
rillig | lint: clean up code for filename management
In add_directory_replacement, the expression 'r->repl - r->orig' looked strange, as if two pointers into separate objects were subtracted.
The code was probably optimized to a particular compiler on a particular platform to generate fast and simple code. Since compilers have made considerable progress over the last 25 years, optimize the code for human legibility instead. The compilers will somehow cope with that.
No functional change.
|
1.35 | 27-Mar-2021 |
rillig | lint: rename filename_replacement.len to orig_len
No functional change.
|
1.34 | 27-Mar-2021 |
rillig | lint: rename global variables in filename management
No functional change.
|
1.33 | 27-Mar-2021 |
rillig | lint: rename srchfn to search_filename, return const value
No functional change.
|
1.32 | 27-Mar-2021 |
rillig | lint: rename types in filename management
No functional change.
|
1.31 | 27-Mar-2021 |
rillig | lint: reduce indentation in fnnalloc
No functional change.
|
1.30 | 27-Mar-2021 |
rillig | lint: rename fnaddreplsrcdir to something less cryptic
No functional change.
|
1.29 | 27-Mar-2021 |
rillig | lint: remove unused fnalloc
|
1.28 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.27 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.26 | 21-Feb-2021 |
rillig | lint: clean up comments in mem1.c
The comment for tgetblk had been misplaced.
|
1.25 | 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.24 | 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.23 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.22 | 04-Jan-2021 |
rillig | lint: reduce comment for xgetblk to the actually interesting part
|
1.21 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.20 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.19 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.18 | 24-Dec-2016 |
christos | Add -R (source filename remapping) for MKREPRO
|
1.17 | 18-Apr-2014 |
christos | branches: 1.17.6; only fill memory with junk if BLKDEBUG
|
1.16 | 17-Apr-2014 |
christos | Trash freed memory so we catch bad uses.
|
1.15 | 24-Jun-2011 |
christos | branches: 1.15.2; 1.15.8; 1.15.18; Always use our own align macro and explain a bit more why this is bogus.
|
1.14 | 17-Jan-2011 |
christos | PR/44235: Valeriy E. Ushakov: Don't pick up a block from the free list if it is not big enough, allocate a new one. XXX: this is inefficient, but at least it does not end up corrupting memory.
|
1.13 | 05-Aug-2009 |
wiz | Fix typos in comment.
|
1.12 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.11 | 20-Jun-2004 |
jmc | branches: 1.11.36; 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
|
1.10 | 21-Oct-2003 |
christos | branches: 1.10.2; 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.
|
1.9 | 20-Jan-2003 |
simonb | The Double-Semi-Colon Police.
|
1.8 | 28-Jun-2002 |
jmc | 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).
|
1.7 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.6 | 29-Jan-2002 |
tv | Remove #include <err.h> (now in lint.h).
|
1.5 | 28-May-2001 |
lukem | 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.
|
1.4 | 13-Mar-2000 |
soren | Fix doubled 'the's.
|
1.3 | 22-Feb-1998 |
christos | WARNSify
|
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.10.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.11 (requested by jmc in ticket #527): 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
|
1.11.36.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.15.18.1 | 10-Aug-2014 |
tls | Rebase.
|
1.15.8.1 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.15.2.1 | 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.17.6.1 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.14 | 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.13 | 05-Jan-2021 |
rillig | lint: swap columns 1 and 2 in ops.def
List the ID of a record first, followed by the describing fields.
|
1.12 | 05-Jan-2021 |
rillig | lint: make generating the operators table simpler
The generated files are exactly the same as before.
|
1.11 | 31-Dec-2020 |
rillig | lint: in mkops, replace printf with println
One less backslash per line of code.
|
1.10 | 30-Dec-2020 |
rillig | lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
|
1.9 | 28-Dec-2020 |
rillig | lint: remove trailing whitespace
|
1.8 | 07-Feb-2011 |
christos | branches: 1.8.2; weprovidedarracount()sothatwedon'tneedtosqueezethespacesout.
|
1.7 | 07-Feb-2011 |
christos | provide __arraycount() if not there.
|
1.6 | 06-Feb-2011 |
pooka | don't use __arraycount in tools
|
1.5 | 06-Feb-2011 |
christos | use unsigned char instead of uint8_t, easier for portability
|
1.4 | 05-Feb-2011 |
christos | fix missing comparison
|
1.3 | 05-Feb-2011 |
christos | copyright date
|
1.2 | 05-Feb-2011 |
christos | as promised make the last ops table auto-generated.
|
1.1 | 05-Feb-2011 |
christos | oops forgot to commit the script.
|
1.8.2.2 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.8.2.1 | 07-Feb-2011 |
bouyer | file mkops was added on branch bouyer-quota2 on 2011-02-08 16:20:13 +0000
|
1.28 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.27 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.26 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.25 | 14-Sep-2023 |
rillig | lint: reduce pointer dereferences and relocations
No functional change.
|
1.24 | 14-Sep-2023 |
rillig | lint: remove pseudo operators INC and DEC
These operators were not used in expressions, they were only used as additional token info. Use a plain bool instead.
No functional change.
|
1.23 | 14-Sep-2023 |
rillig | lint: remove preprocessor magic from definition of operators
No binary change.
|
1.22 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.21 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.20 | 15-Jun-2022 |
rillig | lint: rename mod_t.m_requires_bool to m_compares_with_zero
The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict bool mode, in default mode they accept any scalar expression and compare it with zero. The new names are more accurate.
No functional change.
|
1.19 | 16-Apr-2022 |
rillig | lint: merge mod_t.m_test_context into m_requires_bool
These two flags mean exactly the same.
No functional change.
|
1.18 | 16-Apr-2022 |
rillig | lint: rename members of tnode_t to more closely match reality
The flags do not describe the left operand of the node but both, as for most operators, either none or both operands are in test context or in value context.
The one exception is the operator '?' from the '?:' conditional, for which the left operand is in test context and the right operand is in value context.
No binary change.
|
1.17 | 19-Aug-2021 |
rillig | lint: un-abbreviate parameter names of macro
|
1.16 | 20-Mar-2021 |
rillig | lint: move getopname over to tree.c
Except for the one use in print_tnode, the name of the operator is only used in tree.c.
No functional change.
|
1.15 | 20-Mar-2021 |
rillig | lint: remove redundant operator properties table
It's enough to have modtab, which describes the properties of the various operators. There is no need to have a second table imods that holds the same content. Rather make modtab constant as well.
The only possible functional change is that the names of the internal operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in diagnostics, where previously lint invoked undefined behavior by passing a null pointer for a '%s' conversion specifier.
|
1.14 | 20-Mar-2021 |
rillig | lint: fix argument names and table headings for operator definitions
The abbreviations in the table of operator properties had been wrong since ops.def 1.10 from 2021-01-12, when strict bool mode was added. In an earlier working draft, I had named that column 'takes_others' instead of 'requires_bool', that's where the 'o' came from.
The names of the macro arguments had been wrong since op.h 1.11 from 2021-01-09, when the order of the columns changed and the macros were not adjusted accordingly. Since all the properties of the operator table are uniform, this didn't result in any bugs, it was just confusing for human readers.
Clang-tidy suggests to enclose the macro arguments in oper.c in parentheses but that is not possible since the arguments are either empty or 1, and the syntactical ambiguity of the '+ 0' being either a unary or a binary operator is needed here.
No change to the resulting binary.
|
1.13 | 17-Jan-2021 |
rillig | lint: rename mod_t members
|
1.12 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.11 | 09-Jan-2021 |
rillig | lint: reorder table of operator properties
The 4 "requires" properties are now listed together, in descending strictness.
|
1.10 | 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.9 | 04-Jan-2021 |
rillig | lint: precedence confusion is only possible with binary operators
No functional change.
The operator table in ops.def states that every operator that has possibly confusing precedence is also a binary operator, so assert that instead of having two different code paths.
|
1.8 | 02-Jan-2021 |
rillig | lint: use bool instead of u_int:1 in structures
Better late than never.
|
1.7 | 28-Dec-2020 |
rillig | lint: rename fields in mod_t
|
1.6 | 05-Feb-2011 |
christos | as promised make the last ops table auto-generated.
|
1.5 | 04-Feb-2011 |
christos | generate ops table dynamically. Will move the other table from tree.c there too.
|
1.4 | 25-Apr-2008 |
christos | branches: 1.4.18; preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.3 | 27-Jul-1998 |
mycroft | branches: 1.3.44; Fix a recurring typo: comparision -> comparison.
|
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.3.44.1 | 18-May-2008 |
yamt | sync with head.
|
1.4.18.1 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.16 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.15 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.14 | 14-Sep-2023 |
rillig | lint: remove pseudo operators INC and DEC
These operators were not used in expressions, they were only used as additional token info. Use a plain bool instead.
No functional change.
|
1.13 | 14-Sep-2023 |
rillig | lint: remove preprocessor magic from definition of operators
No binary change.
|
1.12 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.11 | 16-Apr-2022 |
rillig | lint: merge mod_t.m_test_context into m_requires_bool
These two flags mean exactly the same.
No functional change.
|
1.10 | 02-Aug-2021 |
rillig | lint: expand abbreviations in definitions of operator properties
No functional change.
|
1.9 | 20-Mar-2021 |
rillig | lint: move getopname over to tree.c
Except for the one use in print_tnode, the name of the operator is only used in tree.c.
No functional change.
|
1.8 | 20-Mar-2021 |
rillig | lint: remove redundant operator properties table
It's enough to have modtab, which describes the properties of the various operators. There is no need to have a second table imods that holds the same content. Rather make modtab constant as well.
The only possible functional change is that the names of the internal operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in diagnostics, where previously lint invoked undefined behavior by passing a null pointer for a '%s' conversion specifier.
|
1.7 | 20-Mar-2021 |
rillig | lint: fix argument names and table headings for operator definitions
The abbreviations in the table of operator properties had been wrong since ops.def 1.10 from 2021-01-12, when strict bool mode was added. In an earlier working draft, I had named that column 'takes_others' instead of 'requires_bool', that's where the 'o' came from.
The names of the macro arguments had been wrong since op.h 1.11 from 2021-01-09, when the order of the columns changed and the macros were not adjusted accordingly. Since all the properties of the operator table are uniform, this didn't result in any bugs, it was just confusing for human readers.
Clang-tidy suggests to enclose the macro arguments in oper.c in parentheses but that is not possible since the arguments are either empty or 1, and the syntactical ambiguity of the '+ 0' being either a unary or a binary operator is needed here.
No change to the resulting binary.
|
1.6 | 20-Mar-2021 |
rillig | lint: make lint's own code pass the strict bool mode
No functional change.
|
1.5 | 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.4 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.3 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.2 | 09-Jan-2021 |
rillig | lint: make the table containing the operator properties more readable
The C preprocessor does not require its arguments to be expressions, an empty string is valid as well. This allows to replace the 0 in the operator properties table with a space, making the 1 stick out.
Since the table is quite long, divide it into sections and add section headers.
No change in the generated code.
|
1.1 | 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.2 | 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.1 | 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.32 | 14-Sep-2023 |
rillig | lint: remove preprocessor magic from definition of operators
No binary change.
|
1.31 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.30 | 03-Jun-2023 |
rillig | lint: loosen assertion that unary operators have only a single operand
|
1.29 | 15-Jun-2022 |
rillig | lint: update comments in operator table
No binary change.
|
1.28 | 16-Apr-2022 |
rillig | lint: merge mod_t.m_test_context into m_requires_bool
These two flags mean exactly the same.
No functional change.
|
1.27 | 16-Apr-2022 |
rillig | lint: clean up table with operator properties
Now that lint may use C99, make use of empty macro arguments.
No binary change.
|
1.26 | 16-Apr-2022 |
rillig | lint: rename members of tnode_t to more closely match reality
The flags do not describe the left operand of the node but both, as for most operators, either none or both operands are in test context or in value context.
The one exception is the operator '?' from the '?:' conditional, for which the left operand is in test context and the right operand is in value context.
No binary change.
|
1.25 | 10-Sep-2021 |
rillig | lint: replace space followed by tab with simply tab
No functional change.
|
1.24 | 14-Aug-2021 |
rillig | lint: allow initialization of struct with constant member
The operator INIT, just like RETURN and FARG, initializes an object with an expression. The target object of such an initialization may be a struct with constant members.
The operator ASSIGN, on the other hand, is entirely different. It overwrites the existing value of the object, and this is not allowed for structs that have a constant member. Therefore it was wrong to use the operator ASSIGN for initialization.
|
1.23 | 10-Aug-2021 |
rillig | lint: fix documentation of FARG and PUSH
|
1.22 | 10-Aug-2021 |
rillig | lint: document the difference between FARG and PUSH
|
1.21 | 10-Aug-2021 |
rillig | lint: document operator properties directly at the definition
|
1.20 | 01-Apr-2021 |
rillig | lint: replace empty macro arguments with non-empty arguments
Empty arguments are a new feature of C99. Since lint is one of the build tools, it is supposed to only use C90 features. C99 6.10.3 "Macro replacement" explicitly allows empty macro arguments while C90 3.8.3 "Macro replacement" last sentence defines an empty macro argument as undefined behavior.
This change makes the '1's stick out less from the table. I tried to use '.' instead of '-' as well, but that made it too hard to see the commas.
No functional change.
|
1.19 | 20-Mar-2021 |
rillig | lint: remove redundant operator properties table
It's enough to have modtab, which describes the properties of the various operators. There is no need to have a second table imods that holds the same content. Rather make modtab constant as well.
The only possible functional change is that the names of the internal operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in diagnostics, where previously lint invoked undefined behavior by passing a null pointer for a '%s' conversion specifier.
|
1.18 | 20-Mar-2021 |
rillig | lint: fix argument names and table headings for operator definitions
The abbreviations in the table of operator properties had been wrong since ops.def 1.10 from 2021-01-12, when strict bool mode was added. In an earlier working draft, I had named that column 'takes_others' instead of 'requires_bool', that's where the 'o' came from.
The names of the macro arguments had been wrong since op.h 1.11 from 2021-01-09, when the order of the columns changed and the macros were not adjusted accordingly. Since all the properties of the operator table are uniform, this didn't result in any bugs, it was just confusing for human readers.
Clang-tidy suggests to enclose the macro arguments in oper.c in parentheses but that is not possible since the arguments are either empty or 1, and the syntactical ambiguity of the '+ 0' being either a unary or a binary operator is needed here.
No change to the resulting binary.
|
1.17 | 18-Mar-2021 |
rillig | lint: rename operator 'const' to 'constant'
The previous name could be too easily confused with the type qualifier 'const'. The operator name is mainly used in the debug log, only occasionally in the output. Since 'constant' is not a "real" operator, it probably doesn't occur in messages at all.
|
1.16 | 20-Feb-2021 |
rillig | lint: add test for using a bool as array index in strict bool mode
|
1.15 | 17-Jan-2021 |
rillig | lint: rename bitwise operators
When there are several variants of the AND operator, both of them should get a distinguishing prefix, otherwise it's not clear which of the two possible operators is meant by the plain AND.
|
1.14 | 17-Jan-2021 |
rillig | lint: rename operator STAR to INDIR
C99 calls this operator the "indirection operator". The word "star" does not occur in the index of that standard.
|
1.13 | 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.12 | 16-Jan-2021 |
rillig | lint: in strict bool mode, perform the normal checks as well
|
1.11 | 15-Jan-2021 |
rillig | lint: in strict bool mode, allow bool as operands of the comma operator
|
1.10 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.9 | 09-Jan-2021 |
rillig | lint: make the table containing the operator properties more readable
The C preprocessor does not require its arguments to be expressions, an empty string is valid as well. This allows to replace the 0 in the operator properties table with a space, making the 1 stick out.
Since the table is quite long, divide it into sections and add section headers.
No change in the generated code.
|
1.8 | 09-Jan-2021 |
rillig | lint: reorder table of operator properties
The 4 "requires" properties are now listed together, in descending strictness.
|
1.7 | 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.6 | 05-Jan-2021 |
rillig | lint: clean up symbolic operator names that are used in the messages
Including the "p" in the symbolic operator names was questionable, for several reasons:
1. The "p" could be taken to mean an actual variable name, which is confusing if the function doesn't have such a variable, or even more so if the line contains an unrelated variable called "p".
2. For the binary operators, having the "p" mentioned on both sides of the operator (such as in "p + p") wrongly suggested that both operands of the expression were the same.
3. The name "p" often stands for a pointer. Most of the operators don't accept pointers, therefore the name was misleading.
For these reasons, the "p" was removed from the symbolic name of all operators. This makes several pairs of operators indistinguishable:
INCBEF == INCAFT DECBEF == DECAFT UPLUS == PLUS UMINUS == MINUS STAR == MULT AMPER == AND
This is not expected to create any confusion since C programmers are expected to know these double meanings.
The symbolic names for SHLASS and SHRASS were missing the '=' before. This was added since omitting it was probably an oversight.
|
1.5 | 05-Jan-2021 |
rillig | lint: swap columns 1 and 2 in ops.def
List the ID of a record first, followed by the describing fields.
|
1.4 | 05-Jan-2021 |
rillig | lint: make generating the operators table simpler
The generated files are exactly the same as before.
|
1.3 | 05-Jan-2021 |
rillig | lint: fix inconsistent whitespace in ops.def
|
1.2 | 05-Feb-2011 |
christos | branches: 1.2.2; as promised make the last ops table auto-generated.
|
1.1 | 04-Feb-2011 |
christos | generate ops table dynamically. Will move the other table from tree.c there too.
|
1.2.2.2 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.2.2.1 | 05-Feb-2011 |
bouyer | file ops.def was added on branch bouyer-quota2 on 2011-02-08 16:20:13 +0000
|
1.18 | 18-Jan-2002 |
thorpej | * Move stuff shared between lint1 and lint2 to the new common/ directory. * Move the arch/ directory out of lint1/ into the top-level.
|
1.17 | 28-Oct-2001 |
yamt | our wchar_t is int, not short.
|
1.16 | 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.15 | 06-Oct-2001 |
bjh21 | On ARM ELF platforms, size_t and ptrdiff_t are u_long and long respectively. See <arm/ansi.h>.
|
1.14 | 17-Aug-2001 |
eeh | Don't use long double on sparc64 since the compiler is borked.
|
1.13 | 10-Feb-2001 |
bjh21 | __arm26__ || __arm32__ -> __arm__
|
1.12 | 08-Nov-2000 |
mrg | sparc & sparc64 use `long' for ptrdiff_t.
|
1.11 | 09-May-2000 |
bjh21 | Initial commit of arm26 port
|
1.10 | 09-Apr-2000 |
bad | Catch up with changing size_t to ulong on sparc 10 months ago.
|
1.9 | 12-Sep-1999 |
itojun | add "#ifdef __sh3__" section. (part of NetBSD/sh3 patches)
|
1.8 | 08-Oct-1998 |
wsanchez | Add __ppc__ test
|
1.7 | 19-Apr-1997 |
thorpej | Add support for the PowerPC.
|
1.6 | 01-Apr-1996 |
mark | Define PTRDIFF_IS_LONG and SIZEOF_IS_ULONG for the arm32 port.
|
1.5 | 17-Dec-1995 |
jonathan | Add PTRDIFF_IS_LONG and SIZEOF_IS_ULONG config entries for (32-bit) mips.
|
1.4 | 23-Jul-1995 |
ragge | Added vax support.
|
1.3 | 04-Jul-1995 |
cgd | use correct cpp defines for various archs, define params for the alpha
|
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.16 | 25-Jul-2021 |
rillig | lint: move scl_name from print.c to decl.c
It is only needed there.
|
1.15 | 20-Jun-2021 |
rillig | lint: remove unused print_tnode
The function display_expression serves the same purpose and prints more details.
|
1.14 | 20-Jun-2021 |
rillig | lint: rename val_t.v_unsigned to avoid confusion
The name v_unsigned suggested that the value would be interpreted as unsigned, which was wrong. Whether a value is signed or unsigned is decided by v_tspec instead.
Revert the previous commit for boolen constants since their value is already interpreted as unsigned, and there is no need for any warning about differences between traditional C and ANSI C since the _Bool type has only been added ten years later in C99.
The code for printing a tree node was also confused by this struct member, even with its old name v_ansiu. That code will be fixed in a follow-up commit.
No functional change.
|
1.13 | 20-Jun-2021 |
rillig | lint: rename val_t.v_ansiu to v_unsigned
When lint was written in 1995, traditional C was still nearby since C90 had been around for only 5 years. 26 years later, almost all code adheres to C90 or even C99 or C11, therefore "C90 or later" can safely be assumed as the default.
No functional change.
|
1.12 | 19-Jun-2021 |
rillig | lint: in debug mode, print name of the "storage class"
This helps in tracking down the internal errors related to declarations, found by running afl.
|
1.11 | 20-Mar-2021 |
rillig | lint: move getopname over to tree.c
Except for the one use in print_tnode, the name of the operator is only used in tree.c.
No functional change.
|
1.10 | 05-Jan-2021 |
rillig | lint: remove redundant symbolic operator names
These symbolic names for INCBEF, INCAFT, DECBEF and DECAFT were non-standard and thus confusing. All other operators were as expected. Now that the operator names from ops.def are very similar, there is no need to keep to almost identical lists around.
No change to the user-visible messages since the only place where these operator names were used was in 324, and that message was restricted to PLUS, MINUS, MULT and SHL.
|
1.9 | 05-Jan-2021 |
rillig | lint: add missing strings for operators
It's difficult to keep these lists in sync when they are spread over several files. The lists had been inconsistent since 2008-04-26. The inconsistency didn't lead to undefined behavior though since the operator names are only used in 2 places:
1. check_integer_conversion in message 324 only calls that function with a few selected operators, all of which are above the missing ones.
2. mkinit prints the node including its operator, but only in debug mode. Furthermore I'm not sure whether any of the broken operator names could ever be accessed at this place since mkinit is only called for expressions, and the node types are INIT, CASE, FARG, which are all special.
|
1.8 | 03-Jan-2021 |
rillig | lint: remove redundant include of externs1.h
It is already included by lint1.h.
|
1.7 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.6 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.5 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.4 | 31-Jul-2008 |
christos | 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.
|
1.3 | 28-Apr-2008 |
martin | branches: 1.3.2; Remove clause 3 and 4 from TNF licenses
|
1.2 | 15-Oct-2006 |
dogcow | branches: 1.2.16; do the #ifndef lint dance for __RCSID; also, include the appropriate headers if cross-building the program in tools/.
|
1.1 | 14-Oct-2006 |
christos | Fix c99 initialization issues. Now the regression tests work.
|
1.2.16.1 | 18-May-2008 |
yamt | sync with head.
|
1.3.2.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.143 | 08-Dec-2024 |
rillig | lint: warn about do-while macros that end with a semicolon
|
1.142 | 12-May-2024 |
rillig | branches: 1.142.2; lint: move code for parsing balanced token sequences to lex.c
To access yytext from lex.c, the lexer needs to be in %pointer mode, which was specified in IEEE Std 1003.1, 2004 Edition and thus should be old enough to be available on platforms other than NetBSD, for use in tools/lint1 where lint1 is built before yacc and lex.
|
1.141 | 11-May-2024 |
rillig | lint: parse but otherwise ignore C23 attributes
The C23 attributes are only parsed before an expression in an expression statement, as a proof of concept. Other places will follow later.
|
1.140 | 14-Sep-2023 |
rillig | lint: remove pseudo operators INC and DEC
These operators were not used in expressions, they were only used as additional token info. Use a plain bool instead.
No functional change.
|
1.139 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.138 | 09-Jan-2023 |
rillig | lint: in the lex scanner, use fewer definitions
No binary change.
|
1.137 | 08-Jan-2023 |
rillig | lint: document how reading tokens from the input works
Rename inpc to read_byte, to make the name more expressive. Since C99, lint is no longer required to use overly short identifiers.
No functional change.
|
1.136 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.135 | 11-Jul-2021 |
rillig | lint: use separate tokens for logical not and bitwise complement
The token T_UNARY was misleading since it only captured 2 of the 6 operators that C99 calls unary-operator. Make the grammar easier to understand by explicitly listing these 2 operators.
No functional change.
|
1.134 | 20-Jun-2021 |
rillig | lint: use different tokens for operators '.' and '->'
Before C99, these tokens were only used in member access expressions. C99 reused the operator '.' in initializations of structs and unions. Let the grammar check for syntax errors instead of writing custom code.
No functional change.
|
1.133 | 21-Mar-2021 |
rillig | lint: rename token T_XOR to T_BITXOR
For symmetry with the operator, which is named BITXOR.
No functional change.
|
1.132 | 21-Mar-2021 |
rillig | lint: remove redundant operator information from the grammar
Several tokens can only ever map to a single operator and thus do not need to encode the operator. Indeed, they already encoded it as NOOP, and it was not used by any grammar rule.
No functional change.
|
1.131 | 24-Jan-2021 |
rillig | lint: expand abbreviations in lexer function names
No functional change.
|
1.130 | 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.129 | 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.128 | 18-Jan-2021 |
rillig | lint: rename T_SOU to T_STRUCT_OR_UNION
This abbreviation occurred too seldom to be used.
|
1.127 | 18-Jan-2021 |
rillig | lint: align token names with the wording from C99
|
1.126 | 18-Jan-2021 |
rillig | lint: remove redundant operators from lexer
Several tokens correspond to exactly one operator. For these tokens, the operator is never accessed, therefore it is confusing to associate it with the token.
|
1.125 | 18-Jan-2021 |
rillig | lint: replace abort with lint_assert
|
1.124 | 18-Jan-2021 |
rillig | lint: expand abbreviations in function names
|
1.123 | 18-Jan-2021 |
rillig | lint: rename T_ELLIPSE to T_ELLIPSIS
The 3 dots have nothing to do with geometry.
|
1.122 | 18-Jan-2021 |
rillig | lint: rename T_STROP to T_MEMBACC
The 'STR' was misleading since it is the abbreviation for 'string' in many other programs. Member access not only happens in structs, it also happens in unions.
|
1.121 | 17-Jan-2021 |
rillig | lint: allow system headers to use int as bool, even in strict bool mode
|
1.120 | 17-Jan-2021 |
rillig | lint: rename T_AND to T_AMPER
When parsing a text into a C program, the character '&' does not yet mean 'bitwise and', it could also be the address operator.
|
1.119 | 17-Jan-2021 |
rillig | lint: rename bitwise operators
When there are several variants of the AND operator, both of them should get a distinguishing prefix, otherwise it's not clear which of the two possible operators is meant by the plain AND.
|
1.118 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.117 | 14-Jan-2021 |
rillig | lint: fix enum type in the lexical analysis part
Detected by Clang, reported by riastradh:
> scan.l:144:29: error: implicit conversion from enumeration type > 'tspec_t' to different enumeration type 'op_t' > return operator(T_ASTERISK, NOTSPEC); > ~~~~~~~~ ^~~~~~~
and by lint as well, with a less detailed and less helpful message:
> scan.l(144): warning: enum type mismatch, arg #2 [156]
Since scan.c is generated from scan.l, it is not included in the default "make lint" though.
The value of these two constants is the same, furthermore that value is never actually used in the code, therefore no functional change.
|
1.116 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.115 | 09-Jan-2021 |
rillig | lint: make target platform independent of host platform
If lint is run on a platform that has CHAR_BIT == 10, this doesn't magically make an ILP32 platform have 40 bits per uint32_t.
At the moment, all of the supported platforms are either ILP32 or I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE, so nothing changes practically.
|
1.114 | 09-Jan-2021 |
rillig | lint: rename T_MULT to T_ASTERISK
In the early phase of lexical analysis, the '*' does not mean multiplication, therefore its name should not suggest that. It is only an asterisk, and depending on the surrounding context, it will only later turn into a pointer dereference or a multiplication.
The call operator(T_MULT, MULT) was misleading since the MULT was not used at all.
|
1.113 | 05-Jan-2021 |
rillig | lint: in debug mode, log every newline
This helps to quickly see where in the source file the parser currently is. Previously, the parsing position was only printed after each declaration, as part of "clear flags".
|
1.112 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.111 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.110 | 02-Jan-2021 |
rillig | lint: use bool instead of u_int:1 in structures
Better late than never.
|
1.109 | 01-Jan-2021 |
rillig | lint: remove NTSPEC from enum tspec_t
The number of elements in an enumeration is not a valid enum constant of that enumeration itself.
|
1.108 | 01-Jan-2021 |
rillig | lint: rename tokens for left and right parentheses
|
1.107 | 01-Jan-2021 |
rillig | lint: replace simple LERROR with lint_assert
|
1.106 | 01-Jan-2021 |
rillig | lint: align comments with actual message, in the lexer and parser
|
1.105 | 30-Dec-2020 |
rillig | lint: spell check comments
|
1.104 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.103 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_field, s_keyw and s_xsym
|
1.102 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.101 | 30-Dec-2020 |
rillig | lint: rename remaining _nxt members to _next
|
1.100 | 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.99 | 30-Dec-2020 |
rillig | lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
|
1.98 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.97 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.96 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.95 | 28-Dec-2020 |
rillig | lint: remove trailing whitespace
|
1.94 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.93 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.92 | 18-Sep-2020 |
christos | add optimize attribute
|
1.91 | 09-Nov-2019 |
christos | Understand _Alignof
|
1.90 | 05-Sep-2019 |
christos | Fix decorators for __thread, add _Thread_local
christos
|
1.89 | 04-Mar-2019 |
christos | branches: 1.89.2; Add __thread/tls_model attribute
|
1.88 | 04-Mar-2019 |
christos | add gnu_printf
|
1.87 | 03-Mar-2019 |
christos | Add more gnu attributes
|
1.86 | 04-Jan-2019 |
christos | recognize destructor attribute.
|
1.85 | 24-Nov-2018 |
christos | add warn_unused_result.
|
1.84 | 07-Oct-2018 |
christos | Disable __int128 checks if we are not building on a 64 bit host ( this is suboptimal, but it is the easiest way).
|
1.83 | 07-Sep-2018 |
christos | recognize int128
|
1.82 | 08-Jul-2018 |
christos | recognize noinline attribute
|
1.81 | 29-Jun-2018 |
christos | Add our syslog format.
|
1.80 | 15-Jan-2018 |
christos | branches: 1.80.2; 1.80.4; Add a _Noreturn token
|
1.79 | 06-Mar-2017 |
christos | fix typeof, add __builtin_offsetof
|
1.78 | 15-Jan-2017 |
christos | leave pragmas alone.
|
1.77 | 07-Jan-2017 |
christos | branches: 1.77.2; add pcs
|
1.76 | 30-Dec-2016 |
christos | - add buffer bounded attribute - allow empty attributes
|
1.75 | 30-Dec-2016 |
christos | add bounded, fix nonnull
|
1.74 | 30-Dec-2016 |
christos | fix __typeof
|
1.73 | 29-Dec-2016 |
christos | handle __ symbols differently (so we don't duplicate entries in the table) and add non_null.
|
1.72 | 29-Dec-2016 |
christos | only return attributes if looking for attributes
|
1.71 | 29-Dec-2016 |
christos | Add alias attribute
|
1.70 | 29-Dec-2016 |
christos | Add always_inline
|
1.69 | 29-Dec-2016 |
christos | Add more attributes.
|
1.68 | 24-Dec-2016 |
christos | Add -R (source filename remapping) for MKREPRO
|
1.67 | 05-Nov-2016 |
christos | Add _Generic C11 support.
|
1.66 | 20-Jul-2016 |
christos | handle "extern __attribute__((__gnu_inline__)) __inline"
|
1.65 | 27-Feb-2016 |
christos | branches: 1.65.2; Add visibility and weak
|
1.64 | 13-Nov-2015 |
christos | redo previous, not needed.
|
1.63 | 13-Nov-2015 |
christos | Handle 0b locally since anyway this is not portable.
|
1.62 | 12-Nov-2015 |
christos | Recognize binary constants
|
1.61 | 28-Aug-2015 |
joerg | ~0 and -1 are the same for two-complement machines. ISO C says left shifts of negative values are UB, so do the shift for the unsigned equivalent and cast to int afterwards.
|
1.60 | 18-Oct-2014 |
snj | src is too big these days to tolerate superfluous apostrophes. It's "its", people!
|
1.59 | 21-Apr-2014 |
christos | add more attributes
|
1.58 | 21-Apr-2014 |
christos | fix asm() misclassification
|
1.57 | 18-Apr-2014 |
christos | remove attribute keyword
|
1.56 | 18-Apr-2014 |
christos | Never return the attribute keywords if we are not in attribute.
|
1.55 | 18-Apr-2014 |
christos | Handle the rest of gcc __attribute__ s.
|
1.54 | 18-Feb-2014 |
christos | branches: 1.54.2; add __extension__ and typeof
|
1.53 | 18-Oct-2013 |
christos | fix sequence point violations
|
1.52 | 19-Apr-2013 |
christos | make NOSTRICT behave the same a LINTED; use the new format.
|
1.51 | 19-Apr-2013 |
christos | Allow linted comments to take an argument that defines which error to suppress.
|
1.50 | 27-Mar-2012 |
christos | branches: 1.50.2; more cross lint friendlyness XXX: needs more constants converted double/float
|
1.49 | 02-Oct-2011 |
christos | branches: 1.49.2; eat the last d in double constants.
|
1.48 | 16-Dec-2010 |
wiz | Observe the following spelling: - wide character (noun) - wide-character (adjective)
Inspired by jmc@OpenBSD.
|
1.47 | 11-Jan-2010 |
christos | fix hex double parsing.
|
1.46 | 29-Oct-2009 |
christos | use %option instead of #define YY_NO_...
|
1.45 | 02-Oct-2009 |
christos | understand __attribute__((__packed__)) and __packed.
|
1.44 | 02-May-2009 |
christos | Add __alignof__.
|
1.43 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.42 | 10-Dec-2008 |
joerg | branches: 1.42.2; 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.
|
1.41 | 13-Oct-2008 |
dholland | Fix wrong memset; PR bin/39733 from Henning Petersen.
|
1.40 | 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.39 | 10-Sep-2008 |
joerg | 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.
|
1.38 | 25-Apr-2008 |
christos | branches: 1.38.2; preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.37 | 06-Feb-2007 |
he | branches: 1.37.10; 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
|
1.36 | 02-Feb-2007 |
christos | deal with hex doubles.
|
1.35 | 16-Oct-2006 |
he | branches: 1.35.2; 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.
|
1.34 | 22-Mar-2006 |
christos | Coverity CID 198: Remove dead code if INT_MAX == LONG_MAX
|
1.33 | 12-Sep-2004 |
yamt | recognize _Bool.
|
1.32 | 02-Nov-2002 |
perry | 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.
|
1.31 | 22-Oct-2002 |
christos | add support for ({}) gcc shit.
|
1.30 | 22-Oct-2002 |
christos | handle free-ing of temp symbols properly. Don't segv on bad node types.
|
1.29 | 22-Oct-2002 |
christos | add C9X/GCC compound literal expressions.
|
1.28 | 13-Sep-2002 |
christos | 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.
|
1.27 | 05-Feb-2002 |
thorpej | 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.
|
1.26 | 31-Jan-2002 |
tv | Use !finite() instead of isinf() in two places for better compatibility.
|
1.25 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.24 | 29-Jan-2002 |
tv | Remove #include <err.h> (now in lint.h).
|
1.23 | 03-Jan-2002 |
thorpej | Make sure the tspec_t enum starts at 0, and declare NTSPEC in the enum proper.
|
1.22 | 03-Jan-2002 |
thorpej | * 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.
|
1.21 | 24-Dec-2001 |
wiz | Fix typo.
|
1.20 | 04-Dec-2001 |
wiz | Replace some misuses of "then" with "than".
|
1.19 | 28-May-2001 |
lukem | 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.
|
1.18 | 24-May-2001 |
lukem | support // comments if -g is given
|
1.17 | 24-May-2001 |
lukem | minor whitespace/knf
|
1.16 | 07-May-2001 |
lukem | 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\ ...
|
1.15 | 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.14 | 10-May-2000 |
simonb | branches: 1.14.2; Don't need local extern declaration of strtouq() - it's in <stdlib.h>.
|
1.13 | 20-Dec-1998 |
christos | char -> unsigned char
|
1.12 | 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.11 | 22-Feb-1998 |
christos | WARNSify
|
1.10 | 03-Nov-1997 |
cgd | 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.
|
1.9 | 22-Dec-1996 |
cgd | branches: 1.9.2; * recognize that pointers to identical unnamed and untyped structs, unions, and enums are, in fact, identical. This is done by tagging each of unnamed and untyped structure, union and enum with a unique position of creation, which is used as a unique identifier that when determine whether or not a pair of structures, unions, or enums are identical.
* accept the file name '-' to indicate that standard input is to be used as lint1 input. That involves having lint pass the '-' through to the cpp which preprocesses the lint1 input, and having lint1's scanner recognize a cpp filename "" as "{standard input}".
|
1.8 | 23-Oct-1995 |
jpo | use MB_LEN_MAX instead of MB_CUR_MAX for array declaration, because MB_CUR_MAX may be a non-constant expression
|
1.7 | 02-Oct-1995 |
jpo | 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.
|
1.6 | 02-Oct-1995 |
jpo | support asm statements and asm modifiers in declarations
asm statements consist of an asm keyword, an optional qualifier, a left paren, a list of tokens up to and including the matching right paren, and a semicolon.
asm modifiers consist of an asm keyword, an left paren, a string and a right paren.
asm statements and modifiers have no semantic for lint(1), they exist only to avoid complaints about them.
|
1.5 | 02-Oct-1995 |
jpo | __{const,signed,volatile}{__,} added const, signed and volatile are disabled with -t
|
1.4 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.3 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.9.2.1 | 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.14.2.1 | 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.35.2.1 | 07-May-2007 |
pavel | Pull up following revision(s) (requested by manu in ticket #607): lib/libc/arch/i386/gen/isnanl.c: revision 1.6 lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3 lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6 lib/libc/gdtoa/gdtoaimp.h: revision 1.6 sys/arch/m68k/include/ieee.h: revision 1.13 usr.bin/xlint/lint1/scan.l: revision 1.36-1.37 lib/libc/stdio/snprintf_ss.c: revision 1.4 lib/libc/arch/i386/gen/isfinitel.c: revision 1.2 lib/libc/stdio/vfscanf.c: revision 1.38 sys/arch/sparc/include/ieee.h: revision 1.11-1.12 lib/libc/gdtoa/dtoa.c: revision 1.4 lib/libc/stdio/Makefile.inc: revision 1.35 lib/libc/stdio/fvwrite.c: revision 1.17 lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2 lib/libc/arch/i386/gen/isinfl.c: revision 1.6 lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6 lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2 lib/libc/stdio/vfprintf.c: revision 1.55-1.57 lib/libc/stdio/vsnprintf_ss.c: revision 1.3 lib/libc/stdio/vfwprintf.c: revision 1.10 sys/arch/x86/include/ieee.h: revision 1.10 lib/libc/gdtoa/dmisc.c: revision 1.3 lib/libc/gdtoa/Makefile.inc: revision 1.5 sys/arch/hppa/include/ieee.h: revision 1.10 lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3 lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2 sys/sys/ieee754.h: revision 1.7 lib/libc/gdtoa/gdtoa.h: revision 1.7 include/stdio.h: revision 1.67-1.68 lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4 lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4 defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no need to check both of them. Fix for issue reported in PR lib/35401 as well as related overflow bugs. deal with hex doubles. Instead of abusing stdio to get a signal-safe version of sprintf, provide one. remove __SAFE add long double and hex double support from freebsd. make this compile. add new prototypes. add the new files to the build. Note I am not bumping libc now, because these are not used yet. Merge the int bit with the high fraction bit. Add constants/macros needed by gdtoa. add constants used by gdtoa since the int bit is merged, do the explicit math. ext_int bit is no more. ext_int bit is no more. - merge change from freebsd - add support for building as vfprintf.c - XXX: we strdup to simplify the freeing logic. This should be fixed for efficiency in the vfprintf case. use vfwprintf.c enable wide doubles. some int -> size_t deal with sparc64 that has 112 bits of mantissa. make extended precision gdtoa friendly. int/size_t changes make this gdtoa friendly. remove dup definition use dtoa() instead of returning empty when we don't have extended precision information. Fix previous, add forgotten pointer dereference in the call to dtoa(). 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 From Christos: gdtoa fixes for m68k. M68k ports should build now, but printing extended precision is a little off. vax does not have <machine/ieee.h> or long double It would be nice if the compiler provided something like __IEEE_MATH__ bring in FreeBSD's vfscanf() to gain multi-byte/collation support. Unfortunately it is too difficult to make vfwscanf and this share the same code like I did with printf, because for string parsing the code is too different.
|
1.37.10.1 | 18-May-2008 |
yamt | sync with head.
|
1.38.2.1 | 24-Sep-2008 |
wrstuden | Merge in changes between wrstuden-revivesa-base-2 and wrstuden-revivesa-base-3.
|
1.42.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.49.2.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.49.2.1 | 17-Apr-2012 |
yamt | sync with head
|
1.50.2.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.50.2.1 | 23-Jun-2013 |
tls | resync from head
|
1.54.2.1 | 10-Aug-2014 |
tls | Rebase.
|
1.65.2.3 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.65.2.2 | 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.65.2.1 | 26-Jul-2016 |
pgoyette | Sync with HEAD
|
1.77.2.1 | 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.80.4.2 | 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.80.4.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.80.2.5 | 18-Jan-2019 |
pgoyette | Synch with HEAD
|
1.80.2.4 | 26-Nov-2018 |
pgoyette | Sync with HEAD, resolve a couple of conflicts
|
1.80.2.3 | 20-Oct-2018 |
pgoyette | Sync with head
|
1.80.2.2 | 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.80.2.1 | 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.89.2.1 | 12-Sep-2019 |
martin | Sync external/mpl/bind to HEAD and pullup additional changes to fix the set lists and lint, requested by christos in ticket #195:
external/mpl/bind/dist/bin/pkcs11/Makefile up to 1.1.1.1 external/mpl/bind/dist/bin/tests/pkcs11/benchmarks/Makefile up to 1.1.1.1 external/mpl/bind/dist/bin/tests/pkcs11/Makefile up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/additional/ns1/root.db up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/additional/ns3/ex.db up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/additional/ns3/ex2.db up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/checkconf/good-dup-managed-key.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/checkconf/good-dup-trusted-key.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/checkconf/warn-duplicate-key.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/checkconf/warn-duplicate-root-key.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/checkconf/warn-validation-auto-key.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/cookie/bad-cookie-badaes.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/cookie/bad-cookie-badsiphash24.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/cookie/good-cookie-aes.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/cookie/good-cookie-siphash24.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dlv/ns7/hints up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dlv/ns7/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dlv/ns8/hints up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dlv/ns8/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dlzexternal/ns1/dlzs.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/bad18.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/bad19.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn1.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn2.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn3.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn4.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn5.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn6.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn7.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dns64/conf/warn8.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnssec/ns2/key.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnssec/ns2/template.secure.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnssec/ns3/key.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnssec/ns8/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnssec/ns9/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnstap/README up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnstap/bad-missing-dnstap-output.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/dnstap/large-answer.fstrm up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+09713.key up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+09713.private up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+38353.key up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+38353.private up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip/ns2/named16.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-areacode.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-dbname.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-netspeed.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-regiondb.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-threeletter.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/conf/good-options.conf up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/clean.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/prereq.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/setup.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/tests.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-City.json up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-City.mmdb up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-Country.json up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-Country.mmdb up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-Domain.json up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-Domain.mmdb up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-ISP.json up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoIP2-ISP.mmdb up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoLite2-ASN.json up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/GeoLite2-ASN.mmdb up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/README.md up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/data/write-test-data.pl up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/example.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named1.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named10.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named11.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named12.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named2.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named3.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named4.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named5.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named6.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named7.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named8.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/geoip2/ns2/named9.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/inline/ns3/master6.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/ixfr/ns5/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/parallel.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/rpz/ns9/hints up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/rpz/ns9/rpz.db up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/rpz/ns9/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/serve-stale/ns4/named.conf.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/statschannel/ns2/dnssec.db.in up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/statschannel/ns2/sign.sh up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/statschannel/zones-json.pl up to 1.1.1.1 external/mpl/bind/dist/bin/tests/system/statschannel/zones-xml.pl up to 1.1.1.1 external/mpl/bind/dist/bin/tests/virtual-time/Makefile up to 1.1.1.1 external/mpl/bind/dist/bin/tests/virtual-time/conf.sh up to 1.1.1.1 external/mpl/bind/dist/fuzz/dns_rdata_fromwire_text.c up to 1.2 external/mpl/bind/dist/fuzz/dns_rdata_fromwire_text.in/cdnskey up to 1.1.1.1 external/mpl/bind/dist/fuzz/dns_rdata_fromwire_text.in/smimea up to 1.1.1.1 external/mpl/bind/dist/fuzz/dns_rdata_fromwire_text.in/sshfp up to 1.1.1.1 external/mpl/bind/dist/contrib/scripts/check-secure-delegation.pl up to 1.1.1.1 external/mpl/bind/dist/contrib/scripts/zone-edit.sh up to 1.1.1.1 external/mpl/bind/dist/lib/dns/geoip2.c up to 1.2 external/mpl/bind/dist/lib/isc/siphash.c up to 1.2 external/mpl/bind/dist/lib/isc/include/isc/endian.h up to 1.2 external/mpl/bind/dist/lib/isc/include/isc/siphash.h up to 1.2 external/mpl/bind/dist/lib/isc/tests/siphash_test.c up to 1.2 external/mpl/bind/dist/lib/ns/include/ns/pfilter.h up to 1.1 external/mpl/bind/dist/lib/ns/pfilter.c up to 1.1 external/mpl/bind/dist/lib/samples/Makefile-postinstall up to 1.1.1.1 external/mpl/bind/dist/m4/ax_restore_flags.m4 up to 1.1.1.1 external/mpl/bind/dist/m4/ax_save_flags.m4 up to 1.1.1.1 external/mpl/bind/dist/m4/compat.m4 up to 1.1.1.1 external/mpl/bind/dist/unit/unittest.sh up to 1.1.1.1 external/mpl/bind/dist/bin/named/pfilter.c delete external/mpl/bind/dist/bin/named/pfilter.h delete external/mpl/bind/dist/bin/tests/system/wildcard/ns2/hints delete external/mpl/bind/dist/bin/tests/system/wildcard/ns3/hints delete external/mpl/bind/dist/bin/tests/system/wildcard/ns5/hints delete external/mpl/bind/dist/lib/dns/rdata/generic/unspec_103.c delete external/mpl/bind/dist/lib/dns/rdata/generic/unspec_103.h delete external/mpl/bind/Makefile.inc up to 1.5 external/mpl/bind/bin/named/Makefile up to 1.3 external/mpl/bind/dist/CHANGES up to 1.1.1.5 external/mpl/bind/dist/CONTRIBUTING up to 1.1.1.2 external/mpl/bind/dist/HISTORY up to 1.1.1.2 external/mpl/bind/dist/Makefile.in up to 1.4 external/mpl/bind/dist/OPTIONS up to 1.1.1.3 external/mpl/bind/dist/PLATFORMS up to 1.1.1.4 external/mpl/bind/dist/PLATFORMS.md up to 1.1.1.4 external/mpl/bind/dist/README up to 1.1.1.5 external/mpl/bind/dist/README.md up to 1.1.1.5 external/mpl/bind/dist/aclocal.m4 up to 1.1.1.3 external/mpl/bind/dist/config.h.in up to 1.6 external/mpl/bind/dist/config.h.win32 up to 1.1.1.4 external/mpl/bind/dist/configure up to 1.6 external/mpl/bind/dist/configure.ac up to 1.1.1.4 external/mpl/bind/dist/srcid up to 1.1.1.5 external/mpl/bind/dist/version up to 1.1.1.5 external/mpl/bind/dist/bin/check/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/confgen/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/delv/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/dig/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/dig/dig.1 up to 1.5 external/mpl/bind/dist/bin/dig/dig.c up to 1.4 external/mpl/bind/dist/bin/dig/dig.docbook up to 1.1.1.4 external/mpl/bind/dist/bin/dig/dig.html up to 1.1.1.4 external/mpl/bind/dist/bin/dig/dighost.c up to 1.5 external/mpl/bind/dist/bin/dnssec/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/named/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/named/bind9.xsl up to 1.1.1.3 external/mpl/bind/dist/bin/named/bind9.xsl.h up to 1.4 external/mpl/bind/dist/bin/named/config.c up to 1.5 external/mpl/bind/dist/bin/named/fuzz.c up to 1.4 external/mpl/bind/dist/bin/named/geoip.c up to 1.3 external/mpl/bind/dist/bin/named/main.c up to 1.5 external/mpl/bind/dist/bin/named/named.conf.5 up to 1.6 external/mpl/bind/dist/bin/named/named.conf.docbook up to 1.1.1.5 external/mpl/bind/dist/bin/named/named.conf.html up to 1.1.1.4 external/mpl/bind/dist/bin/named/server.c up to 1.7 external/mpl/bind/dist/bin/named/statschannel.c up to 1.4 external/mpl/bind/dist/bin/named/zoneconf.c up to 1.4 external/mpl/bind/dist/bin/named/include/named/geoip.h up to 1.3 external/mpl/bind/dist/bin/named/include/named/globals.h up to 1.5 external/mpl/bind/dist/bin/named/unix/dlz_dlopen_driver.c up to 1.5 external/mpl/bind/dist/bin/named/win32/named.vcxproj.filters.in up to 1.1.1.3 external/mpl/bind/dist/bin/named/win32/named.vcxproj.in up to 1.1.1.3 external/mpl/bind/dist/bin/named/win32/ntservice.c up to 1.4 external/mpl/bind/dist/bin/named/win32/os.c up to 1.5 external/mpl/bind/dist/bin/nsupdate/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/pkcs11/pkcs11-keygen.c up to 1.4 external/mpl/bind/dist/bin/plugins/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/plugins/filter-aaaa.c up to 1.4 external/mpl/bind/dist/bin/rndc/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/rndc/rndc.8 up to 1.5 external/mpl/bind/dist/bin/rndc/rndc.docbook up to 1.1.1.4 external/mpl/bind/dist/bin/rndc/rndc.html up to 1.1.1.4 external/mpl/bind/dist/bin/tests/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/optional/Makefile.in up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/Makefile.in up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/conf.sh.common up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/conf.sh.in up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/conf.sh.win32 up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/feature-test.c up to 1.6 external/mpl/bind/dist/bin/tests/system/genzone.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/ifconfig.bat up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/ifconfig.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/run.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/runall.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/stop.pl up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/additional/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/additional/ns1/named1.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/additional/ns1/named2.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/additional/ns1/named3.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/additional/ns1/named4.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/additional/ns1/naptr.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/additional/ns1/naptr2.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/additional/ns1/nid.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/additional/ns1/rt.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/additional/ns1/rt2.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/additional/ns3/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/allow-query/ns1/root.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/autosign/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/cacheclean/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/cacheclean/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/cds/setup.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/checkconf/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/cookie/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/cookie/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/cookie/ns4/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/cookie/ns5/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/cookie/ns6/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/digdelv/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/digdelv/ns2/sign.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dlv/setup.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dlv/tests.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/ns1/root.db.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/ns1/sign.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dlv/ns2/named.conf.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/ns2/utld.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/ns3/named.conf.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlv/ns3/sign.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dlv/ns5/named.conf.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dlzexternal/driver.c up to 1.6 external/mpl/bind/dist/bin/tests/system/dns64/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dns64/tests.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dnssec/README up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dnssec/clean.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/setup.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/dnssec/ns1/root.db.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/dnssec/ns1/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/ns2/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dnssec/ns2/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/ns3/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dnssec/ns3/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/ns5/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/ns6/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnssec/ns7/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dnstap/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/dsdigest/ns2/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/dyndb/driver/driver.c up to 1.4 external/mpl/bind/dist/bin/tests/system/eddsa/tests.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/example.com.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/eddsa/ns2/sign.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/filter-aaaa/ns2/hints up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/filter-aaaa/ns3/hints up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/filter-aaaa/ns5/hints up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/geoip/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/geoip/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/geoip/ns2/named15.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/idna/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/inline/setup.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/inline/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/inline/ns3/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/inline/ns3/sign.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/ixfr/clean.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/ixfr/setup.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/ixfr/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/ixfr/ns3/mytest0.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/ixfr/ns3/mytest1.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/ixfr/ns3/mytest2.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/legacy/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/legacy/ns6/edns512.db.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/legacy/ns7/edns512-notcp.db.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/metadata/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/mkeys/README up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/mkeys/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/mkeys/ns1/sign.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/nsupdate/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/pipelined/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/qmin/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/qmin/ans3/ans.py up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/rndc/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/rndc/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/rpz/setup.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/rpz/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/rpz/ns1/root.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/rsabigexponent/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/serve-stale/clean.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/serve-stale/setup.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/serve-stale/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/serve-stale/ns1/named1.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/serve-stale/ns1/named2.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/sfcache/clean.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/sfcache/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/smartsign/tests.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/spf/tests.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/staticstub/ns1/root.db up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/statistics/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/statistics/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/statistics/ns3/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/statschannel/clean.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/statschannel/setup.sh up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/statschannel/tests.sh up to 1.1.1.5 external/mpl/bind/dist/bin/tests/system/statschannel/ns2/named.conf.in up to 1.1.1.2 external/mpl/bind/dist/bin/tests/system/tkey/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/tkey/ns1/setup.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/verify/zones/genzones.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/wildcard/ns1/sign.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/wildcard/ns2/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/wildcard/ns3/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/wildcard/ns5/named.conf.in up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/xfer/dig1.good up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/xfer/dig2.good up to 1.1.1.4 external/mpl/bind/dist/bin/tests/system/xfer/prereq.sh up to 1.1.1.3 external/mpl/bind/dist/bin/tests/system/xfer/tests.sh up to 1.1.1.4 external/mpl/bind/dist/bin/tools/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/bin/tools/dnstap-read.c up to 1.5 external/mpl/bind/dist/bin/tools/mdig.c up to 1.4 external/mpl/bind/dist/contrib/dlz/modules/common/dlz_dbi.c up to 1.5 external/mpl/bind/dist/doc/arm/Bv9ARM-book.xml up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch01.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch02.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch03.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch04.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch05.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch06.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch07.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch08.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch09.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch10.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch11.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.ch12.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/Bv9ARM.pdf up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.arpaname.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.ddns-confgen.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.delv.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dig.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-cds.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-checkds.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-coverage.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-dsfromkey.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-importkey.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-keyfromlabel.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-keygen.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-keymgr.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-revoke.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-settime.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-signzone.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnssec-verify.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.dnstap-read.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.filter-aaaa.html up to 1.1.1.4 external/mpl/bind/dist/doc/arm/man.host.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.mdig.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named-checkconf.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named-checkzone.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named-journalprint.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named-nzd2nzf.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named-rrchecker.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named.conf.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.named.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.nsec3hash.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.nslookup.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.nsupdate.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.pkcs11-destroy.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.pkcs11-keygen.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.pkcs11-list.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.pkcs11-tokens.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.rndc-confgen.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.rndc.conf.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/man.rndc.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/notes.html up to 1.1.1.5 external/mpl/bind/dist/doc/arm/notes.pdf up to 1.1.1.5 external/mpl/bind/dist/doc/arm/notes.txt up to 1.1.1.5 external/mpl/bind/dist/doc/arm/notes.xml up to 1.1.1.5 external/mpl/bind/dist/doc/arm/options.grammar.xml up to 1.1.1.4 external/mpl/bind/dist/doc/misc/options up to 1.1.1.5 external/mpl/bind/dist/doc/misc/rfc-compliance up to 1.1.1.3 external/mpl/bind/dist/doc/tex/notestyle.sty up to 1.1.1.2 external/mpl/bind/dist/fuzz/Makefile.in up to 1.1.1.2 external/mpl/bind/dist/lib/bind9/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/bind9/api up to 1.1.1.5 external/mpl/bind/dist/lib/bind9/check.c up to 1.6 external/mpl/bind/dist/lib/dns/Makefile.in up to 1.1.1.5 external/mpl/bind/dist/lib/dns/acl.c up to 1.4 external/mpl/bind/dist/lib/dns/api up to 1.1.1.5 external/mpl/bind/dist/lib/dns/client.c up to 1.5 external/mpl/bind/dist/lib/dns/dispatch.c up to 1.4 external/mpl/bind/dist/lib/dns/dnstap.c up to 1.6 external/mpl/bind/dist/lib/dns/gen-unix.h up to 1.4 external/mpl/bind/dist/lib/dns/gen.c up to 1.5 external/mpl/bind/dist/lib/dns/master.c up to 1.4 external/mpl/bind/dist/lib/dns/masterdump.c up to 1.5 external/mpl/bind/dist/lib/dns/message.c up to 1.6 external/mpl/bind/dist/lib/dns/name.c up to 1.4 external/mpl/bind/dist/lib/dns/openssleddsa_link.c up to 1.4 external/mpl/bind/dist/lib/dns/rbtdb.c up to 1.5 external/mpl/bind/dist/lib/dns/rdata.c up to 1.5 external/mpl/bind/dist/lib/dns/resolver.c up to 1.6 external/mpl/bind/dist/lib/dns/rpz.c up to 1.5 external/mpl/bind/dist/lib/dns/stats.c up to 1.4 external/mpl/bind/dist/lib/dns/update.c up to 1.4 external/mpl/bind/dist/lib/dns/view.c up to 1.5 external/mpl/bind/dist/lib/dns/zone.c up to 1.6 external/mpl/bind/dist/lib/dns/include/dns/acl.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/clientinfo.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/ecs.h up to 1.5 external/mpl/bind/dist/lib/dns/include/dns/geoip.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/message.h up to 1.5 external/mpl/bind/dist/lib/dns/include/dns/resolver.h up to 1.5 external/mpl/bind/dist/lib/dns/include/dns/rpz.h up to 1.5 external/mpl/bind/dist/lib/dns/include/dns/stats.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/types.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/view.h up to 1.4 external/mpl/bind/dist/lib/dns/include/dns/zone.h up to 1.4 external/mpl/bind/dist/lib/dns/rdata/generic/ds_43.c up to 1.5 external/mpl/bind/dist/lib/dns/rdata/generic/key_25.c up to 1.5 external/mpl/bind/dist/lib/dns/rdata/generic/opt_41.c up to 1.4 external/mpl/bind/dist/lib/dns/rdata/generic/sshfp_44.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/dns/tests/acl_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/db_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/dbdiff_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/dbiterator_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/dbversion_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/dh_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/dispatch_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/dnstap_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/dnstest.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/dst_test.c up to 1.6 external/mpl/bind/dist/lib/dns/tests/geoip_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/keytable_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/master_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/name_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/nsec3_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/peer_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/private_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/rbt_serialize_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/rbt_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/rdata_test.c up to 1.6 external/mpl/bind/dist/lib/dns/tests/rdataset_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/rdatasetstats_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/resolver_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/result_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/rsa_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/sigs_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/time_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/tkey_test.c up to 1.3 external/mpl/bind/dist/lib/dns/tests/tsig_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/update_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/zonemgr_test.c up to 1.4 external/mpl/bind/dist/lib/dns/tests/zt_test.c up to 1.5 external/mpl/bind/dist/lib/dns/tests/testdata/master/master8.data up to 1.1.1.2 external/mpl/bind/dist/lib/dns/win32/libdns.def.in up to 1.1.1.4 external/mpl/bind/dist/lib/dns/win32/libdns.vcxproj.filters.in up to 1.1.1.4 external/mpl/bind/dist/lib/dns/win32/libdns.vcxproj.in up to 1.1.1.4 external/mpl/bind/dist/lib/irs/tests/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/irs/tests/resconf_test.c up to 1.4 external/mpl/bind/dist/lib/isc/Makefile.in up to 1.1.1.4 external/mpl/bind/dist/lib/isc/api up to 1.1.1.5 external/mpl/bind/dist/lib/isc/hash.c up to 1.4 external/mpl/bind/dist/lib/isc/ht.c up to 1.4 external/mpl/bind/dist/lib/isc/mem.c up to 1.5 external/mpl/bind/dist/lib/isc/rwlock.c up to 1.7 external/mpl/bind/dist/lib/isc/sockaddr.c up to 1.5 external/mpl/bind/dist/lib/isc/stats.c up to 1.5 external/mpl/bind/dist/lib/isc/task.c up to 1.5 external/mpl/bind/dist/lib/isc/include/isc/Makefile.in up to 1.1.1.4 external/mpl/bind/dist/lib/isc/include/isc/hash.h up to 1.4 external/mpl/bind/dist/lib/isc/include/isc/util.h up to 1.6 external/mpl/bind/dist/lib/isc/tests/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/isc/tests/aes_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/buffer_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/counter_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/crc64_test.c up to 1.3 external/mpl/bind/dist/lib/isc/tests/errno_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/hash_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/heap_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/hmac_test.c up to 1.3 external/mpl/bind/dist/lib/isc/tests/ht_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/lex_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/mem_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/netaddr_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/parse_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/pool_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/queue_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/radix_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/random_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/regex_test.c up to 1.6 external/mpl/bind/dist/lib/isc/tests/result_test.c up to 1.6 external/mpl/bind/dist/lib/isc/tests/safe_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/sockaddr_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/socket_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/symtab_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/task_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/taskpool_test.c up to 1.5 external/mpl/bind/dist/lib/isc/tests/time_test.c up to 1.4 external/mpl/bind/dist/lib/isc/tests/timer_test.c up to 1.4 external/mpl/bind/dist/lib/isc/unix/socket.c up to 1.11 external/mpl/bind/dist/lib/isc/win32/libisc.def.in up to 1.1.1.5 external/mpl/bind/dist/lib/isc/win32/libisc.vcxproj.filters.in up to 1.1.1.4 external/mpl/bind/dist/lib/isc/win32/libisc.vcxproj.in up to 1.1.1.4 external/mpl/bind/dist/lib/isccc/tests/result_test.c up to 1.5 external/mpl/bind/dist/lib/isccfg/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/isccfg/aclconf.c up to 1.4 external/mpl/bind/dist/lib/isccfg/api up to 1.1.1.5 external/mpl/bind/dist/lib/isccfg/namedconf.c up to 1.6 external/mpl/bind/dist/lib/isccfg/parser.c up to 1.5 external/mpl/bind/dist/lib/isccfg/include/isccfg/aclconf.h up to 1.4 external/mpl/bind/dist/lib/isccfg/tests/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/lib/isccfg/tests/parser_test.c up to 1.5 external/mpl/bind/dist/lib/ns/Makefile.in up to 1.2 external/mpl/bind/dist/lib/ns/api up to 1.1.1.5 external/mpl/bind/dist/lib/ns/client.c up to 1.6 external/mpl/bind/dist/lib/ns/interfacemgr.c up to 1.5 external/mpl/bind/dist/lib/ns/query.c up to 1.7 external/mpl/bind/dist/lib/ns/update.c up to 1.5 external/mpl/bind/dist/lib/ns/xfrout.c up to 1.6 external/mpl/bind/dist/lib/ns/include/ns/client.h up to 1.6 external/mpl/bind/dist/lib/ns/include/ns/interfacemgr.h up to 1.5 external/mpl/bind/dist/lib/ns/include/ns/types.h up to 1.4 external/mpl/bind/dist/lib/ns/tests/Makefile.in up to 1.1.1.4 external/mpl/bind/dist/lib/ns/tests/listenlist_test.c up to 1.4 external/mpl/bind/dist/lib/ns/tests/notify_test.c up to 1.5 external/mpl/bind/dist/lib/ns/tests/plugin_test.c up to 1.2 external/mpl/bind/dist/lib/ns/tests/query_test.c up to 1.5 external/mpl/bind/dist/lib/samples/Makefile.in up to 1.1.1.3 external/mpl/bind/dist/m4/ax_check_openssl.m4 up to 1.1.1.2 external/mpl/bind/dist/make/rules.in up to 1.1.1.4 external/mpl/bind/dist/win32utils/Configure up to 1.1.1.5 external/mpl/bind/dist/win32utils/build.txt up to 1.1.1.3 external/mpl/bind/dist/win32utils/readme1st.txt up to 1.1.1.2 external/mpl/bind/include/config.h up to 1.6 external/mpl/bind/include/dns/code.h up to 1.4 external/mpl/bind/include/dns/enumtype.h up to 1.4 external/mpl/bind/include/dns/rdatastruct.h up to 1.5 external/mpl/bind/lib/libbind9/shlib_version up to 1.5 external/mpl/bind/lib/libdns/shlib_version up to 1.5 external/mpl/bind/lib/libirs/shlib_version up to 1.5 external/mpl/bind/lib/libisc/Makefile up to 1.10 external/mpl/bind/lib/libisc/shlib_version up to 1.5 external/mpl/bind/lib/libisccc/shlib_version up to 1.5 external/mpl/bind/lib/libisccfg/shlib_version up to 1.5 external/mpl/bind/lib/libns/Makefile up to 1.4 external/mpl/bind/lib/libns/shlib_version up to 1.5 distrib/sets/lists/base/shl.mi: revision 1.870 distrib/sets/lists/debug/shl.mi: revision 1.227 distrib/sets/lists/debug/shl.mi: revision 1.228 distrib/sets/lists/base/shl.mi: revision 1.869 usr.bin/xlint/lint1/scan.l: revision 1.90
Fix set lists for bumped bind version.
-
lint(1): fix decorators for __thread, add _Thread_local.
-
Import BIND 9.14.5:
--- 9.14.5 released ---
5277. [bug] Cache DB statistics could underflow when serve-stale was in use, because of a bug in counter maintenance when RRsets become stale.
Functions for dumping statistics have been updated to dump active, stale, and ancient statistic counters. Ancient RRset counters are prefixed with '~'; stale RRset counters are still prefixed with '#'. [GL #602]
5275. [bug] Mark DS records included in referral messages with trust level "pending" so that they can be validated and cached immediately, with no need to re-query. [GL #964]
5274. [bug] Address potential use after free race when shutting down rpz. [GL #1175]
5273. [bug] Check that bits [64..71] of a dns64 prefix are zero. [GL #1159]
5269. [port] cygwin: can return ETIMEDOUT on connect() with a non-blocking socket. [GL #1133]
5268. [bug] named could crash during configuration if configured to use "geoip continent" ACLs with legacy GeoIP. [GL #1163]
5266. [bug] named-checkconf failed to report dnstap-output missing from named.conf when dnstap was specified. [GL #1136]
5265. [bug] DNS64 and RPZ nodata (CNAME *.) rules interacted badly [GL #1106]
5264. [func] New DNS Cookie algorithm - siphash24 - has been added to BIND 9. [GL #605]
5236. [func] Add SipHash 2-4 implementation in lib/isc/siphash.c and switch isc_hash_function() to use SipHash 2-4. [GL #605]
--- 9.14.4 released ---
5260. [bug] dnstap-read was producing malformed output for large packets. [GL #1093]
5258. [func] Added support for the GeoIP2 API from MaxMind, when BIND is compiled using "configure --with-geoip2". The legacy GeoIP API can be enabled by using "configure --with-geoip" instead. These options cannot be used together.
Certain geoip ACL settings that were available with legacy GeoIP are not available when using GeoIP2. See the ARM for details. [GL #182]
5257. [bug] Some statistics data was not being displayed. Add shading to the zone tables. [GL #1030]
5256. [bug] Ensure that glue records are included in root priming responses if "minimal-responses" is not set to "yes". [GL #1092]
5255. [bug] Errors encountered while reloading inline-signing zones could be ignored, causing the zone content to be left in an incompletely updated state rather than reverted. [GL #1109]
5254. [func] Collect metrics to report to the statistics-channel DNSSEC signing operations (dnssec-sign) and refresh operations (dnssec-refresh) per zone and per keytag. [GL #513]
5253. [port] Support platforms that don't define ULLONG_MAX. [GL #1098]
5251. [bug] Statistics were broken in x86 Windows builds. [GL #1081]
5249. [bug] Fix a possible underflow in recursion clients statistics when hitting recursive clients soft quota. [GL #1067]
--- 9.14.3 released ---
5244. [security] Fixed a race condition in dns_dispatch_getnext() that could cause an assertion failure if a significant number of incoming packets were rejected. (CVE-2019-6471) [GL #942]
5243. [bug] Fix a possible race between dispatcher and socket code in a high-load cold-cache resolver scenario. [GL #943]
5242. [bug] In relaxed qname minimizatiom mode, fall back to normal resolution when encountering a lame delegation, and use _.domain/A queries rather than domain/NS. [GL #1055]
5241. [bug] Fix Ed448 private and public key ASN.1 prefix blobs. [GL #225]
5240. [bug] Remove key id calculation for RSAMD5. [GL #996]
5238. [bug] Fix a possible deadlock in TCP code. [GL #1046]
5237. [bug] Recurse to find the root server list with 'dig +trace'. [GL #1028]
5234. [port] arm: just use the compiler's default support for yield. [GL #981]
--- 9.14.2 released ---
5233. [bug] Negative trust anchors did not work with "forward only;" to validating resolvers. [GL #997]
5231. [protocol] Add support for displaying CLIENT-TAG and SERVER-TAG. [GL #960]
5229. [protocol] Enforce known SSHFP fingerprint lengths. [GL #852]
5228. [cleanup] If trusted-keys and managed-keys are configured simultaneously for the same name, the key cannot be rolled automatically. This configuration now logs a warning. [GL #868]
5224. [bug] Only test provide-ixfr on TCP streams. [GL #991]
5223. [bug] Fixed a race in the filter-aaaa plugin accessing the hash table. [GL #1005]
5222. [bug] 'delv -t ANY' could leak memory. [GL #983]
5221. [test] Enable parallel execution of system tests on Windows. [GL !4101]
5220. [cleanup] Refactor the isc_stat structure to take advantage of stdatomic. [GL !1493]
5219. [bug] Fixed a race in the filter-aaaa plugin that could trigger a crash when returning an instance object to the memory pool. [GL #982]
5218. [bug] Conditionally include <dlfcn.h>. [GL #995]
5217. [bug] Restore key id calculation for RSAMD5. [GL #996]
5216. [bug] Fetches-per-zone counter wasn't updated correctly when doing qname minimization. [GL #992]
5215. [bug] Change #5124 was incomplete; named could still return FORMERR instead of SERVFAIL in some cases. [GL #990]
5214. [bug] win32: named now removes its lock file upon shutdown. [GL #979]
5213. [bug] win32: Eliminated a race which allowed named.exe running as a service to be killed prematurely during shutdown. [GL #978]
5211. [bug] Allow out-of-zone additional data to be included in authoritative responses if recursion is allowed and "minimal-responses" is disabled. This behavior was inadvertently removed in change #4605. [GL #817]
5210. [bug] When dnstap is enabled and recursion is not available, incoming queries are now logged as "auth". Previously, this depended on whether recursion was requested by the client, not on whether recursion was available. [GL #963]
5209. [bug] When update-check-ksk is true, add_sigs was not considering offline keys, leaving record sets signed with the incorrect type key. [GL #763]
5208. [test] Run valid rdata wire encodings through totext+fromtext and tofmttext+fromtext methods to check these methods. [GL #899]
5207. [test] Check delv and dig TTL values. [GL #965]
5206. [bug] Delv could print out bad TTLs. [GL #965]
5205. [bug] Enforce that a DS hash exists. [GL #899]
5204. [test] Check that dns_rdata_fromtext() produces a record that will be accepted by dns_rdata_fromwire(). [GL #852]
5203. [bug] Enforce whether key rdata exists or not in KEY, DNSKEY, CDNSKEY and RKEY. [GL #899]
5202. [bug] <dns/ecs.h> was missing ISC_LANG_ENDDECLS. [GL #976]
5190. [bug] Ignore trust anchors using disabled algorithms. [GL #806]
|
1.142.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.695 | 17-Sep-2025 |
rillig | lint: answer two questions from the code by writing tests for them
|
1.694 | 14-Sep-2025 |
rillig | lint: fix-up prefix commit by adding a rationale and an edge case check
|
1.693 | 14-Sep-2025 |
rillig | lint: warn about signed '<<' that ends up exactly in the msb
|
1.692 | 14-Sep-2025 |
rillig | lint: fix integer overflow in '<<' evaluation
Just in case that -ftrapv will someday cover '<<' as well, in addition to the classic arithmetic operators.
|
1.691 | 14-Sep-2025 |
rillig | lint: do not preserve bit-field information in integer promotions
The bit-field information was wrongly added back in 2021. At that time, the integer constraints had not been implemented yet, so it was a straight-forward idea to implement value restrictions using the type system and propagage these through the expressions.
Due to preserving the bit-field information, some lint warnings contained wrong type information. These warnings are now fixed.
|
1.690 | 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.689 | 07-Sep-2025 |
rillig | lint: clean up checks for '<<' and '>>'
|
1.688 | 06-Sep-2025 |
rillig | lint: reword message for bit-shift in trad-C90 migration mode
Mentioning the type names gives a hint about why the behavior differs; the message only occurs when the type of the shift amount has higher rank than the type of the shifted value.
|
1.687 | 31-Jul-2025 |
rillig | lint: fix return type of GCC's __atomic functions
|
1.686 | 11-Jul-2025 |
rillig | lint: fix warning about enum array index
Seen in openssh/fmt_scaled.c, scale_chars.
|
1.685 | 08-Jul-2025 |
rillig | lint: reword message about 'extra bits set to 0'
The word 'extra' in the previous wording was too unspecific to make sense of. In the reworded message, focus on the problem instead of mentioning only the effect.
|
1.684 | 16-May-2025 |
rillig | lint: clean up
|
1.683 | 04-May-2025 |
rillig | lint: add more details to message about discarding qualifiers
The name of the function (or, if not available, its type) is useful in lines that contain more than one function call.
|
1.682 | 12-Apr-2025 |
rillig | lint: warn about constant assignment in operand to '&&' or '||'
Seen in bin/sh/redir.c:1084 for errno, which is fine.
Seen in usr.sbin/mopd/mopprobe/mopprobe.c:235, which looks suspicious but hasn't been touched since 1997.
|
1.681 | 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.680 | 10-Apr-2025 |
rillig | lint: remove now-unnecessary CONSTCOND comments
|
1.679 | 10-Apr-2025 |
rillig | lint: do not warn about constant operand of '!'
Like its related warning about a constant condition, the purpose of this warning is unclear, and suppressing the warning requires special lint comments, thus cluttering the code.
The message itself is still kept in err.c to keep the '-X 239' option valid. These LINTFLAGS will be removed in a follow-up commit.
The lint comments /* CONSTCOND */, as well as its more verbose forms /* CONSTANTCOND */ and /* CONSTANTCONDITION */ are no longer needed and can be removed.
|
1.678 | 06-Apr-2025 |
rillig | lint: remove warning about 'constant in conditional context'
In a full NetBSD build, this warning occurs about 2400 times, making it the top 9 warning overall. There is no evidence though that this warning detects any real bugs, so the noise it makes is not warranted.
In this first step, the warning is still listed in the lint(7) manual page, as removing it from there would immediately make all places with "LINTFLAGS += -X 161" fail. These '-X 161' flags cannot be removed first because then, the warning would step in and make the build fail.
The next step is to clean up the "-X 161" options from all LINTFLAGS, and then the final step is to remove the warning from err.c.
|
1.677 | 21-Mar-2025 |
rillig | lint: don't warn when a cast increases the alignment from 1 to n
|
1.676 | 11-Mar-2025 |
rillig | lint: fix saturated multiplication in integer constraints check
After the change from ui_max_value to si_max_value in tree.c 1.675 from 2025-02-27, it was wrong to divide the maximum value by 2 once more.
|
1.675 | 27-Feb-2025 |
rillig | lint: fix integer overflow when multiplying two large signed numbers
Seen in ipsec-tools/crypto_openssl.c.
|
1.674 | 27-Feb-2025 |
rillig | lint: add details to message about conversion in 'case'
|
1.673 | 24-Feb-2025 |
rillig | lint: remove no-op variant of the unary '&' operator
Neither K&R 1978 nor any of the C standards mentions that &function or &array would be a no-op. This no-op behavior produced wrong warnings in sbin/gpt.
|
1.672 | 20-Feb-2025 |
rillig | lint: add detail to message about truncated constant
|
1.671 | 20-Feb-2025 |
rillig | lint: mention the assignment operator in 'illegal combination'
In source lines that contain both a 'return' statement as well as a function-like macro, such as the C11 atomics, seeing the word 'init' in the diagnostic helps to see that the type conflict is not in the 'return' statement but instead in some initializer.
Seen in userspace-rcu/wfcqueue.h:147.
|
1.670 | 05-Jan-2025 |
rillig | lint: clean up integer constraints
Since ic_con already handles conversions (and casts), there is no need to unwrap the conversions (but not the casts) explicitly.
|
1.669 | 02-Jan-2025 |
rillig | lint: fix possible loss of accuracy in multiplication and division
|
1.668 | 02-Jan-2025 |
rillig | lint: fix assertion failure in pointer subtraction
|
1.667 | 02-Jan-2025 |
rillig | lint: fix a few wrong warnings about possible loss of accuracy
|
1.666 | 02-Jan-2025 |
rillig | lint: compute integer constraints for xor and minus
These operators allow lint to correctly track the possible values in expressions that sign-extend an integer.
|
1.665 | 01-Jan-2025 |
rillig | lint: fix wrong warning about possible loss of accuracy
The expression "'0' + random() % 10" always fits in a signed or unsigned char.
|
1.664 | 15-Dec-2024 |
rillig | lint: merge duplicate code for possibly confusing precedence
|
1.663 | 15-Dec-2024 |
rillig | lint: add details to message about possible precedence confusion
|
1.662 | 30-Nov-2024 |
rillig | lint: add back optimization for non-query mode
The main point of the optimization is to skip the expensive calls to type_name when preparing the message details. This was not spelled out explicitly in the comment.
While here, fix the stray 'previous declaration' message that occurred whenever a function was first declared as 'static' and later defined without 'static', see query 16.
|
1.661 | 29-Nov-2024 |
rillig | lint: remove premature optimization for non-query scenarios
|
1.660 | 23-Nov-2024 |
rillig | lint: use separate message when discarding a qualifier in call
|
1.659 | 23-Nov-2024 |
rillig | lint: add details to messages about discarding qualifiers
The related message 153 is left as-is, as it is used in two places, and the second place is not only about discarded qualifiers.
|
1.658 | 13-Nov-2024 |
rillig | lint: add more details to 'statement not reached' message
In lib/libcompat/regexp/regexp.c, the FAIL macro expands to a compound statement containing a function call statement and a return statement, and the macro invocation is followed by a semicolon, forming an extra empty statement. Which of these statements is unreachable now becomes clear from the diagnostic, without having to inspect the preprocessed source code.
|
1.657 | 31-Oct-2024 |
rillig | lint: allow enum constant named 'N_*' to exceed the array index
Seen in libxcb.
While here, add the name of the enum constant to the message, to quickly decide whether the identifier is outside the range of expected enum values, thus marking the number of enum constants.
|
1.656 | 12-Oct-2024 |
rillig | lint: reduce wrong warnings about loss of accuracy in signed '%'
|
1.655 | 11-Oct-2024 |
rillig | lint: sort integer constraint functions and branches
No functional change.
|
1.654 | 10-Oct-2024 |
rillig | lint: reduce debug logging for possible loss of accuracy
When checking whether a type can represent an expression, only do the debug logging in the case where the expression cannot obviously be represented by the type, as the successful cases are usually uninteresting. While here, clean up the nesting in the debug log.
|
1.653 | 08-Oct-2024 |
rillig | lint: compute integer constraints for unsigned multiplication
This fixes the wrong warning about possible loss of accuracy in libc/c16rtomb.
|
1.652 | 28-Sep-2024 |
rillig | lint: reword warning about cast between unrelated pointer types
The phrase "may be troublesome" was too unspecific to be useful.
|
1.651 | 19-Aug-2024 |
rillig | lint: remove unused integer constraint
The assignment in ic_cond was wrong, it should have been '&' instead of '|', but as long as '~' is not involved in the integer constraints, there is no way to demonstrate this bug.
|
1.650 | 18-Aug-2024 |
rillig | lint: add value propagation for '/' combined with bit operations
Fixes __SHIFTIN/__SHIFTOUT expressions, as in PR toolchain/58617.
|
1.649 | 10-Jul-2024 |
rillig | lint: add warning for '!(var = constant)'
This catches expressions like 'ATF_CHECK(errno = ENOENT)', which was intended to use '==' instead of '='.
|
1.648 | 17-Jun-2024 |
rillig | branches: 1.648.2; lint: accept C23 [[fallthrough]] statements
Needed by bind9/getaddresses.c:137.
|
1.647 | 09-Jun-2024 |
rillig | lint: fix usage marker for nested function calls
|
1.646 | 09-Jun-2024 |
rillig | lint: warn about lossy floating point constant to integer conversions
|
1.645 | 08-Jun-2024 |
rillig | lint: fix type of GCC-specific __FUNCTION__ to be an array
|
1.644 | 08-Jun-2024 |
rillig | lint: add details to warnings about negative constant to unsigned
|
1.643 | 12-May-2024 |
rillig | lint: don't call memcpy with null pointer
Even copying 0 bytes from a null pointer invokes undefined behavior.
|
1.642 | 11-May-2024 |
rillig | lint: warn when comparing an integer to a floating point constant
|
1.641 | 10-May-2024 |
rillig | lint: clean up conversion from floating point constant
|
1.640 | 03-May-2024 |
rillig | lint: measure the alignment in bytes, not bits
While measuring the alignment in bits makes sense when building a struct type with bit-fields, in all other places it is more confusing than helpful.
The only visible change is that in debug mode, the format of type sizes and alignment changed. Since the size of all complete types is a multiple of a byte (as defined in the C standard), sizes and alignments are reported in bytes as well. Only while a struct is being built, the type size may include an additional '+x' for the bits of a bit-field.
|
1.639 | 01-May-2024 |
rillig | lint: make 'offsetof(t, array-member)' a constant expression
The macro 'offsetof(t, m)' already expanded to a constant expression for scalar members but not for arrays. This was because the macro expanded to '(size_t)(((t *)0)->m)', which lint internally represents as 'addr(indir(ptr(0) + offset(m)))', and build_address simplifies 'addr(indir(x))' to 'x' if the types match. The types only match for scalar types though, but not for arrays.
When build_address happens, the type information is incomplete, therefore 'offsetof(t, array)' has to be simplified at a later point.
|
1.638 | 01-May-2024 |
rillig | lint: fix warning about out-of-bounds bit-field value
|
1.637 | 27-Apr-2024 |
rillig | lint: converting a null pointer to another pointer type is not narrowing
|
1.636 | 27-Apr-2024 |
rillig | lint: add query for conversion from void pointer to other pointer
|
1.635 | 12-Apr-2024 |
rillig | lint: clean up and speed up the check for snprintb
|
1.634 | 31-Mar-2024 |
rillig | lint: merge function call operators 'CALL' and 'ICALL'
|
1.633 | 30-Mar-2024 |
rillig | lint: in the query about implicit conversions, ignore casts
|
1.632 | 30-Mar-2024 |
rillig | lint: add query for implicit integer-to-floating conversion
|
1.631 | 30-Mar-2024 |
rillig | lint: do not convert array subscripts from size_t to ptrdiff_t
The C standards do not specify a fixed type for an array subscript, it just has to be an integer type. Previously, query 4 fired for the ubiquitous expression 'ptr[sz]' when sz had type 'size_t'.
The test platform_ilp32_long is unaffected by this change, as the integer constant 0x80000000 has type 'unsigned int', while size_t is 'unsigned long' on those platforms, and even though the types 'unsigned int' and 'unsigned long' have the same value space, there's still a conversion, at least for now.
|
1.630 | 30-Mar-2024 |
rillig | lint: reword messages about array subscripts to sound more natural
|
1.629 | 29-Mar-2024 |
rillig | lint: clean up
|
1.628 | 27-Mar-2024 |
rillig | lint: clean up; extend overflow test
|
1.627 | 27-Mar-2024 |
rillig | lint: don't use 'long' in diagnostics
The size of 'long' differs between 64-bit and 32-bit platforms. Eliminate this possible platform-dependency.
|
1.626 | 25-Mar-2024 |
rillig | lint: fix warnings about loss of accuracy on bit-field operations
|
1.625 | 19-Mar-2024 |
rillig | lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.624 | 12-Mar-2024 |
rillig | lint: fix warning about loss of conversion for unsigned bit-fields
Since decl.c 1.180 from 2021-05-02.
|
1.623 | 10-Mar-2024 |
rillig | lint: add details to the message about integer overflow
Having only the operator was too unspecific to be actionable, so add the actual numbers and the data type.
|
1.622 | 10-Mar-2024 |
rillig | lint: saturate signed integer overflow
In array address calculations, this prevents a 'array subscript cannot be negative' for large array subscripts.
|
1.621 | 10-Mar-2024 |
rillig | lint: fix integer overflow detection
Previously, an unsigned operation that had a negative result went undetected in a few cases. Now, all results that are not representable by their type are considered overflows.
The implementation of signed shift-right had been wrong for a few commits.
|
1.620 | 10-Mar-2024 |
rillig | lint: clean up check for overflow in integer constants
|
1.619 | 10-Mar-2024 |
rillig | lint: detect more cases of integer overflow in constant expressions
For unsigned integers, detect when 'a + b' wraps around.
|
1.618 | 10-Mar-2024 |
rillig | lint: split integer overflow check into separate functions
The checks for unsigned and signed integers differ for each operator, so there's no point having both parts in the same function.
|
1.617 | 10-Mar-2024 |
rillig | lint: remove wrong warning about overflow in unary '-' for unsigned
|
1.616 | 10-Mar-2024 |
rillig | lint: fix integer overflow in integer overflow check
|
1.615 | 10-Mar-2024 |
rillig | lint: in check for integer overflow, sort operators
|
1.614 | 09-Mar-2024 |
rillig | lint: fix excessive overflow warning after division by zero
|
1.613 | 09-Mar-2024 |
rillig | lint: merge duplicate code for checking array index
|
1.612 | 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.611 | 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.610 | 09-Mar-2024 |
rillig | lint: remove unneeded checks for left and right operands
|
1.609 | 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.608 | 03-Mar-2024 |
rillig | lint: check for unreachable bits and fields in snprintb formats
While here, clean up a few existing checks.
|
1.607 | 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.606 | 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.605 | 08-Feb-2024 |
rillig | lint: clean up variable names, parameter order, comments
No functional change.
|
1.604 | 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.603 | 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.602 | 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.601 | 01-Feb-2024 |
rillig | lint: reuse buffer editing code across lint1
Fix cat_strings to update the capacity of the buffer, to prevent quadratic runtime when concatenating string literals.
|
1.600 | 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.599 | 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.598 | 23-Jan-2024 |
rillig | lint: unconst parameters
These were leftovers from earlier refactorings and are no longer needed.
No binary change.
|
1.597 | 23-Jan-2024 |
rillig | lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive.
No functional change.
|
1.596 | 21-Jan-2024 |
rillig | lint: clean up redundant const from parameters and local variables
These were leftovers from splitting large functions into smaller functions, to ensure that variables were not unintentionally reassigned. Those refactorings are finished, and the extra help from the compiler is no longer necessary.
No binary change.
|
1.595 | 11-Jan-2024 |
rillig | lint: clean up enum constants for designators
In intializers and offsetof, both struct and union members are handled in the same way, thus there is no need to distinguish them.
|
1.594 | 11-Jan-2024 |
rillig | lint: correctly set system-header flag on cast-expression
When a cast-expression comes partly from a system header, determine at the ')' whether the whole cast-expression comes from the system header. Previously, it was based on the operand, which contradicted the documentation of tn_sys.
Mainly affects strict bool mode (where expressions from system headers are handled more leniently), as well as query 9 for parenthesized return expressions.
Discovered upon manual inspection, as calling expr_alloc_tnode should never be necessary when creating an expression node with operands; there's build_op for that purpose.
|
1.593 | 11-Jan-2024 |
rillig | lint: warn about integer overflow when folding constant INT_MIN / -1
|
1.592 | 09-Jan-2024 |
rillig | lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not identifiers but designator sequences, such as in 'offsetof(struct stat, st_atim.tv_sec)', so make lint accept them as well.
|
1.591 | 07-Jan-2024 |
rillig | lint: fix crash for invalid __func__ (since 2023-01-29)
|
1.590 | 07-Jan-2024 |
rillig | lint: fix memory allocation names, eliminate double negation
|
1.589 | 06-Jan-2024 |
rillig | lint: remove redundant parentheses, braces and comments
Rename the functions for folding constant expressions, to make the comments redundant.
|
1.588 | 06-Jan-2024 |
rillig | lint: remove redundant comments
|
1.587 | 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.586 | 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.585 | 03-Dec-2023 |
rillig | lint: move function body brace to the left
No functional change.
|
1.584 | 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.583 | 02-Dec-2023 |
rillig | lint: extract nonportable char comparison to separate function
No functional change.
|
1.582 | 02-Dec-2023 |
rillig | lint: rename NOSCL to NO_SCL
For symmetry with NO_TSPEC. No functional change.
|
1.581 | 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.580 | 12-Sep-2023 |
rillig | lint: mark unreachable function call arguments as used as well
Previously, in a '?:' expression with a constant condition, the branch that is not taken was skipped but any identifiers in there were intended to be marked as used. In function call expressions, this only worked for the last argument, as the PUSH operator is not a binary operator (see ops.def). Cover this case as well.
|
1.579 | 12-Sep-2023 |
rillig | lint: mark symbols that are only used in untaken '?:' branch as used
|
1.578 | 26-Aug-2023 |
rillig | lint: make diagnostics about ANSI C more international
|
1.577 | 08-Aug-2023 |
rillig | lint: in -a mode, do not warn about integer conversions from 'int'
Since tree.c 1.552 from 2023-07-08, lint warned about integer conversions from 'int' or 'unsigned int' to smaller integer types. This only affected 32-bit platforms where size_t is 'unsigned int' rather than 'unsigned long', as on these platforms, the integer ranks of 'int' and 'long' are the same, see INT_RANK in inittyp.c.
Discovered by lib/libkvm, which fails on i386 when lint generates any warnings.
|
1.576 | 05-Aug-2023 |
rillig | lint: implement __builtin_offsetof for the simplest cases
Cases not covered: 1. C99 allows designators in the offsetof macro. 2. For packed types, the offset is likely to be incorrect.
|
1.575 | 02-Aug-2023 |
rillig | lint: fix plural form in message 150
|
1.574 | 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.573 | 15-Jul-2023 |
rillig | lint: clean up duplicate code for finding struct/union members
|
1.572 | 15-Jul-2023 |
rillig | lint: properly initialize unnamed struct/union members
Previously, their 'containing type' was not initialized. The code for initializing them is adapted from declarator_name.
|
1.571 | 15-Jul-2023 |
rillig | lint: fix member lookup after GCC statement expression
|
1.570 | 15-Jul-2023 |
rillig | lint: split struct_or_union_member into separate parts
|
1.569 | 15-Jul-2023 |
rillig | lint: fix use-after-free bug in GCC statement expressions
|
1.568 | 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.567 | 15-Jul-2023 |
rillig | tests/lint: demonstrate use-after-free in GCC statement expression
|
1.566 | 14-Jul-2023 |
rillig | lint: clean up redundant and verbose code
|
1.565 | 14-Jul-2023 |
rillig | lint: rename function for creating a new expression node
|
1.564 | 14-Jul-2023 |
rillig | lint: clean up comments, add a test for the '?:' operator
|
1.563 | 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.562 | 13-Jul-2023 |
rillig | lint: clean up code related to lint comments
Remove type information from variable names, as the word 'flag' did not indicate that the variables were negated.
Remove contradicting comments. Suppressing a warning for 'this line', 'this and the following line' and 'this statement or declaration' cannot all be accurate at the same time.
|
1.561 | 12-Jul-2023 |
rillig | lint: clean up handling of __real__ and __imag__
These two operatos are not binary, therefore they don't need a right operand. The questionable operands were a copy-and-paste mistake, as the code was taken from the ++ and -- operands (tree.c 1.46 from 2008-04-25). The ++ and -- operands aren't binary either, but since lint represents address calculations in their premultiplied form, the expression ptr++ contains a hidden right operand specifying the number of bytes by which to increment the pointer.
Creating an integer-constant-expression node with type 'long double' didn't make sense either. Luckily, these expressions are only built but not analyzed any further.
|
1.560 | 10-Jul-2023 |
rillig | lint: merge duplicate code for getting the name of an operator
|
1.559 | 10-Jul-2023 |
rillig | lint: clean up wchar_t and hash tables
|
1.558 | 09-Jul-2023 |
rillig | lint: in the warning about ordered enums, mention the affected type
|
1.557 | 09-Jul-2023 |
rillig | lint: clean up wording in diagnostics
Use the term 'parameter' as defined in C99 3.15.
|
1.556 | 09-Jul-2023 |
rillig | lint: clean up the wording of a few diagnostics
|
1.555 | 09-Jul-2023 |
rillig | lint: remove redundant '#' after 'argument' in diagnostics
|
1.554 | 08-Jul-2023 |
rillig | lint: warn about pointer casts between different kinds of types
Pointer casts from an integer type to a floating-point type and vice versa get a 'maybe troublesome' warning now. The previous assumption that all types of the same bit-size are convertible may have been valid from a technical point of view, but still such code should get more attention.
The rules for struct and union types could be made more fine-grained later, if the need arises. To suppress this warning, it's always possible to cast to an intermediate 'void *'.
|
1.553 | 08-Jul-2023 |
rillig | lint: do not use portable type sizes in integer constraints
This reverts the change from tree.c 1.547 from 2023-07-03. Back then, I didn't know that the actual value from a type's 'portable size in bits' was not supposed to be used.
|
1.552 | 08-Jul-2023 |
rillig | lint: warn about conversion from 128-bit to smaller integer types
|
1.551 | 08-Jul-2023 |
rillig | lint: clean up
PUSH nodes are not marked as binary, yet they have a left and a right operand.
If none of the queries is enabled, omit the query from the debug log.
|
1.550 | 08-Jul-2023 |
rillig | lint: clarify the meaning of 'portable size in bits' of a type
No functional change.
|
1.549 | 07-Jul-2023 |
rillig | lint: only warn about traditional/C90 differences in migration mode
In C99 mode, there is no point warning about traditional C.
No change in the tests, as a complete test suite would require several new test files, and migration mode is not used intensively.
|
1.548 | 07-Jul-2023 |
rillig | lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only combining them if actually desired.
|
1.547 | 03-Jul-2023 |
rillig | lint: consistently use portable type size in integer constraints
Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible loss of accuracy when converting from 'long' to 'int' on an ILP32 platform that uses 'unsigned long' for size_t, when run in portable mode (-p), which is enabled by default in the NetBSD build.
The integer constraints avoid false-positive warnings by looking at the actual values an expression can take. The function can_represent is guarded by a condition that uses the portable_size_in_bits, but then internally used the opposite size_in_bits, which led to inconsistent results.
The warning looks confusing though, as on an ILP32 platform, 'int' and 'long' have the same size and representation, therefore there cannot be an actual loss of accuracy. The warning may need to be reworded to explicitly mention the portability mode, in which sizeof(int) is assumed to be 3 instead of 4, to catch possible loss of accuracy on other platforms.
|
1.546 | 03-Jul-2023 |
rillig | lint: clean up redundant casts
|
1.545 | 03-Jul-2023 |
rillig | lint: rename uppercase QUAD to LLONG
No binary change.
|
1.544 | 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.543 | 02-Jul-2023 |
rillig | lint: clean up variable names
|
1.542 | 01-Jul-2023 |
rillig | lint: constify, reduce indentation
No functional change.
|
1.541 | 01-Jul-2023 |
rillig | lint: clean up duplicate and dead code for integer constants
No functional change.
|
1.540 | 01-Jul-2023 |
rillig | lint: clean up typos
|
1.539 | 01-Jul-2023 |
rillig | lint: fix initialization of unnamed union member
|
1.538 | 30-Jun-2023 |
rillig | lint: clean up names related to declaration levels
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
1.537 | 30-Jun-2023 |
rillig | lint: fix handling of unnamed struct/union members
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
|
1.536 | 30-Jun-2023 |
rillig | lint: clean up tree.c
No functional change.
|
1.535 | 30-Jun-2023 |
rillig | lint: make alignof(incomplete enum) an error
|
1.534 | 30-Jun-2023 |
rillig | lint: use NULL for null pointer constants
No binary change.
|
1.533 | 30-Jun-2023 |
rillig | lint: add query for assigning an integer 0 to a pointer
|
1.532 | 29-Jun-2023 |
rillig | lint: use standard terminology for bit-field width
No functional change.
|
1.531 | 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.530 | 24-Jun-2023 |
rillig | lint: don't warn about comparison between char and character constant
|
1.529 | 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.528 | 22-Jun-2023 |
rillig | lint: add query for comma operator
|
1.527 | 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.526 | 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.525 | 03-Jun-2023 |
rillig | lint: provide more detailed types when operands do not match
|
1.524 | 22-May-2023 |
rillig | lint: rename constant NOTSPEC to NO_TSPEC
It was too easy to misread the old name as NOT_SPEC instead of the intended NO_TSPEC.
|
1.523 | 13-May-2023 |
rillig | lint: add query for chained assignments
|
1.522 | 10-May-2023 |
rillig | lint: make code simpler
No functional change.
|
1.521 | 09-May-2023 |
rillig | lint: track integer constraints through conditional expressions
|
1.520 | 09-May-2023 |
rillig | lint: preserve integer constraints on cast
|
1.519 | 22-Apr-2023 |
rillig | lint: allow cast from a type to a union containing that type
|
1.518 | 22-Apr-2023 |
rillig | lint: fix missing initialization for cast to union
The left operand of a unary AST node must not be NULL.
The previous code crashed lint when run with some query enabled, as is_cast_redundant assumes that a non-null AST node has valid operands.
$ cat <<EOF > crash.c double demo(void) { union u { double *num; } u; u = (union u)&((double) { 0.0 }); return *u.num; } EOF $ /usr/libexec/lint1 -w -S -g -q8 crash.c /dev/null
|
1.517 | 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.516 | 22-Apr-2023 |
rillig | lint: don't warn about cast between union and one of its member types
Seen in src/sbin/newfs_udf/udf_core.c for context.anchors.
|
1.515 | 22-Apr-2023 |
rillig | lint: do not warn about parenthesized assignment in controlling expr
Same as for GCC and Clang.
|
1.514 | 22-Apr-2023 |
rillig | lint: fix typos in comments
|
1.513 | 14-Apr-2023 |
rillig | lint: document suppressed LDBL_MAX warning more accurately
The crucial point is not that lint is cross-compiled but that tools/lint is run on the usr.bin/xlint code, and in that situation, the platform mismatch happens.
|
1.512 | 12-Apr-2023 |
rillig | lint: suppress warnings about LDBL_MAX in cross-build mode
This fixes the cross build for sparc64 on x86_64, in which lint complained: warning: floating-point constant out of range [248] warning: floating point overflow on operator '-' [142] warning: floating-point constant out of range [248]
|
1.511 | 11-Apr-2023 |
rillig | lint: fix converting a complex floating-point constant
The complex '+' in msg_142 line 27 led to an invalid floating point value when converting from 'double' to '_Complex double'.
|
1.510 | 11-Apr-2023 |
rillig | lint: fix wrong warning about overflow in floating constant expressions
|
1.509 | 11-Apr-2023 |
rillig | lint: condense code
No functional change.
|
1.508 | 11-Apr-2023 |
rillig | lint: don't wrongly warn about overflow in complex constants
Seen in lib/libm.
|
1.507 | 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.506 | 24-Feb-2023 |
rillig | lint: order functions to to reduce forward declarations
No functional change.
|
1.505 | 22-Feb-2023 |
rillig | lint: fix confusing message about nonportable character constants
|
1.504 | 29-Jan-2023 |
rillig | lint: fix definition of __func__
|
1.503 | 29-Jan-2023 |
rillig | lint: demonstrate wrong declaration of __func__
|
1.502 | 29-Jan-2023 |
rillig | lint: don't warn about negative '>>' when the actual value is positive
|
1.501 | 29-Jan-2023 |
rillig | lint: inline an expression, clean up comments
No functional change.
|
1.500 | 29-Jan-2023 |
rillig | lint: untangle conditions in promote_c90
No functional change.
|
1.499 | 28-Jan-2023 |
rillig | lint: extract casting to a union into separate function
No functional change.
|
1.498 | 28-Jan-2023 |
rillig | lint: use stronger wording in comments of unimplemented offsetof
|
1.497 | 28-Jan-2023 |
rillig | lint: split usual arithmetic conversions into separate functions
No functional change.
|
1.496 | 28-Jan-2023 |
rillig | lint: split integer promotions into separate functions
No functional change.
|
1.495 | 28-Jan-2023 |
rillig | lint: remove commented code from new_tnode
The approach in that code was wrong anyway. If an expression is shifted to the right, that doesn't change the declared type of the expression, it only changes the possible range of values. A better way to implement these restricted value spaces is by using integer_constraints.
No functional change.
|
1.494 | 22-Jan-2023 |
rillig | lint: prevent undefined behavior for signed '<<'
Found by manual code inspection, verified by MKSANITIZER=yes USE_SANITIZER=undefined.
|
1.493 | 21-Jan-2023 |
rillig | lint: make code for strict bool mode more consistent
Guard all entry points with a check for Tflag and remove the now redundant internal check for Tflag.
No functional change.
|
1.492 | 14-Jan-2023 |
rillig | lint: use fewer abbreviations
No binary change except for line numbers in assertions in decl.c.
|
1.491 | 14-Jan-2023 |
rillig | lint: split struct_or_union_member into two halves
No functional change.
|
1.490 | 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.489 | 08-Jan-2023 |
rillig | lint: do not report usual arithmetic conversions for constants
|
1.488 | 08-Jan-2023 |
rillig | lint: extract usual arithmetic conversions to separate function
No functional change.
|
1.487 | 08-Jan-2023 |
rillig | lint: recognize enum constant named 'max' as a count of values
Seen in external/bsd/mdocml/dist/mdoc.h(50).
|
1.486 | 04-Jan-2023 |
rillig | lint: fix the result type of '?:' for void pointers
The change from 2015-07-29 was wrong since that rule only applies to null pointer constants but not to other void pointers.
|
1.485 | 03-Jan-2023 |
rillig | lint: condense building of nodes for '?:' expressions
No binary change except for line numbers in assertions.
|
1.484 | 30-Nov-2022 |
rillig | lint: add measurement unit to local variable names
No binary change, except for line numbers in assertions.
|
1.483 | 01-Oct-2022 |
rillig | lint: inline local variable in build_function_argument
No functional change.
|
1.482 | 01-Oct-2022 |
rillig | lint: miscellaneous cleanup
No functional change.
|
1.481 | 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.480 | 28-Aug-2022 |
rillig | lint: inline previous_declaration for nonconstant message IDs
This adds back the compile-time printf validation in debug mode that was missing before.
|
1.479 | 28-Aug-2022 |
rillig | lint: clean up visual clutter
No functional change.
|
1.478 | 28-Aug-2022 |
rillig | lint: rename functions to be clearer
No need anymore to keep external identifiers at the "6 significant initial characters" mandated by C90.
|
1.477 | 25-Aug-2022 |
rillig | lint: remove explicit list of known GCC attributes
Most GCC attributes consist of a single identifier. Up to now, it was necessary to list each of these identifiers in the grammar, even those that only apply to a single target architecture.
Instead, parse the general form of attributes, matching the few attributes that lint handles by name instead. While here, rename the grammar rules to use the GCC terms.
To avoid conflicts between the global function 'printf' and the GCC attribute of the same name, do not add GCC attributes to the symbol table, and don't make these symbols 'extern' either.
ok christos@.
|
1.476 | 19-Aug-2022 |
rillig | lint: add more details to message about large bit-shifts
|
1.475 | 16-Jul-2022 |
rillig | lint: add more details to message about pointer alignment
The previous message 'may cause alignment problem' was not detailed enough to be actionable, it didn't give the necessary insight to why lint was complaining at all.
The new message 'increases alignment from 1 to 4' or 'from 2 to 8' describes the potentially problematic conversion, and together with the involved type names, it allows an informed decision about whether lint's warning is warranted or not.
In a typical NetBSD build, this warning is in the top 10. The number of these warnings depends on the architecture, it is typically between 800 and 1600.
|
1.474 | 08-Jul-2022 |
rillig | lint: fix edge cases in the query for redundant cast before assignment
Casting from and to _Bool is only allowed outside strict bool mode. Outside strict bool mode, _Bool is an integer type, therefore return early if any of the operands has type _Bool. In strict bool mode, even casting from _Bool to _Bool is not allowed, as it is not needed in practice.
Handle _Complex types before real floating-point types. Return early for _Complex types, as these are floating-point types as well.
For pointer casts, not only flag casts to or from 'pointer to void', but also casts between the same types.
In debug mode, when constructing the type '_Complex float', the type name of '_Complex' occurs in the debug log. Outside of debug mode, printing this type name is an error since this type keyword only occurs internally, when constructing a type. At that point, it is not supposed to occur in any user-visible message.
|
1.473 | 08-Jul-2022 |
rillig | lint: fix query for redundant cast before assignment
Previously, 'i = (int)dbl' was marked as redundant, even though it performs a value conversion.
|
1.472 | 06-Jul-2022 |
rillig | lint: do not warn about 'may lose accuracy' in safe cases of '%'
The possible values of the expression 'a % b' for unsigned integers lie between 0 and (b - 1). For signed integers, it's more complicated, so ignore them for now.
|
1.471 | 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.470 | 03-Jul-2022 |
rillig | lint: add debug logging for struct and enum details
|
1.469 | 02-Jul-2022 |
rillig | lint: prevent undefined behavior when folding '<<' or '>>'
|
1.468 | 02-Jul-2022 |
rillig | lint: document usage of 'convert'
No functional change.
|
1.467 | 02-Jul-2022 |
rillig | lint: only convert the right operand of '<<' or '>>' in traditional C
Traditional C says: "Then the right operand is converted to int".
C90 dropped that sentence, probably because it didn't have any effect on the result or the conditions for undefined behavior.
To stick to the wording of the specification, also convert UINT to INT.
While here, fix the call to 'convert'. The first argument being 'CVT' means that the conversion comes from a cast-expression instead of an implicit conversion. This prevents warnings for 'uint64_t << uint64_t'. Keeping this unnecessary conversion in C90 or later would have generated warnings for the functions at the bottom of msg_132.c.
|
1.466 | 01-Jul-2022 |
rillig | lint: add quotes around operator in message 138, remove message 240
Message 138 doesn't occur in practice, it was the last one that was missing the quotes around the placeholder.
Message 240 was also missing the quotes, but it was not reachable. There was also no apparent benefit in warning about 'assignment of different structures' when the message about 'assignment type mismatch' serves the same purpose.
|
1.465 | 01-Jul-2022 |
rillig | lint: restructure 'convert'
The conditions are now grouped by target type, highlighting that conversions between integer and floating point types are not checked by this function, in fact, they are not checked at all.
No functional change.
|
1.464 | 01-Jul-2022 |
rillig | lint: rename functions for value conversion
No functional change.
|
1.463 | 24-Jun-2022 |
rillig | lint: do not warn about pointer casts to array types
If the (recursive) element type of the array is compatible, that's good enough. Even after the previous commits, this warning is the one that occurs most in a standard NetBSD build, and it is generally ignored. For now, focus on reducing the number of false positives to an acceptable level.
|
1.462 | 24-Jun-2022 |
rillig | lint: allow pointer cast between compatible structs
Lint already allowed pointer casts from 'struct counter' to 'struct counter_impl'. Now it also allows the other direction.
|
1.461 | 24-Jun-2022 |
rillig | lint: do not warn about pointer cast between sockaddr variants
|
1.460 | 24-Jun-2022 |
rillig | lint: allow pointer cast from char to struct/union
|
1.459 | 22-Jun-2022 |
rillig | lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.
Message 138 is kept as-is, as it is not yet covered by any tests.
Message 240 is kep as-is, as it is unreachable.
|
1.458 | 21-Jun-2022 |
rillig | lint: merge duplicate code in typeok_minus
No functional change.
|
1.457 | 21-Jun-2022 |
rillig | lint: clean up comments, don't include unused header
No functional change.
|
1.456 | 21-Jun-2022 |
rillig | lint: use is_struct_or_union instead of comparing twice
No functional change.
|
1.455 | 21-Jun-2022 |
rillig | lint: add quotes and details to some more messages
|
1.454 | 19-Jun-2022 |
rillig | lint: add quotes around placeholders in 4 messages
|
1.453 | 15-Jun-2022 |
rillig | lint: rename mod_t.m_requires_bool to m_compares_with_zero
The operators NOT, LOGAND, LOGOR and QUEST only require _Bool in strict bool mode, in default mode they accept any scalar expression and compare it with zero. The new names are more accurate.
No functional change.
|
1.452 | 30-May-2022 |
rillig | lint: revert 'do not pre-multiply pointer expressions' from 2022-05-26
In tree.c 1.448, removing the pre-multiplication generated wrong warnings about out-of-bounds array access.
|
1.451 | 30-May-2022 |
rillig | lint: fix assertion failure in '(unsigned long)(ptr) >> 12'
Since tree.c 1.449 from 2022-05-26.
|
1.450 | 29-May-2022 |
rillig | lint: fix wrong errors about sizeof of a bit-field (since 2022-05-26)
|
1.449 | 26-May-2022 |
rillig | lint: do not warn about 'uint32_t = uint64_t >> 32'
If all possible values fit into the destination type, there is no possibility of losing accuracy.
Enhances PR 36668.
|
1.448 | 26-May-2022 |
rillig | lint: do not pre-multiply pointer expressions 'ptr + int'
In the AST, it is confusing to see that 'stderr == __sF + 304', it should rather be 'stderr == __sF + 2'.
No functional change.
|
1.447 | 26-May-2022 |
rillig | lint: improve local variable and function names
No functional change.
|
1.446 | 26-May-2022 |
rillig | lint: reduce scope of local variables in build_plus_minus
No functional change.
|
1.445 | 26-May-2022 |
rillig | lint: re-order conditions for lossy conversions
Now that can_represent does more work, put it at the end of the conditions.
No functional change.
|
1.444 | 26-May-2022 |
rillig | lint: do not warn about loss in accuracy if the actual value fits
The expression 'any & 0xff' can always be assigned to 'uint8_t' without loss of any value bits. In the same way, '(any & 0xff) << 8' can always be assigned to 'uint16_t'.
Previously, lint warned about these cases. Fix these wrong warnings by tracking the possible values of integer expressions across a single expression.
Fixes PR 36668, so that <sys/endian.h> does not need to be cluttered with useless casts anymore.
|
1.443 | 26-May-2022 |
rillig | lint: remove long list of node types in switch statement
No functional change.
|
1.442 | 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.441 | 18-May-2022 |
rillig | lint: do not warn about '==' on the right-hand side of ','
|
1.440 | 18-May-2022 |
rillig | lint: reduce negations in typeok_point, document check_expr_misc
No functional change.
|
1.439 | 30-Apr-2022 |
rillig | lint: inline macro 'sflag'
Mark all places where lint's C90 mode is stricter than its C99 mode.
Most of the situations in which lint produces only warnings instead of errors covered by the "Constraints" sections in the relevant standards. This doesn't prevent a specific compiler from accepting it though.
No functional change.
|
1.438 | 30-Apr-2022 |
rillig | lint: inline macro 'tflag'
The definition of the macro tested both allow_trad and allow_c90, but there is only a single mode in which allow_c90 is false, therefore it suffices to test only that.
While double-checking each occurrence of tflag individually, I learned why lint performs lookups of struct members only by name, independently of the struct in which they are declared. See typeok_arrow for details.
No functional change.
|
1.437 | 30-Apr-2022 |
rillig | lint: inline macro Sflag in cases of expected behavior
In the grammar rules 'enums_with_opt_comma' and 'block_item_list', checking for allow_c99 was redundant since c99ism does not warn in C99 mode.
In the grammar rule 'designator', align the two actions structurally.
No functional change.
|
1.436 | 19-Apr-2022 |
rillig | lint: fix integer overflow on seeing -(uint64_t)INT64_MIN
Seen in external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c, which is protected by a NOLINT in ../Makefile.inc.
|
1.435 | 19-Apr-2022 |
rillig | lint: only warn about unsigned constants in C90 migration mode
For C99 code, the difference between traditional C and C90 is not relevant.
Seen in sqlite3.c line 30448.
|
1.434 | 19-Apr-2022 |
rillig | lint: do not warn about converting (1234567L & 0xFF) to unsigned char
Due to the '& 0xFF', there is no possible loss of accuracy.
|
1.433 | 16-Apr-2022 |
rillig | lint: merge mod_t.m_test_context into m_requires_bool
These two flags mean exactly the same.
No functional change.
|
1.432 | 16-Apr-2022 |
rillig | lint: rename members of tnode_t to more closely match reality
The flags do not describe the left operand of the node but both, as for most operators, either none or both operands are in test context or in value context.
The one exception is the operator '?' from the '?:' conditional, for which the left operand is in test context and the right operand is in value context.
No binary change.
|
1.431 | 16-Apr-2022 |
rillig | lint: investigate why lint only warns about some constant conditions
Noticed in lex.c, in the macro kwdef, where lint complains about the condition containing '||' but not about the conditions containing only '>' or '=='.
|
1.430 | 16-Apr-2022 |
rillig | lint: prepare keyword table for C11
The C11 keywords had been listed as being C99 keywords. Instead of initializing the individual fields separately, merge them by specifying the year of the standard in which they appeared.
No binary change, except for line numbers in assertions.
|
1.429 | 16-Apr-2022 |
rillig | lint: migrate gflag to allow_gcc
No functional change.
|
1.428 | 16-Apr-2022 |
rillig | lint: clean up conditions for migration check between trad and C90
No functional change, as each of the conditions was effectively '!tflag && !sflag && !Sflag' (even if distributed over several statements).
|
1.427 | 15-Apr-2022 |
rillig | lint: in C99 mode, do not warn about non-prototype conversions
Message 259 is "argument #%d is converted from '%s' to '%s' due to prototype", and it is intended to warn about compatibility between traditional C where functions had no prototypes and standard C where functions have prototypes.
Running lint in C99 mode is further away from traditional C than running lint in C90 mode, so that warning doesn't make sense for C99. There are still some inconsistencies in the 5 language version modes that lint offers:
-t for traditional C (no option) for migrating traditional C to C90 -s for C90 code -S for C99 code -Ac11 for C11 code
By disabling warning 259 in C99 mode, a typical NetBSD build produces 14.500 fewer warnings than before, of about 100.000 total.
Message 259 overlaps with message 298 "conversion from '%s' to '%s' may lose accuracy, arg #%d", and in some cases of potentially lossy conversions, lint now produces none of these messages. In some other cases, these warnings were reported redundantly. The cases where message 298 makes sense will be added back later, as needed.
|
1.426 | 15-Apr-2022 |
rillig | lint: merge conditions in check_integer_conversion
No functional change.
|
1.425 | 15-Apr-2022 |
rillig | lint: reduce indentation in check_integer_conversion
No functional change.
|
1.424 | 09-Apr-2022 |
rillig | lint: distinguish between storage class and declaration kind
These types overlap but are not the same.
No functional change.
|
1.423 | 09-Apr-2022 |
rillig | lint: extract is_member into separate function
No functional change.
|
1.422 | 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.421 | 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.420 | 09-Apr-2022 |
rillig | lint: inline member access macros for sym_t
Having the 'u.' explicitly in the code serves as a reminder that these members are only defined under certain conditions.
No functional change.
|
1.419 | 09-Apr-2022 |
rillig | lint: rename length to length_in_bits
No functional change.
|
1.418 | 03-Apr-2022 |
rillig | lint: fix crash after syntax error in GCC statement expression
Since cgram.y 1.226 from 2021-05-03.
|
1.417 | 02-Apr-2022 |
rillig | lint: clean up style
Remove outdated ARGSUSED (the one in tree.c had been wrong since 1995), remove unused argument.
No functional change.
|
1.416 | 02-Apr-2022 |
rillig | lint: rename dinfo_t.d_next to d_enclosing
The name d_next gave the wrong impression that the declaration infos would be independent of each other, but they are nested.
No functional change.
|
1.415 | 02-Apr-2022 |
rillig | lint: add debug logging for the declaration stack
To track down the wrong edge cases in decl_direct_abstract.c.
|
1.414 | 01-Apr-2022 |
rillig | lint: add type details to message about 'sizeof(function)'
The code in add_function is severely broken, it mixes up the return type of the function with the argument types. For now, at least show the guessed type in the diagnostic, to allow human readers quickly spot the bug.
Extend the test cases in decl_direct_abstract.c to show that the behavior differs unreasonably if the first parameter of the function is equal to its return type.
|
1.413 | 01-Apr-2022 |
rillig | lint: improve determination of abstract typename
Still not perfect, but at least a step in the right direction. See decl_direct_abstract.c for the missing edge cases.
See PR#22119.
|
1.412 | 01-Apr-2022 |
rillig | lint: replace crash with assertion failure
Triggered by 'sizeof(int())'.
GCC evaluates this expression to 1, without any warning.
Clang warns about an "invalid application of 'sizeof' to a function type".
|
1.411 | 13-Mar-2022 |
rillig | lint: add braces around multi-line loop body
No functional change.
|
1.410 | 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.409 | 27-Feb-2022 |
rillig | lint: C99 has been released, so refer to it by its proper name
|
1.408 | 27-Feb-2022 |
rillig | lint: unabbreviate two more members of sym_t
No functional change.
|
1.407 | 27-Feb-2022 |
rillig | lint: unabbreviate some fields in sym_t
No functional change.
|
1.406 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in function names
No functional change.
|
1.405 | 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.404 | 26-Feb-2022 |
rillig | lint: fix memory corruption in statement expressions (since 2021-12-17)
The commit that introduced the assertion failure looks innocent, it only adds a few predefined functions for GCC mode. Nevertheless, before that commit, lint consistently complained about 'error: void type illegal in expression [109]', which doesn't make sense either.
This fix also removes the creative use of the initialization stack to store the type of the statement expression. Having a separate stack for these statement expressions makes the code easier to understand.
|
1.403 | 26-Feb-2022 |
rillig | lint: extract code for handling statement expressions from the grammar
This prepares the fix of the memory corruption bug that is demonstrated in t_integration.sh, test case assertion_failures.
No functional change.
|
1.402 | 21-Dec-2021 |
rillig | lint: sync comment with recent change of parameter name
|
1.401 | 21-Dec-2021 |
rillig | lint: invert condition in build_name
No functional change.
|
1.400 | 17-Dec-2021 |
rillig | lint: in GCC mode, declare alloca and variants
The prototype declarations define the correct parameter types of these functions so that they are no longer subject to the default argument promotions (C11 6.5.2.2p6).
The GCC builtins are only recognized in GCC mode (-g).
|
1.399 | 16-Dec-2021 |
rillig | lint: narrow down parameter of build_name
Passing an arbitrary tokenizer symbol left too much freedom and uncertainty to the caller, and 0 was a magic number in this context.
No functional change.
|
1.398 | 15-Dec-2021 |
rillig | lint: unexport struct_or_union_member
Strangely, lint2 didn't notice this unnecessary export.
|
1.397 | 06-Dec-2021 |
rillig | lint: fix return type of GCC's __builtin_alloca
Needed for libgmp.
|
1.396 | 04-Dec-2021 |
rillig | lint: add quotes around placeholders in message 123
|
1.395 | 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.394 | 16-Nov-2021 |
rillig | tests/lint: explain the missing error message in strict bool mode
There are 2 separate bugs that lead to the missing error message.
The first bug is that when parsing a name, the information about whether that name comes from a system header is not properly recorded for the last token before switching from or to a system header.
The second bug is that for determining whether the type of a function call expression is relaxed, the types of the function call arguments are taken into account, even though the type only depends on the function itself. The same idea applies to the operators '<<' and '>>', as their result type only depends on the left operand, at least since C90.
|
1.393 | 01-Nov-2021 |
rillig | lint: enter full C90 compatibility mode
The C99 comment in tree.c:3468 has been there since 2017-03-06, without anyone complaining that their compiler would not handle it.
Strangely, running GCC 10.3.0 in '-std=c90' mode does not complain about declarations after statements, '-Wdeclaration-after-statement' is needed separately.
No functional change.
|
1.392 | 01-Nov-2021 |
rillig | lint: move all declarations above statements
All code that is used by src/tools is supposed to be compatible with C90.
No functional change.
|
1.391 | 01-Nov-2021 |
rillig | lint: do not warn about array size mismatch in array[(int)enum]
The cast to 'int' explicitly converts the type away from being an enum.
|
1.390 | 01-Nov-2021 |
christos | simplify.
|
1.389 | 01-Nov-2021 |
rillig | lint: in the check for array[enum], allow enum constant NUM
When an enum type defines a constant NUM_VALUES, this constant is usually not part of the enum values available to the application but rather a handy place for defining the number of other enum values. Don't warn about this case.
Seen in openpam_impl.h and several other places.
|
1.388 | 31-Oct-2021 |
rillig | lint: fix invalid memory access in array[enum] check
Lint checks whether in an expression 'array[enum]', the array size matches the value of the maximum enum constant.
The previous tests for this check were missing the case where an enum name was explicitly cast to an integer type and then used as an array index. In this situation, the resulting type of the array index is a plain 'int' without any information about its previous 'enum' history.
An entirely different case is when the 'enum' is implicitly converted to an integer type, as in the test color_name_too_many. There, for the final type of the array index, rn->tn_type->t_is_enum is true, which means that rn->tn_type->t_enum is properly filled.
The bug was a simple typo, I had forgotten a tn_left indirection, which is necessary to get the type before the implicit conversion.
Found and reported by Christos, triggered by src/lib/libperfuse/ops.c 1.89 line 1226 expression 'VTTOIF(vap->va_type)'.
|
1.387 | 31-Oct-2021 |
christos | Avoid null pointer exception hpcmips/mipsel src/lib/libperfuse/ops.c
|
1.386 | 30-Oct-2021 |
rillig | lint: warn if an enum name is used for mismatched array access
This helps to keep the enum definition and the straight-forward implementation of a to_string or name function in sync.
The test for message 241 had to be adjusted because of exactly this bug. That test defined a bit mask enum but accessed it like a value enum type.
|
1.385 | 09-Oct-2021 |
rillig | lint: add more details to warning about nonportable character comparison
Especially when macros are involved, this makes it easier to see that there is a real problem.
Seen in bin/sh/expand.c:273, where a plain char is compared to numbers larger than 127.
|
1.384 | 09-Oct-2021 |
rillig | lint: warn that bsearch effectively discards 'const'
Just like strchr, bsearch takes a const pointer and returns a non-const pointer into the same object.
|
1.383 | 26-Sep-2021 |
rillig | tests/lint: explain difference between i386 and sparc for 259
Seen in usr.bin/make/cond.c 1.278 from 2021-09-21, line 800, the call to is_token, where unsigned char gets converted to unsigned int or unsigned long, depending on the platform.
|
1.382 | 18-Sep-2021 |
jmcneill | use isfinite(3) instead of finite(3) for portability
Fixes tools build on macOS 11.6 arm64 hosts.
|
1.381 | 12-Sep-2021 |
rillig | lint: un-abbreviate rvused and rvdisc
No functional change.
|
1.380 | 05-Sep-2021 |
rillig | lint: reduce number of ifdef names
No functional change.
|
1.379 | 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.378 | 05-Sep-2021 |
rillig | lint: fix lint warnings
|
1.377 | 04-Sep-2021 |
rillig | lint: spell out abbreviations in comments
No functional change.
|
1.376 | 04-Sep-2021 |
rillig | lint: sort operators in typeok_op according to ops.def
Well, except for INIT, FARG, RETURN. These are listed at the very bottom of the operators table but still behave much like ASSIGN.
No functional change.
|
1.375 | 04-Sep-2021 |
rillig | lint: extract typeok_point and typeok_arrow from typeok_op
No functional change.
|
1.374 | 04-Sep-2021 |
rillig | lint: clean up switch statement in typeok_op
In the old times where typeok_op was inlined into typeok, it was necessary to write the complicated if-not-return-break. Not anymore.
No functional change.
|
1.373 | 04-Sep-2021 |
rillig | lint: make typeok_quest simpler
No functional change.
|
1.372 | 03-Sep-2021 |
rillig | lint: set the return type of __builtin_*_overflow to bool, not int
Needed for inetd.c in strict bool mode.
|
1.371 | 03-Sep-2021 |
rillig | lint: extract build_name_call from build_name
This reduces the indentation, providing enough space to write out the full diagnostic in the code. It also prepares for supporting GCC builtins like __builtin_add_overflow, which return _Bool instead of int.
No functional change.
|
1.370 | 02-Sep-2021 |
rillig | lint: split check_expr_misc into separate functions
No functional change.
|
1.369 | 02-Sep-2021 |
rillig | lint: split check_assign_types_compatible into separate functions
No functional change.
|
1.368 | 02-Sep-2021 |
rillig | lint: fix unintended warning for converting long long to signed char
|
1.367 | 02-Sep-2021 |
rillig | lint: move a condition into should_warn_about_prototype_conversion
No functional change.
|
1.366 | 02-Sep-2021 |
rillig | lint: clean up should_warn_about_prototype_conversion
|
1.365 | 01-Sep-2021 |
rillig | lint: remove array creation from expr_derive_type
It is only used for creating string types. The creation of other array types happens in add_array.
This is a preparation to make all stored types const.
No functional change.
|
1.364 | 31-Aug-2021 |
rillig | lint: extract condition for message 259 into separate function
No functional change.
|
1.363 | 29-Aug-2021 |
rillig | lint: in C99 mode, make implicit function declarations an error
In tree.c 1.294 from 2021-06-28, I had already tried this, but at that time, there were too many implicit function definitions in the NetBSD tree. Most of them were GCC builtins, which lint did not recognize. Therefore I had to revert to a warning in tree.c 1.302 from 2021-06-30.
In the meantime, lint has learnt to recognize compiler builtins, see is_compiler_builtin, so try again now. The build logs from x86_64, i386, sparc and sparc64 show no more implicit function declarations.
|
1.362 | 29-Aug-2021 |
rillig | lint: treat _mm_ as builtin function name prefix for all compilers
This prefix is not specific to GCC, it is also known by the Intel C Compiler and the Microsoft C compiler.
|
1.361 | 29-Aug-2021 |
rillig | lint: add __sync_ and _mm_ as prefixes for builtin functions
These two additions cover all cases that occur in the current NetBSD build on x86_64. This allows build_name to use the usual pattern 'if Sflag then error else if sflag then warning'. That function currently issues a warning in C99 as well, even though C99 prohibits implicit function declarations.
|
1.360 | 28-Aug-2021 |
rillig | lint: remove double inversion from is_out_of_char_range
No functional change.
|
1.359 | 28-Aug-2021 |
rillig | lint: clean up check_integer_comparison
No functional change.
|
1.358 | 28-Aug-2021 |
rillig | lint: do not emit GCC builtin functions
Lint1 no longer emits declarations of GCC builtin functions and calls to them.
Previously, lint generated 3421 useless warnings in a default NetBSD build, like this:
__atomic_load_n, arg 1 used inconsistently acl.c(216)[pointer to unsigned int] rbtdb.c(921)[pointer to unsigned short]
This was because lint just doesn't understand that these functions are type-generic, which is indeed unusual in C.
These useless warnings made the lint output more frightening than it should actually be. Together with the strange formatting of the diagnostics (space-space-tab after the main message, two spaces and two colons between the occurrences, symbols are listed in hashcode order), this creates the impression that lint is not intended to be a user-friendly tool.
For now, fix the excess warnings, leaving the other items for later.
|
1.357 | 28-Aug-2021 |
rillig | lint: merge duplicate code in convert_constant_floating
|
1.356 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types in convert_integer
There was no need to have two separate magic values (0 and -1) to mean the same.
No functional change.
|
1.355 | 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types
Lint does not need to support any types larger than 256 MB since they don't occur in practice. Practically, such large types have never been supported at all since the function type_size_in_bits used int for the internal calculations, resulting in overflows.
|
1.354 | 28-Aug-2021 |
rillig | lint: remove redundant type casts from convert_constant_floating
Since tree.c 1.70 from 2012-03-27, lint has been using properly typed constants for the min and max values, independent from the host platform.
No functional change.
|
1.353 | 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.352 | 25-Aug-2021 |
rillig | lint: rename local variable in plength
The assertion in build_plus_minus is safe since that function is only called if the types are compatible. Pointer and floating are not compatible.
No functional change.
|
1.351 | 23-Aug-2021 |
rillig | lint: expand macro in string concatenation
No functional change.
|
1.350 | 23-Aug-2021 |
rillig | lint: add quotes around placeholder in message 141
|
1.349 | 23-Aug-2021 |
rillig | lint: make overflow check for binary '+' simpler
No functional change.
|
1.348 | 23-Aug-2021 |
rillig | lint: remove unnecessary width parameter for msb
No functional change.
|
1.347 | 23-Aug-2021 |
rillig | lint: fix wrong warning about signed integer overflow in '-'
The newly added test cases in line 30 and 33 may or may not be worth a warning since the expressions deal with unsigned integers, where the behavior on overflow is well defined.
|
1.346 | 22-Aug-2021 |
rillig | lint: merge duplicate code for binary operator
No functional change.
|
1.345 | 22-Aug-2021 |
rillig | lint: fix folding of comparisons in constant expressions
|
1.344 | 21-Aug-2021 |
rillig | lint: extract check_prototype_conversion_integer
No functional change.
|
1.343 | 21-Aug-2021 |
rillig | lint: rename local variable '1' in fold_float
It looked too similar to the number 1.
|
1.342 | 21-Aug-2021 |
rillig | lint: fix spacing in tree.c
|
1.341 | 21-Aug-2021 |
rillig | lint: do not warn about '(void)arg' and similar expressions
In the current NetBSD build, 5260 of the 46264 total lint warnings are about expressions that have a null effect. Most of these occurrences follow well-established patterns, which makes the warnings bogus. Remove these warnings.
|
1.340 | 19-Aug-2021 |
rillig | lint: change return type of 'msb' from int to bool
No functional change.
|
1.339 | 19-Aug-2021 |
rillig | lint: clean up formatting of 'fold'
|
1.338 | 19-Aug-2021 |
rillig | lint: fix wrong integer overflow warning for unsigned types
|
1.337 | 16-Aug-2021 |
rillig | lint: remove dead code from check_bad_enum_operation
There is a single caller of that function, and it checks the exact same condition beforehand.
|
1.336 | 15-Aug-2021 |
rillig | lint: extend check for unconst functions
The functions memchr, strpbrk, strrchr and strstr effectively remove the const qualifier of their first argument, just like strchr.
|
1.335 | 15-Aug-2021 |
rillig | lint: fix wrong warning about 'unsigned char >> constant'
|
1.334 | 14-Aug-2021 |
rillig | lint: use standard quoting style for messages 124 and 184
|
1.333 | 14-Aug-2021 |
rillig | lint: allow initialization of struct with constant member
The operator INIT, just like RETURN and FARG, initializes an object with an expression. The target object of such an initialization may be a struct with constant members.
The operator ASSIGN, on the other hand, is entirely different. It overwrites the existing value of the object, and this is not allowed for structs that have a constant member. Therefore it was wrong to use the operator ASSIGN for initialization.
|
1.332 | 10-Aug-2021 |
rillig | lint: fix 3 of the 4 wrong messages about lvalue in initial assignment
|
1.331 | 09-Aug-2021 |
rillig | lint: warn about 'char * = strchr(const char *, int)'
Found in findcc.c, there are about 25 other instances of this incongruency in the whole source tree.
For more examples of functions from the C Standard Library that implicitly remove the 'const' qualifier from an argument, see the C++ include file 'cstring'.
|
1.330 | 03-Aug-2021 |
rillig | lint: merge almost duplicate code from 'sametype' into 'eqtype'
In 'sametype', the branch for comparing array types was unreachable since it requires both tspecs to be the same, but t2 underwent the array-to-pointer conversion.
Previously, lint warned about enum type mismatches, even without -e for strict enum mode. Instead, it got the case for 'char *' wrong, which is now fixed. Now lint behaves like GCC 10.3.0 in this regard. The warning about enum mismatch is useful though, so it may be re-added in a future commit.
|
1.329 | 03-Aug-2021 |
rillig | lint: union casts are only available as a GCC extension, not in C99
|
1.328 | 03-Aug-2021 |
rillig | lint: casting to a struct is not allowed in C99, only with GCC
|
1.327 | 03-Aug-2021 |
rillig | lint: clean up and move 'sametype'
This function is only used by lint1. That's good since the lint2 code was completely broken, as it would regard any two struct types as being the same.
Remove the large switch statement since it is unlikely that there will be new type derivations in C anytime soon.
No functional change.
|
1.326 | 01-Aug-2021 |
rillig | lint: merge duplicate debugging code
The functions 'debug_node' and 'display_expression' were similar enough to be merged.
Migrate debug_node to use the existing debug logging functions.
Remove the now unused option 'd' from the options string.
|
1.325 | 01-Aug-2021 |
rillig | lint: remove option -d, clean up debug logging
The command line option -d was not used by /usr/bin/lint, and it only triggered a handful of debug messages. Move this debug logging over to the compile-time -DDEBUG setting.
Move display_expression further up to avoid the forward declaration.
|
1.324 | 01-Aug-2021 |
rillig | lint: remove unreachable code from usual arithmetic conversions
|
1.323 | 01-Aug-2021 |
rillig | lint: fix usual arithmetic conversions for 128-bit integer types
|
1.322 | 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.321 | 31-Jul-2021 |
rillig | lint: in has_constant_member, don't reuse variables
No functional change.
|
1.320 | 31-Jul-2021 |
rillig | lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.
No functional change.
|
1.319 | 25-Jul-2021 |
rillig | lint: add type information to message about invalid cast
This probably doesn't matter in practice since the compiler is supposed to catch this kind of error. Adding the type information mainly ensures that parsing abstract type names works as specified.
|
1.318 | 20-Jul-2021 |
rillig | lint: use consistent naming scheme for functions that build nodes
No functional change.
|
1.317 | 20-Jul-2021 |
rillig | lint: split 'build' into build_binary and build_unary
No functional change.
|
1.316 | 15-Jul-2021 |
rillig | lint: allow pointer casts from 'char *' and 'unsigned char *'
For the sake of traditional code that did not yet migrate to using 'void *' for arbitrary pointers.
In the standard NetBSD build, this reduces the number of lint warnings by around 7000, of 57000 total.
|
1.315 | 15-Jul-2021 |
rillig | lint: replace call to ttos with type_name
Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as ttos and more expressive. It can also be called multiple times without invalidating the returned strings.
Used only in debug mode.
|
1.314 | 14-Jul-2021 |
rillig | lint: extract build_member_access from the grammar
No functional change.
|
1.313 | 06-Jul-2021 |
rillig | lint: rename type generic_association_types to generic_association
The word 'types' was misleading and unnecessary.
No functional change.
|
1.312 | 04-Jul-2021 |
rillig | lint: replace wrong assumption with citation from C99
No functional change.
|
1.311 | 04-Jul-2021 |
rillig | lint: document where to fix missing const in lvalue-to-rvalue
No functional change.
|
1.310 | 04-Jul-2021 |
rillig | lint: align messages for invalid left operand of '.' or '->'
|
1.309 | 04-Jul-2021 |
rillig | lint: clean up new_tnode
No functional change.
|
1.308 | 04-Jul-2021 |
rillig | lint: remove remaining support for lvalue casts
These had been GCC extensions until GCC 3.4, they were removed in GCC 4.0.
|
1.307 | 04-Jul-2021 |
rillig | lint: remove support for obsolete GCC-style lvalue casts
Since GCC 4.0, a cast results in an rvalue.
|
1.306 | 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.305 | 04-Jul-2021 |
rillig | lint: remove outdated assertion
Since err.c 1.12 from 2000-07-06, lint allows to suppress individual error messages. Suppressed error messages do not increment nerr. Keeping nerr at 0 had triggered the assertion.
|
1.304 | 03-Jul-2021 |
rillig | lint: fix assertion failure in display_expression for bool constants
|
1.303 | 30-Jun-2021 |
rillig | lint: do not warn about use of implicitly declared GCC builtins
|
1.302 | 30-Jun-2021 |
rillig | lint: in C99 mode, only warn about implicit function declarations
Since tree.c 1.294 from 2021-06-28 (two days ago), lint errored out on an implicit function declaration. In principle it is correct to do so since C99 requires it, but in practice there are a several functions that are not declared in the translation unit itself since they are provided by the compiler. Typical examples for GCC and Clang are the various functions named '__builtin_*' and '__atomic_*'.
For now, only warn about these but don't error out.
|
1.301 | 30-Jun-2021 |
rillig | lint: mention the name of an implicitly declared function
In the regular NetBSD builds, this happened in swab.c:65. That line contains __predict_false, which may or may not be a macro. In other cases, there may be more than one function call in a single line.
|
1.300 | 30-Jun-2021 |
rillig | lint: fix type name in message 101 for wrong member name
|
1.299 | 30-Jun-2021 |
rillig | lint: improve comment about INT keeping t_is_enum
|
1.298 | 29-Jun-2021 |
rillig | lint: rename xsign to convert_integer
The term sign-extend was too specific, the function actually does a broader conversion.
No functional change.
|
1.297 | 29-Jun-2021 |
rillig | lint: do not sign-extend pointers
Sign extension only makes sense for integer types.
No idea why the code had tried to sign-extend pointers for the past 26 years.
|
1.296 | 29-Jun-2021 |
rillig | lint: document where to fix the wrong warning for '\xff'
|
1.295 | 29-Jun-2021 |
rillig | lint: fix typos in comment
|
1.294 | 28-Jun-2021 |
rillig | lint: in C99 mode, complain about implicitly declared functions
C99, foreword, p5, item 22 lists among the major changes from C90: "remove implicit function declaration".
|
1.293 | 28-Jun-2021 |
rillig | lint: add type information to message 155 (type mismatch)
|
1.292 | 27-Jun-2021 |
rillig | lint: fix type comparison in _Generic selection expressions
In the newly added test comma_expression, there were two distinct type objects for the tspec DOUBLE.
|
1.291 | 27-Jun-2021 |
rillig | lint: fix result type of _Generic expressions
|
1.290 | 20-Jun-2021 |
rillig | lint: remove unnecessary call to print_tnode
For the possible operators that occur in message 324, print_tnode is equivalent to op_name, and the latter is simpler.
When the function print_node was added to the code base, it had another use in init.c, for understanding how initialization works in lint. That code has since been rewritten completely, therefore print_tnode is no longer needed. For debugging, display_expression is the better choice since it has multi-line output and does not suffer from a fixed-length buffer.
No functional change.
|
1.289 | 20-Jun-2021 |
rillig | lint: rename val_t.v_unsigned to avoid confusion
The name v_unsigned suggested that the value would be interpreted as unsigned, which was wrong. Whether a value is signed or unsigned is decided by v_tspec instead.
Revert the previous commit for boolen constants since their value is already interpreted as unsigned, and there is no need for any warning about differences between traditional C and ANSI C since the _Bool type has only been added ten years later in C99.
The code for printing a tree node was also confused by this struct member, even with its old name v_ansiu. That code will be fixed in a follow-up commit.
No functional change.
|
1.288 | 20-Jun-2021 |
rillig | lint: rename val_t.v_ansiu to v_unsigned
When lint was written in 1995, traditional C was still nearby since C90 had been around for only 5 years. 26 years later, almost all code adheres to C90 or even C99 or C11, therefore "C90 or later" can safely be assumed as the default.
No functional change.
|
1.287 | 15-Jun-2021 |
rillig | lint: replace array access with function calls
First and foremost, the test d_c99_complex_split accessed the array qlmasks out-of-bounds, with an index of 128 for the type 'double _Complex'. This invoked undefined behavior since the maximum allowed index was 64.
Replacing the raw array accesses with function calls allows for bounds checks to catch these errors early.
Determining the value bits for a 'double _Complex' does not make sense at all since it is not an integer type. This means that lint didn't handle these types correctly for several years. Support for int128_t has been added in inittyp.c 1.12 from 2018-09-07, support for _Complex has been added in inittyp.c 1.9 from 2008-04-26.
Determining the value bits for an int128_t would make sense, but the unit tests don't contain examples for this type since at the moment all unit tests must produce the same results on 32-bit and 64-bit platforms, and the 32-bit platforms don't support int128_t.
|
1.286 | 15-Jun-2021 |
rillig | lint: extract convert_constant_to_floating
|
1.285 | 15-Jun-2021 |
rillig | lint: split convert_constant_check_range
No functional change.
|
1.284 | 15-Jun-2021 |
rillig | lint: merge duplicate code
|
1.283 | 15-Jun-2021 |
rillig | lint: extract convert_constant_check_range
No functional change.
|
1.282 | 15-Jun-2021 |
rillig | lint: extract convert_constant_floating
No functional change.
|
1.281 | 04-May-2021 |
rillig | lint: fix assertion failure when promoting a bit-field larger than int
|
1.280 | 18-Apr-2021 |
rillig | lint: rename parameter to expr
That parameter used to be used for a single purpose, later it got used for checking the reachability as well, which made the name misleading.
|
1.279 | 18-Apr-2021 |
rillig | lint: remove redundant CONSTCOND
In do-while-0 loops, these are no longer needed since tree.c 1.202 from 2021-01-31.
|
1.278 | 18-Apr-2021 |
rillig | lint: extend documentation about handling initializations
|
1.277 | 17-Apr-2021 |
rillig | lint: do not warn about alignment when casting from incomplete struct
This removes a bunch of technically correct but practically useless warnings from the regular NetBSD build.
|
1.276 | 10-Apr-2021 |
rillig | lint: prepare renaming of 'struct type'
It's confusing to have the same struct tag in both lint1 and lint2, with mostly the same members, but also some differences. Before actually changing this, I reviewed all occurrences of the word 'type' in the code.
No functional change.
|
1.275 | 09-Apr-2021 |
rillig | lint: fix wrong warning about uninitialized _Complex variable
Seen in divxc3.c.
|
1.274 | 09-Apr-2021 |
rillig | lint: do not warn about pointer conversion to or from incomplete type
This cuts down the warnings in a NetBSD release build by about 38,000.
|
1.273 | 09-Apr-2021 |
rillig | lint: clean up the check for pointer conversions
No functional change.
|
1.272 | 08-Apr-2021 |
rillig | lint: don't warn about cast between pointers to compatible structs
|
1.271 | 06-Apr-2021 |
rillig | lint: for shift in C99 mode, do not warn about difference to pre-C90
C99 is too far away from traditional C to make this warning useful. There are 3 different situations in which this warning is generated:
For '1 << (unsigned char)1', the result type is 'unsigned int' in traditional C. The result type is unsigned because at least 1 of the operators is unsigned, and it is 'unsigned int' because the usual arithmetic promotions are applied.
For '1 >> (long)1', as well as for '1 << (long)1', the result type is 'long' in traditional C since the usual arithmetic promotions are applied.
Omitting this warning in C99 mode reduces the amount of lint warnings in a typical NetBSD release build by approximately 6800 of 107000 total.
|
1.270 | 06-Apr-2021 |
rillig | lint: reduce indentation of typeok_shift
No functional change.
|
1.269 | 06-Apr-2021 |
rillig | lint: add details to warning about too large shift amount
The previous message 'shift greater than size of object' was too short to give reasonable hints, especially when the expressions involve typedefs or macros.
|
1.268 | 06-Apr-2021 |
rillig | lint: fix wrong warning about losing accuracy when converting to _Bool
|
1.267 | 06-Apr-2021 |
rillig | lint: move check for strict bool mode into separate file
No functional change.
|
1.266 | 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.265 | 02-Apr-2021 |
rillig | lint: reword message about constant argument to '!'
In the other messages, operators are typically written in their literal form as well. Using single quotes disambiguates them from normal punctuation.
|
1.264 | 02-Apr-2021 |
rillig | lint: fix typo from previous commit in merge_qualifiers
|
1.263 | 02-Apr-2021 |
rillig | lint: clean up merge_qualifiers
No functional change.
|
1.262 | 02-Apr-2021 |
rillig | lint: rename local variable in build_colon
The name 'rtp' was confusing since it did not correspond to 'rn'. The 'r' meant 'result', not 'right-hand side'.
No functional change.
|
1.261 | 02-Apr-2021 |
rillig | lint: replace a new modtab with op_name
This reduces the types of variables that are passed around.
No functional change.
|
1.260 | 02-Apr-2021 |
rillig | lint: rename getopname to op_name
There are several functions called 'get' that allocate memory. Remove this possible confusion.
No functional change.
|
1.259 | 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.258 | 02-Apr-2021 |
rillig | lint: rename functions for duplicating types
No functional change.
|
1.257 | 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.256 | 02-Apr-2021 |
rillig | lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the scope of the current expression. This was misleading before since the other related functions all have a 't' (probably for 'temporary') in their names.
Also encode in the function name that the returned memory is zeroed out as that could not be inferred from the old name.
No functional change.
|
1.255 | 01-Apr-2021 |
rillig | lint: remove wrong assumption from comment
The size in bits of a struct or union is not measured at all at this point since portable_size_in_bits only takes the broad type classification (tspec_t), not the precise type information (type_t).
No functional change.
|
1.254 | 30-Mar-2021 |
rillig | lint: add type information for message about unknown member name
|
1.253 | 28-Mar-2021 |
rillig | lint: sprinkle const on function declarations
No functional change.
|
1.252 | 27-Mar-2021 |
rillig | lint: remove space between 'sizeof ('
No functional change.
|
1.251 | 26-Mar-2021 |
rillig | lint: add quotes around placeholder in message about undefined variable
Before: error: expected undefined [99] After: error: 'expected' undefined [99]
Seen in external/mpl/bind, which for Clang defines in stdatomic.h: > #define atomic_exchange_explicit(obj, desired, order) \ > __c11_atomic_exchange_explicit(obj, expected, order) Note the mismatch between 'desired' and 'expected'.
|
1.250 | 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.249 | 26-Mar-2021 |
rillig | lint: allow pointer cast to 'char *' and 'unsigned char *'
This reduces the number of warnings in the regular NetBSD build by 5560.
|
1.248 | 26-Mar-2021 |
rillig | lint: rename variables in check_pointer_conversion
No functional change.
|
1.247 | 26-Mar-2021 |
rillig | lint: extract decision for warning about pointer cast
This makes the code several lines longer but way more readable. In the previous dense expression it was hard to see what was going on at all and that there are two completely separate situations in which this warning applies.
No functional change.
|
1.246 | 22-Mar-2021 |
rillig | lint: use precise type information in message about type mismatch
While here, reword the message, avoiding operators and parentheses.
Since 2021-01-02, providing the precise type name is as easy as the broad type classification (just replace tspec_name with type_name), and it's definitely more useful to the human readers.
|
1.245 | 21-Mar-2021 |
rillig | lint: invert 'rchflag', call it warn_about_unreachable instead
No functional change.
|
1.244 | 21-Mar-2021 |
rillig | lint: reduce number of places where 'reached' is set
When determining the reachability of a statement, the idea was that whenever 'reached' was set to false, 'rchflg' (the abbreviation for "do not warn about unreachable statements") would be reset as well.
In some (trivial) cases, this was done, but many more interesting cases simply forgot to set this second variable. To prevent this in the future, encapsulate this in a simple helper function.
Now even if a statement is reachable, 'rchflg' gets reset. This does not hurt since as long as the current statement is reachable, the value of 'rchflg' does not matter.
No functional change. There would be quite a big functional change though if check_statement_reachable were to reset 'rchflg' instead of 'reached', as the comment already suggests. In that case, with the current code, many legitimate warnings about unreachable statements would be skipped, especially those involving 'if' statements, since these didn't reset 'rchflg' properly before.
|
1.243 | 21-Mar-2021 |
rillig | lint: fix wrong 'statement not reached' in do-while loop
|
1.242 | 20-Mar-2021 |
rillig | lint: clean up new_name_node
No functional change.
|
1.241 | 20-Mar-2021 |
rillig | lint: move getopname over to tree.c
Except for the one use in print_tnode, the name of the operator is only used in tree.c.
No functional change.
|
1.240 | 20-Mar-2021 |
rillig | lint: remove redundant operator properties table
It's enough to have modtab, which describes the properties of the various operators. There is no need to have a second table imods that holds the same content. Rather make modtab constant as well.
The only possible functional change is that the names of the internal operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in diagnostics, where previously lint invoked undefined behavior by passing a null pointer for a '%s' conversion specifier.
|
1.239 | 20-Mar-2021 |
rillig | lint: inline access to type properties in check_bad_enum_operation
No functional change.
|
1.238 | 20-Mar-2021 |
rillig | lint: in strict bool mode, check initialization as well
C99 6.7.8p11 says for initialization that "the same type constraints and conversions as for simple assignments apply", so actually apply them. (I had just forgotten this "operator" when I first implemented strict bool mode.)
|
1.237 | 19-Mar-2021 |
rillig | lint: rename in_bit to in_bits
No functional change.
|
1.236 | 19-Mar-2021 |
rillig | lint: rename tsize to type_size_in_bits
The shorter name size_in_bits was already taken by the function-like macro with argument type tspec_t.
No functional change.
|
1.235 | 18-Mar-2021 |
rillig | lint: make the debug log for nodes more readable
The operator NAME has the name 'name', therefore no special case is needed.
Having the words 'with type' in the message makes the message easier to find from the debug log. Given that the operator name is used unquoted, the log message 'name: int value=111' was nearly impossible to find in the code.
Replace the '()' with an actual word, to avoid any confusion about whether the type name might be a function type without prototype.
Reduce the amount of '=' signs, instead use commas to separate the properties of the node.
No functional change outside debug mode.
|
1.234 | 18-Mar-2021 |
rillig | lint: reword message about type mismatch in initialization
Using parentheses for quotes is unusual, furthermore the previous message didn't follow proper grammar rules, sacrificing clarity for brevity.
|
1.233 | 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.232 | 28-Feb-2021 |
rillig | lint: fix null pointer dereference on parse error
Fixes PR bin/22119.
|
1.231 | 28-Feb-2021 |
rillig | lint: document where in C99 the behavior of cconv is specified
|
1.230 | 28-Feb-2021 |
rillig | lint: replace wrong comment with assertion
The broad type of a value is indeed stored in the value itself, in the member v_tspec. For nodes that refer to this value, it is redundantly stored, it always equals tn->tn_type->t_tspec.
After initialization, neither tn->tn_type nor val->v_tspec are modified. This is not ensured by the compiler but has to be analyzed manually.
No functional change.
|
1.229 | 28-Feb-2021 |
rillig | lint: rename is_nonzero to constant_is_nonzero
The new function name emphasizes that the given node must have the operator CON.
No functional change.
|
1.228 | 28-Feb-2021 |
rillig | lint: rename members and access macros of the basic types
Having the measurement unit in the variable name prevents accidental confusion between bits and bytes, especially since usually the word 'size' means the size in bytes, while 'width' means the size in bits, at least for integer types.
No functional change.
|
1.227 | 28-Feb-2021 |
rillig | lint: do not warn about constant expressions involving sizeof
These expressions are indeed constant for a specific platform, but on another platform their value may change. This makes them unsuspicious and legitimate for portable code.
Seen in rump_syscalls.c, as 'sizeof(int) > sizeof(register_t)'.
|
1.226 | 28-Feb-2021 |
rillig | lint: rename parameter in function 'expr'
For symmetry with the function is_constcond_false.
No functional change.
|
1.225 | 28-Feb-2021 |
rillig | lint: add type information for 'incompatible struct pointers'
|
1.224 | 28-Feb-2021 |
rillig | lint: add type information to enum type mismatch
|
1.223 | 28-Feb-2021 |
rillig | lint: make messages for incompatible pointers more specific
Message 153 didn't state obviously which of the pointer types was the one before conversion (or cast) and which was the resulting type.
Message 229 didn't have any type information at all.
|
1.222 | 28-Feb-2021 |
rillig | lint: add type information to 'possible pointer alignment problem [135]'
This warning occurs more than 7400 times in a regular NetBSD build, and without giving any type information, leaves the reader clueless about what the underlying issue might be. Add type information since that is a no-brainer to implement.
|
1.221 | 28-Feb-2021 |
rillig | lint: skip alignment computation if possible
Testing a global variable is simpler than calling a 20-line function.
No functional change.
|
1.220 | 28-Feb-2021 |
rillig | lint: rename getbound to alignment_in_bits
No functional change.
|
1.219 | 27-Feb-2021 |
rillig | lint: rename confusing local variable
The variable name rtp is reserved for the type of the right-hand operand.
No functional change.
|
1.218 | 22-Feb-2021 |
rillig | lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
|
1.217 | 22-Feb-2021 |
rillig | lint: improve debug message and comment
|
1.216 | 21-Feb-2021 |
rillig | lint: extract check_non_constant_initializer from init_using_expr
No functional change.
|
1.215 | 21-Feb-2021 |
rillig | lint: always initialize return values of constant_addr
Before, the caller was responsible for initializing the return values from the function. This was an unexpected burden.
Ensure that in each branch that returns true, both return values are properly set.
Strangely, the only caller of that function, init_using_expr, uses neither of the return values. It just tests whether the expression is constant or not.
No functional change.
|
1.214 | 21-Feb-2021 |
rillig | lint: add type information to message about enum mismatch
|
1.213 | 21-Feb-2021 |
rillig | lint: indent node details in debug mode
|
1.212 | 20-Feb-2021 |
rillig | lint: fix lint warnings
No functional change.
|
1.211 | 20-Feb-2021 |
rillig | lint: do not warn about 'do { ... } while (false)' in strict bool mode
|
1.210 | 20-Feb-2021 |
rillig | lint: extend debugging for initializing objects
No functional change outside debug mode.
|
1.209 | 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.208 | 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.207 | 15-Feb-2021 |
rillig | lint: remove redundant comment
That comment was useful when there was no function is_null_pointer. Back then, the code for testing a null pointer was written in-line, which made it really hard to see what's going on. This is no longer the case.
|
1.206 | 15-Feb-2021 |
rillig | lint: extract typeok_colon_pointer from typeok_colon
The subtype information is now only accessed if both operands are actually pointers.
No functional change.
|
1.205 | 04-Feb-2021 |
rillig | lint: add back "due to prototype" to message 259
That message is only supposed to warn about compatibility to traditional C, in case the function should ever be compiled without its prototype being in effect. All other type checks are supposed to be in another function, as documented, but that type check misses to report a few error-prone type combinations (long to char, long to int).
30 years after the introduction of prototypes with C90, almost all existing code uses prototypes. The warning has thus lost most of its usefulness and can rather be confusing since a conversion from 'char' to 'long' is not problematic with prototypes in action, and the probability of the code being backported to a pre-C90 compiler is diminishingly small.
The words "due to prototype" now serve as a hint again. The proper fix could be to suppress this warning in C99 mode since that's far enough from traditional C.
|
1.204 | 31-Jan-2021 |
rillig | lint: reword message 259 about function argument conversion
The words "due to prototype" are an anachronism from the 1990s. Nowadays every function is defined using a prototype, which makes these words redundant.
|
1.203 | 31-Jan-2021 |
rillig | lint: make warning about function argument conversion more detailed
For every conversion it is useful to know both the source and the target type since these are not always obvious from the code.
The only surprise is the warning in d_gcc_extension. The conversion there is from 'double' to 'long double', which is a lossless conversion. This may be a bug in lint.
|
1.202 | 31-Jan-2021 |
rillig | lint: don't warn about constant condition in 'do { } while (0)'
|
1.201 | 31-Jan-2021 |
rillig | lint: fix strange message about nested '==' operators
If one of the nested subexpressions is parenthesized, the author probably knew how these expressions are evaluated. Therefore don't warn in such a situation.
Maybe the original author once made a typo and tried to initialize variables but instead compared them, like this:
int a, b, c;
a == b == c;
This would explain the text of the message, which still sounds strange. At least it doesn't show up as often anymore.
|
1.200 | 31-Jan-2021 |
rillig | lint: mention the operator in messages about bit shifts
|
1.199 | 30-Jan-2021 |
rillig | lint: flatten has_side_effect
Since GCC performs tail call optimization, the generated code is practically the same.
Replace redundant comments with open questions.
No functional change.
|
1.198 | 30-Jan-2021 |
rillig | lint: fix wrong 'expression has null effect'
|
1.197 | 30-Jan-2021 |
rillig | lint: extract has_side_effect from check_null_effect
No functional change.
|
1.196 | 30-Jan-2021 |
rillig | lint: add type information to message 275
Before: cast discards 'const' from pointer target type After: cast discards 'const' from type 'pointer to const char'
Seen in sqlite3.c.
|
1.195 | 30-Jan-2021 |
rillig | lint: add type information to warning about troublesome casts
The previous warning text did not mention the actual types that are involved in the type conversion. These types can be hard to see from the source code as soon as macros are involved, and even in plain code, one would have to follow the declarations, which is an unnecessary burden. Lint already has all information about the involved types, so there is no reason for omitting this crucial information.
Seen in external/mit/lua/dist/src/lvm.c and several other files. Including the type information in the message immediately makes the message scarier.
Before: pointer casts may be troublesome After: pointer cast from 'pointer to struct TString' to 'pointer to union GCUnion' may be troublesome
|
1.194 | 30-Jan-2021 |
rillig | lint: rename incompl to is_incomplete
No functional change.
|
1.193 | 30-Jan-2021 |
rillig | lint: fix type conversion for very large data types
Data types that are 4 GB or larger are an edge case. Nevertheless, compute their size correctly.
|
1.192 | 30-Jan-2021 |
rillig | lint: remove redundant parentheses
No functional change.
|
1.191 | 24-Jan-2021 |
rillig | lint: reduce preprocessor magic for platform target types
|
1.190 | 24-Jan-2021 |
rillig | lint: extract duplicate code into is_null_pointer
No functional change.
|
1.189 | 24-Jan-2021 |
rillig | lint: fix wrong warning about null pointer comparison
|
1.188 | 24-Jan-2021 |
rillig | lint: fix local variable names in check_pointer_comparison
|
1.187 | 24-Jan-2021 |
rillig | lint: clean up typeok_eq and check_pointer_comparison
Since typeok_eq does not issue any diagnostics, prefix it with "is_".
By convention, the variable rt aliases rn->tn_type->t_tspec. Make it obvious that in check_pointer_comparison, rt corresponds to the subtype of the pointer.
|
1.186 | 24-Jan-2021 |
rillig | lint: document bug in typeok_eq
Since rt is an alias for rn->tn_type->t_tspec, it cannot be PTR and VOID at the same time. This makes the condition unsatisfiable. Removing that part of the code didn't show any change in behavior, as expected.
It may even be that fixing this obvious bug doesn't show any change in behavior since that function is only used in a single place and check_pointer_comparison performs its own checks before issuing any warning.
At least the test cases added to msg_124.c all run as expected.
|
1.185 | 24-Jan-2021 |
rillig | lint: update data types in comments from int to bool
|
1.184 | 23-Jan-2021 |
rillig | lint: fix error message for relaxed bool operations in system headers
In strict mode, allowing 1 as bool constant expression is probably not needed in practice since most comparisons are != 0 instead of == 0.
Furthermore, in the expression (flags & 0x0002) == true, comparing with true is misleading since the '==' operator can never evaluate to true in this case.
|
1.183 | 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.182 | 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.181 | 17-Jan-2021 |
rillig | lint: allow system headers to use int as bool, even in strict bool mode
|
1.180 | 17-Jan-2021 |
rillig | lint: rename typeok_amper to typeok_address
This is about the address-of operator, not about the '&' sign that is also used for bitwise and.
|
1.179 | 17-Jan-2021 |
rillig | lint: add type information to message 126
|
1.178 | 17-Jan-2021 |
rillig | lint: flatten typeok_ordered_comparison
|
1.177 | 17-Jan-2021 |
rillig | lint: extend a few message comments
|
1.176 | 17-Jan-2021 |
rillig | lint: add test for incrementing const variable
|
1.175 | 17-Jan-2021 |
rillig | lint: clean up typeok_ordered_comparison
|
1.174 | 17-Jan-2021 |
rillig | lint: fix return type of conaddr
|
1.173 | 17-Jan-2021 |
rillig | lint: reduce scope of local variables in check_expr_misc
|
1.172 | 17-Jan-2021 |
rillig | lint: replace integer constants with bool constants
|
1.171 | 17-Jan-2021 |
rillig | lint: rename bitwise operators
When there are several variants of the AND operator, both of them should get a distinguishing prefix, otherwise it's not clear which of the two possible operators is meant by the plain AND.
|
1.170 | 17-Jan-2021 |
rillig | lint: rename operator STAR to INDIR
C99 calls this operator the "indirection operator". The word "star" does not occur in the index of that standard.
|
1.169 | 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.168 | 17-Jan-2021 |
rillig | lint: rename build_ampersand to build_address
At that stage of analysis, the ampersand is no longer ambiguous, it has already been resolved as the address-of operator, instead of the bitwise-and operator.
|
1.167 | 17-Jan-2021 |
rillig | lint: extract fallback_symbol from new_name_node
The code was too close to the right margin, causing unnatural line breaks. Furthermore it was getting too long and detailed.
|
1.166 | 17-Jan-2021 |
rillig | lint: flatten check_pointer_integer_conversion
|
1.165 | 17-Jan-2021 |
rillig | lint: in strict bool mode, don't treat bool as arithmetic type
|
1.164 | 17-Jan-2021 |
rillig | lint: rename mod_t members
|
1.163 | 16-Jan-2021 |
rillig | lint: refactor strict bool mode and improve comments
The previous comment above typeok_strict_bool_compatible was too hard to understand.
|
1.162 | 16-Jan-2021 |
rillig | lint: in strict bool mode, perform the normal checks as well
|
1.161 | 16-Jan-2021 |
rillig | lint: simplify typeok_strict_bool_compatible
|
1.160 | 16-Jan-2021 |
rillig | lint: add missing warning for bool() == int
|
1.159 | 16-Jan-2021 |
rillig | lint: simplify typeok_strict_bool_assign
When that function is called, the nodes are already before_conversion.
|
1.158 | 16-Jan-2021 |
rillig | lint: remove redundant calls to before_conversion
|
1.157 | 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.156 | 16-Jan-2021 |
rillig | lint: in strict bool mode, integer constants do not have type bool
Previously, lint1 allowed integer constants such as 0 and 1 to be used as bool constants. This was only half-baked since after fixing all error messages from that strict mode, there may still be integer literals in the code that should be replaced with true or false. This would stop a migration from int to bool in the middle, leaving inconsistent code around.
To find the remaining type inconsistencies, treat integers and bool as completely incompatible, even for compile time constants.
|
1.155 | 16-Jan-2021 |
rillig | lint: prepare to make strict bool mode even stricter
Currently, strict bool mode still allows integer constant expressions to be converted implicitly to bool. This is something that other languages such as Go, Java, C#, Pascal don't allow.
By providing a custom implementation of <stdbool.h> that defines false and true to custom bool constant identifiers, lint will cover these cases as well.
To prepare for this, reword the rules and restructure the tests in d_c99_bool_strict.c.
|
1.154 | 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.153 | 15-Jan-2021 |
rillig | lint: merge duplicate code for non-zero detection
|
1.152 | 14-Jan-2021 |
rillig | lint: add type details to message for enum type mismatch
Before December 2020, it was cumbersome to add type information to a message since the caller had to explicitly allocate buffers for the type names. That's probably the reason why this crucial detail had been left out of the warning.
|
1.151 | 12-Jan-2021 |
rillig | lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal.
The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool.
Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed.
See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.
The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly".
The default behavior of lint doesn't change. The strict bool check is purely optional.
An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020.
|
1.150 | 11-Jan-2021 |
rillig | lint: split typeok into several functions
|
1.149 | 11-Jan-2021 |
rillig | lint: sprinkle a few const modifiers throughout the code
|
1.148 | 10-Jan-2021 |
rillig | lint: fix conversion of non-constant scalar to _Bool
|
1.147 | 10-Jan-2021 |
rillig | lint: fix conversion of constant expressions to _Bool
|
1.146 | 10-Jan-2021 |
rillig | lint: rename cvtcon to convert_constant
No functional change.
|
1.145 | 10-Jan-2021 |
rillig | lint: remove redundant braces in is_confusing_precedence
This nicely aligns the different branches, in which "l" and "r" are swapped.
No functional change.
|
1.144 | 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.143 | 09-Jan-2021 |
rillig | lint: push down complexity from typeok to typeok_shr
Contrary to the comment in typeok, the types of the expressions before promotions and conversions are not needed for SHL, SHLASS and SHRASS. Move that code over to typeok_shr, the only place where it is actually used. This removes another 3 variables from typeok.
|
1.142 | 09-Jan-2021 |
rillig | lint: move pointer subtypes from typeok to the sub-functions
The code in typeok is already complicated enough. Only few of the checks actually examine the subtype of the pointer, the others don't need to look at it. Therefore don't initialize the variables lstp (left-hand side subtype) and rstp unless they are actually needed.
This reduces the number of variables in typeok and the number of parameters to the sub-functions.
|
1.141 | 09-Jan-2021 |
rillig | lint: change return type of typeok to bool
No functional change.
|
1.140 | 09-Jan-2021 |
rillig | lint: split typeok into several smaller functions
This reduces the number of local variables from 16 to around 5, in most of the smaller functions.
No functional change.
|
1.139 | 09-Jan-2021 |
rillig | lint: extract typeok_amper from typeok
No functional change.
|
1.138 | 09-Jan-2021 |
rillig | lint: extract typeok_incdec from typeok
No functional change.
|
1.137 | 09-Jan-2021 |
rillig | lint: fix crash for error 108 (invalid type of unary operator)
|
1.136 | 09-Jan-2021 |
rillig | lint: make target platform independent of host platform
If lint is run on a platform that has CHAR_BIT == 10, this doesn't magically make an ILP32 platform have 40 bits per uint32_t.
At the moment, all of the supported platforms are either ILP32 or I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE, so nothing changes practically.
|
1.135 | 05-Jan-2021 |
rillig | lint: make check_precedence_confusion simpler
In C, only binary operators have possibly confusing precedence. All binary operators have lower precedence than an explicit cast. When an expression is parsed, the parentheses are associated with the innermost possible node. This means that as soon as a cast operator is parenthesized, its contained expression can no longer have confusing precedence.
This allows the code to be written more succinct since the local variables are no longer necessary.
|
1.134 | 05-Jan-2021 |
rillig | lint: extract code for determining possible precedence confusion
The function check_precedence_confusion was pretty long, and right in the middle of that function was the complicated part of determining which of the operand combinations are confusing and which aren't.
Extract this part into a separate function to document on which information this decision is based. This makes it easier to understand the code since there are fewer local variables around.
As a left-over from a previous commit, rop and rparn don't need to be initialized twice, now that the assertion for a binary operator is in place.
Remove the large and useless switch statement over all operator types. This list was completely unsorted, for no apparent reason. To see the list of operators, better look them up in ops.def, there was no need to have this list duplicated here.
|
1.133 | 04-Jan-2021 |
rillig | lint: precedence confusion is only possible with binary operators
No functional change.
The operator table in ops.def states that every operator that has possibly confusing precedence is also a binary operator, so assert that instead of having two different code paths.
|
1.132 | 04-Jan-2021 |
rillig | lint: fix bug in "precedence confusion possible [169]"
|
1.131 | 04-Jan-2021 |
rillig | lint: document and demonstrate the bug in check_precedence_confusion
It took quite a while to get to the correct interpretation of this small piece of code and to draw the right conclusions from it. Now the bug is finally ready to be fixed, as already announced in the test.
|
1.130 | 04-Jan-2021 |
rillig | lint: add more rationale for removing effect-less code
|
1.129 | 04-Jan-2021 |
rillig | lint: finish the comments in check_precedence_confusion
|
1.128 | 04-Jan-2021 |
rillig | lint: replace LERROR with lint_assert in check_expr_misc
This reduces the visual clutter. There is no reason for anyone to modify the code around the CALL operator, therefore the assertion is not expected to fail anytime soon.
|
1.127 | 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.126 | 04-Jan-2021 |
rillig | lint: fix bugs in dprint_node in debug mode (since today)
The node was dereferenced before the null check. GCC 5.5 didn't warn about this obvious bug, not even with -Wall -Wextra -O2. Such a case didn't occur though in the few tests that this function was used in.
The indentation for the nested nodes only needs to be set for a few lines of code, make this region as small as possible.
There are nodes that use both tn_left and tn_right, even though they are not defined as binary operators. An example is CALL, for which tn_left is the address of the function name and tn_right, which are the arguments, linked via PUSH nodes. CALL is not a binary operator since it doesn't do any calculations with its arguments.
|
1.125 | 04-Jan-2021 |
rillig | lint: move dprint_node to the top of the file
It now resides right below dumpnode, which implements the same idea but uses a fixed-size output buffer and prints everything in a single line, which quickly gets hard to read. Maybe that's the reason why it had been commented out since it got added in 2014.
|
1.124 | 04-Jan-2021 |
rillig | lint: in debug mode, print node tree for precedence
From the code alone, it is too difficult to see how the various internal operators are combined and what properties they have. A simple tree visualization helps to see all the details.
This is used to track down the typo in check_precedence_confusion, to see whether it could have possibly had any influence at all.
|
1.123 | 04-Jan-2021 |
rillig | lint: add test for "precedence confusion possible [169]"
|
1.122 | 03-Jan-2021 |
rillig | lint: rename funcarg and funccall to longer names
From the previous short names, it was no obvious that these functions create a new tree node.
The function named funccall in lint2 has been left as-is, since it has a completely different prototype.
|
1.121 | 03-Jan-2021 |
rillig | lint: rename functions that create nodes
|
1.120 | 03-Jan-2021 |
rillig | lint: rename type.t_isfield to t_bitfield
|
1.119 | 03-Jan-2021 |
rillig | lint: remove redundant include of externs1.h
It is already included by lint1.h.
|
1.118 | 03-Jan-2021 |
rillig | lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case. Duplicating the condition for printing a message is ok in that case, since it makes all other places in the code simpler.
The occasional "(void)" or "msg = " before the function call had hidden the calls from check-msgs.lua, which didn't check the message texts in such cases.
|
1.117 | 03-Jan-2021 |
rillig | lint: add type information to message 124 "illegal pointer combination"
|
1.116 | 02-Jan-2021 |
rillig | lint: fix lint warning 161 "constant in conditional context"
|
1.115 | 02-Jan-2021 |
rillig | lint: fix buffer truncation for type names
Previously, most type names had been cut off after 63 significant characters. In some cases, 127 characters survived, or 255. And for the debugging messages, sometimes even 1023. This inconsistency was useless.
It was wrong in the first place to make the caller of the function tyname responsible for handling the buffer. That's not something a caller of such a simple function should do. These callers have better things to do.
The API of the new function type_name is as simple as possible.
In the implementation, the name of the type is generated anew each time. I just didn't know whether the type details could change, once the type is initialized, and I didn't want to find out. To be on the safe side, the resulting type name is cached, independently of the type it was generated for. Using a trivial, unbalanced binary tree should be good enough for now.
All this work is necessary to support adding new debug logging, without being distracted by irrelevant implementation details such as these buffer sizes. Adding new debug messages should be fun and easy; up to now, it was overly bureaucratic.
|
1.114 | 01-Jan-2021 |
rillig | lint: rename styp and utyp
|
1.113 | 01-Jan-2021 |
rillig | lint: add missing redundant messages in source code
|
1.112 | 01-Jan-2021 |
rillig | lint: rename tokens for left and right parentheses
|
1.111 | 01-Jan-2021 |
rillig | lint: rename basic_type_name to tspec_name
The term "basic type" is precisely defined in C99 6.2.5p14, and tspec_t is close to that, but nowhere identical.
|
1.110 | 01-Jan-2021 |
rillig | lint: clean up warn_incompatible_types
Splitting the code arbitrarily in separate phases made the code harder to understand, both for humans as well as automated tools.
One of these tools, check-msgs.lua, couldn't check whether the comments match the actual messages, and of course, the comments were wrong. There was no good reason to deviate from the pattern followed by all the rest of the code.
|
1.109 | 01-Jan-2021 |
rillig | lint: fix segmentation fault when checking returned enum types (211)
|
1.108 | 01-Jan-2021 |
rillig | lint: align comments in code with actual messages
Redundancy is bad. Especially in this case, separating the format strings from the actual arguments prevents the compiler from cross-checking them.
|
1.107 | 30-Dec-2020 |
rillig | lint: replace LERROR with lint_assert
This removes the redundancy of mentioning the function name in the error message. This redundancy had been correct in all but 2 cases: build_real_imag and tsize.
|
1.106 | 30-Dec-2020 |
rillig | lint: spell check comments
|
1.105 | 30-Dec-2020 |
rillig | lint: un-abbreviate s_field, s_keyw and s_xsym
|
1.104 | 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.103 | 30-Dec-2020 |
rillig | lint: rename remaining _nxt members to _next
|
1.102 | 30-Dec-2020 |
rillig | lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
|
1.101 | 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.100 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
|
1.99 | 29-Dec-2020 |
rillig | lint: fix typo in comments
|
1.98 | 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.97 | 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.96 | 29-Dec-2020 |
rillig | lint: spell check
|
1.95 | 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.94 | 29-Dec-2020 |
rillig | lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with external linkage are significant. This removes the need to use abbreviations for common words.
|
1.93 | 28-Dec-2020 |
rillig | lint: rename fields in mod_t
|
1.92 | 28-Dec-2020 |
rillig | lint: sort includes
|
1.91 | 28-Dec-2020 |
rillig | lint: realign code
|
1.90 | 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.89 | 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.88 | 02-Jun-2020 |
christos | Fix return of alignof()
|
1.87 | 12-Jul-2019 |
christos | allow c9x struct casts (in new libXt)
|
1.86 | 07-Sep-2018 |
christos | recognize int128
|
1.85 | 29-Jun-2018 |
christos | add missing args for 123
|
1.84 | 06-Mar-2017 |
christos | branches: 1.84.10; 1.84.12; fix typeof, add __builtin_offsetof
|
1.83 | 19-Aug-2016 |
christos | branches: 1.83.2; Add union casts.
|
1.82 | 14-Oct-2015 |
christos | branches: 1.82.2; more descriptive errors
|
1.81 | 28-Aug-2015 |
joerg | ~0 and -1 are the same for two-complement machines. ISO C says left shifts of negative values are UB, so do the shift for the unsigned equivalent and cast to int afterwards.
|
1.80 | 29-Jul-2015 |
christos | Make the return type of "? type1 : void *" or "? void * : type1" to be type1 instead of void *.
|
1.79 | 29-Jul-2015 |
christos | Be more specific about the type errors
|
1.78 | 09-Feb-2015 |
christos | Treat complex numbers like other floating numbers. This caused a core-dump when linting libm complex code and assumed the size of the type larger than the array size of value bitmaps.
|
1.77 | 20-Nov-2014 |
christos | allow c99 flexible arrays for packed structures.
|
1.76 | 17-Apr-2014 |
christos | - add a function to dump a node - better diagnostics on abort - allow converting a constant - initialize right node now that we trash memory this makes a difference. before it was NULL.
|
1.75 | 18-Feb-2014 |
christos | branches: 1.75.2; add __extension__ and typeof
|
1.74 | 18-Feb-2014 |
christos | __real__ and __imag__ produce lvalues
|
1.73 | 19-Apr-2013 |
christos | make NOSTRICT behave the same a LINTED; use the new format.
|
1.72 | 02-Mar-2013 |
christos | obey constcond to !constcond
|
1.71 | 20-Apr-2012 |
christos | branches: 1.71.2; add __PRETTY_FUNCTION__
|
1.70 | 27-Mar-2012 |
christos | more cross lint friendlyness XXX: needs more constants converted double/float
|
1.69 | 21-Mar-2012 |
christos | -0 is not unary overflow.
|
1.68 | 05-Feb-2011 |
christos | branches: 1.68.4; as promised make the last ops table auto-generated.
|
1.67 | 04-Feb-2011 |
christos | fix typo
|
1.66 | 18-Dec-2010 |
christos | branches: 1.66.2; PR/44235: Martin Husemann: Fix core dump due to memory corruption. Found by Henning Petersen
|
1.65 | 24-Nov-2010 |
christos | PR/44148: Henning Petersen: catstrg() does not set the resulting string length.
|
1.64 | 21-Mar-2010 |
christos | revert for now.
|
1.63 | 21-Mar-2010 |
christos | make lint recognize constant shift values and not warn if the number of bits shifted results in a narrower type.
|
1.62 | 02-Oct-2009 |
christos | compute sizes by the new tsize() function.
|
1.61 | 02-Oct-2009 |
christos | remove debugging
|
1.60 | 02-Oct-2009 |
christos | recognize struct __packed x { }; in addition to struct x { } __packed;
|
1.59 | 02-May-2009 |
christos | Add __alignof__.
|
1.58 | 27-Apr-2009 |
ginsbach | Print left and right type and not left type twice. (Hi Christos!)
|
1.57 | 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.56 | 13-Apr-2009 |
christos | since we know the types, print what they are in error messages.
|
1.55 | 02-Mar-2009 |
christos | Don't produce type mismatch warnings if one side of ?: is "[qual] void *" and the other side is "[qual] pointer".
|
1.54 | 16-Nov-2008 |
dholland | branches: 1.54.2; WARNS=4
|
1.53 | 27-Sep-2008 |
matt | Add the complex types to the floating point promotion rules.
|
1.52 | 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.51 | 31-Jul-2008 |
christos | 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.
|
1.50 | 03-May-2008 |
christos | branches: 1.50.2; don't check for NaN if fpe.
|
1.49 | 02-May-2008 |
christos | Since we cannot guarantee that all machines do ieee math, or that they have the proper math setup deal with SIGFPE directly.
|
1.48 | 27-Apr-2008 |
christos | print the types involved in an error.
|
1.47 | 27-Apr-2008 |
christos | reorder a couple of error messages.
|
1.46 | 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.45 | 04-Mar-2008 |
christos | branches: 1.45.2; PR/38142: YAMAMOTO Takashi: lint -S complains on variable length arrays
|
1.44 | 18-Oct-2006 |
he | branches: 1.44.8; 1.44.14; Simplify the previous change. There's actually no need to treat constants specially in ptconv(), the constants will be checked in convert() anyway.
|
1.43 | 18-Oct-2006 |
he | 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.
|
1.42 | 22-Mar-2006 |
christos | Coverity CID 199: make sure that rtp is not NULL before dereferencing.
|
1.41 | 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.40 | 02-Jan-2005 |
christos | 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.
|
1.39 | 02-Jan-2005 |
christos | say from what type to what time we are converting.
|
1.38 | 12-Sep-2004 |
yamt | recognize _Bool.
|
1.37 | 20-Jun-2004 |
jmc | 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
|
1.36 | 30-May-2003 |
christos | branches: 1.36.2; PR/21706: Krister Walfridsson: CVT nodes not handled in ?: expressions.
|
1.35 | 14-May-2003 |
wiz | constant usually has two n.
|
1.34 | 22-Oct-2002 |
christos | add support for ({}) gcc shit.
|
1.33 | 22-Oct-2002 |
christos | handle free-ing of temp symbols properly. Don't segv on bad node types.
|
1.32 | 22-Oct-2002 |
christos | add C9X/GCC compound literal expressions.
|
1.31 | 22-Oct-2002 |
christos | add variable array dimension.
|
1.30 | 22-Oct-2002 |
christos | handle gcc __FUNCTION__ and C9X __func__
|
1.29 | 22-Oct-2002 |
christos | a cast to a pointer is an l-value.
|
1.28 | 22-Oct-2002 |
christos | handle cast in the rhs of a - op.
|
1.27 | 21-Oct-2002 |
christos | Ignore cast size test in initializers; look at example in the comment. Maybe there is a better way...
|
1.26 | 13-Sep-2002 |
christos | 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.
|
1.25 | 05-Feb-2002 |
thorpej | 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.
|
1.24 | 31-Jan-2002 |
tv | Use !finite() instead of isinf() in two places for better compatibility.
|
1.23 | 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.22 | 17-Nov-2001 |
perry | 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.
|
1.21 | 16-Sep-2001 |
wiz | Spell 'occurred' with two 'r's.
|
1.20 | 28-May-2001 |
lukem | 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.
|
1.19 | 28-Jul-1998 |
mycroft | Propagate the value and test contexts to the right-hand side of a comma operator.
|
1.18 | 27-Jul-1998 |
mycroft | Search both sides of a comma operator for side effects.
|
1.17 | 27-Jul-1998 |
mycroft | Fix a recurring typo: comparision -> comparison.
|
1.16 | 27-Jul-1998 |
mycroft | Fix uses of uninitialized memory, and incorrect types for initializers. From ITOH Yasufumi, PR 5861.
|
1.15 | 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.14 | 22-Feb-1998 |
christos | WARNSify
|
1.13 | 12-Mar-1997 |
mycroft | Remove hack for (very old) GCC bug on i386.
|
1.12 | 02-Oct-1995 |
jpo | 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).
|
1.11 | 02-Oct-1995 |
jpo | removed some dubious warnings about conversion of constant operands of bitwise operators
|
1.10 | 02-Oct-1995 |
jpo | allow register variables as left operand of POINT; fixes PR 1442
|
1.9 | 02-Oct-1995 |
jpo | don't print a warning about use of unitialized variables if one of the enclosing compound statements had already an asm statement
|
1.8 | 02-Oct-1995 |
jpo | 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.
|
1.7 | 02-Oct-1995 |
jpo | some minor bug fixes
|
1.6 | 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.5 | 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
1.4 | 02-Oct-1995 |
jpo | prefixed members of dinfo_t with 'd_'
|
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.36.2.1 | 22-Jun-2004 |
tron | Pull up revision 1.37 (requested by jmc in ticket #527): 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
|
1.44.14.1 | 24-Mar-2008 |
keiichi | sync with head.
|
1.44.8.1 | 23-Mar-2008 |
matt | sync with HEAD
|
1.45.2.1 | 18-May-2008 |
yamt | sync with head.
|
1.50.2.1 | 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.54.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.66.2.1 | 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.68.4.3 | 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.68.4.2 | 23-May-2012 |
yamt | sync with head.
|
1.68.4.1 | 17-Apr-2012 |
yamt | sync with head
|
1.71.2.2 | 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.71.2.1 | 23-Jun-2013 |
tls | resync from head
|
1.75.2.1 | 10-Aug-2014 |
tls | Rebase.
|
1.82.2.1 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.83.2.1 | 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.84.12.2 | 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.84.12.1 | 10-Jun-2019 |
christos | Sync with HEAD
|
1.84.10.2 | 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.84.10.1 | 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.648.2.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|