Home | History | Annotate | only in /src/usr.bin/xlint/common
History log of /src/usr.bin/xlint/common
RevisionDateAuthorComments
 1.24 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.23 12-Aug-2023  rillig lint: remove unnecessary double-buffering for output files
 1.22 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.21 10-Jul-2023  rillig lint: replce sprintf with snprintf

Even though the sprintf calls were safe, they looked suspicious.

No functional change.
 1.20 09-Jul-2023  rillig lint: miscellaneous cleanup
 1.19 09-Jun-2023  rillig lint: indent local variables consistently

No binary change.
 1.18 14-Jan-2023  rillig lint: clean up messages for internal errors
 1.17 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.16 04-Sep-2021  rillig lint: move outqchar from common to lint1
 1.15 04-Sep-2021  rillig lint: trim down the code for writing the output files

The output buffer is only needed in a single file, so unexport it.

When calling outname, the chances for the name being null are close to
zero, therefore omit the caller information.
 1.14 04-Sep-2021  rillig lint: use 'char' as type for passing characters to functions

No functional change.
 1.13 22-Aug-2021  rillig lint: only include code in the binaries that is actually used

No functional change.
 1.12 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.11 27-Mar-2021  rillig lint: remove space between 'sizeof ('

No functional change.
 1.10 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.9 30-Dec-2020  rillig lint: fix Clang-tidy warning about narrowing conversion
 1.8 30-Dec-2020  rillig lint: rename more _nxt members to _next
 1.7 28-Dec-2020  rillig lint: spell check
 1.6 17-Apr-2014  christos make outname print where it came from in case of error
 1.5 15-Apr-2009  christos branches: 1.5.6; 1.5.12; 1.5.22;
Lukemify (WARNS=4)
 1.4 20-Jun-2004  jmc branches: 1.4.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.3 31-Jan-2002  tv branches: 1.3.4;
Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.2 21-Jan-2002  tv Add hooks for compiling on non-NetBSD hosts.
 1.1 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.4.1 22-Jun-2004  tron Pull up revision 1.4 (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.4.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.5.22.1 10-Aug-2014  tls Rebase.
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.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.37 08-Dec-2024  rillig lint: warn about do-while macros that end with a semicolon
 1.36 02-Feb-2024  rillig branches: 1.36.2;
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.35 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.34 20-Jan-2024  rillig lint: clean up
 1.33 20-Jan-2024  rillig lint: unclutter conditional compilation
 1.32 20-Jan-2024  rillig lint: only define xcalloc if actually used
 1.31 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.30 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.29 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.28 06-Jul-2023  rillig lint: add type safety for accessing properties of basic types

No functional change.
 1.27 29-Jun-2023  rillig lint: clean up initialization of type properties

No functional change.
 1.26 24-Jun-2023  rillig lint: remove redundant 'extern' from function declarations

No binary change.
 1.25 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.24 04-Sep-2021  rillig lint: move outqchar from common to lint1
 1.23 04-Sep-2021  rillig lint: trim down the code for writing the output files

The output buffer is only needed in a single file, so unexport it.

When calling outname, the chances for the name being null are close to
zero, therefore omit the caller information.
 1.22 04-Sep-2021  rillig lint: use 'char' as type for passing characters to functions

No functional change.
 1.21 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.20 22-Aug-2021  rillig lint: only include code in the binaries that is actually used

No functional change.
 1.19 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.18 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.17 01-Aug-2021  rillig lint: make xasprintf simpler

No functional change.
 1.16 01-Aug-2021  rillig lint: unexport nomem

No functional change.
 1.15 01-Aug-2021  rillig lint: remove xmapalloc

Just trust the standard malloc to be smart enough.

No functional change.
 1.14 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.13 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.12 04-Jan-2021  rillig lint: revert previous commit, except for the typo
 1.11 04-Jan-2021  rillig lint: fix typo in comment
 1.10 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.9 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.8 29-Dec-2020  rillig lint: rename functions with very short names
 1.7 10-Feb-2020  christos use asprintf().
 1.6 19-Aug-2016  christos branches: 1.6.14;
add a type comparison function.
 1.5 17-Apr-2014  christos make outname print where it came from in case of error
 1.4 07-Apr-2005  christos branches: 1.4.44; 1.4.50; 1.4.62;
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.3 21-Oct-2003  christos 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.2 18-Jan-2002  thorpej Centralize the initialization/declaration of the ttab.
 1.1 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.62.1 10-Aug-2014  tls Rebase.
 1.4.50.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.44.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.6.14.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.36.2.1 02-Aug-2025  perseant Sync with HEAD
 1.6 03-Jul-2023  rillig lint: rename uppercase QUAD to LLONG

No binary change.
 1.5 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.4 04-Jan-2021  rillig lint: fix typo in comment
 1.3 27-Mar-2012  christos more cross lint friendlyness
XXX: needs more constants converted double/float
 1.2 20-Feb-2002  thorpej branches: 1.2.58;
Add constants that describe the target's max/min INT, UINT, LONG, ULONG,
QUAD, and UQUAD values.
 1.1 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.2.58.1 17-Apr-2012  yamt sync with head
 1.44 10-Apr-2025  rillig lint: remove now-unnecessary CONSTCOND comments
 1.43 29-Aug-2024  rillig lint: support GCC's __auto_type

Fixes PR toolchain/58654.
 1.42 20-Jan-2024  rillig branches: 1.42.2;
lint: unclutter conditional compilation
 1.41 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.40 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.39 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.38 08-Jul-2023  rillig lint: clarify the meaning of 'portable size in bits' of a type

No functional change.
 1.37 03-Jul-2023  rillig lint: rename uppercase QUAD to LLONG

No binary change.
 1.36 29-Jun-2023  rillig lint: clean up initialization of type properties

No functional change.
 1.35 09-Jun-2023  rillig lint: indent local variables consistently

No binary change.
 1.34 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.33 30-Nov-2022  rillig lint: make definitions of basic types simpler

No binary change.
 1.32 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.31 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.30 05-Sep-2021  rillig lint: hide irrelevant type information from lint2

No functional change.
 1.29 04-Sep-2021  rillig lint: make initialization of the basic types table simpler

No functional change.
 1.28 04-Sep-2021  rillig lint: remove _Complex from tspec_name

That type is only used in the parser; the expression trees use FCOMPLEX,
DCOMPLEX or LCOMPLEX instead.

Sort the typeinfo definitions according to their order in tspec_t. Do
not add _Complex there since it is not needed. This means that NOTSPEC
and COMPLEX would both trigger an internal error.
 1.27 04-Sep-2021  rillig lint: remove unnecessary includes

The type definitions used to depend on the host's platform
characteristics once, which required <limits.h>.
 1.26 28-Aug-2021  rillig lint: fix lint warning about initializing with negative number

No functional change.
 1.25 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.24 30-Jun-2021  rillig lint: fix bit-size of long double _Complex in portable mode

C99 6.2.5p13 says that LCOMPLEX has the same representation and
alignment requirements as an array type containing exactly two LDOUBLE.

When support for _Complex was added to lint in inittyp.c 1.10 from
2008-09-27, there was no explanation for making the bit-size of LCOMPLEX
different from what C99 says, so it was probably a mistake that went
unnoticed for more than 12 years. It's an edge case anyway.
 1.23 29-Jun-2021  rillig lint: fix wrong warning about out-of-range value '\xff' for char

This only affects platforms where char has the same representation as
unsigned char.
 1.22 27-Mar-2021  rillig lint: remove space between 'sizeof ('

No functional change.
 1.21 20-Mar-2021  rillig lint: use macro for encoding type information

In lint's strict bool mode, initialization must be of the correct type.
This affects the bool fields in ttab_t, which are initialized with int.
To keep the code brief, preserve these ints and let a macro do the
actual work of converting them to bool.

No change to the generated binary.
 1.20 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.19 20-Feb-2021  rillig lint: fix lint warnings

No functional change.
 1.18 24-Jan-2021  rillig lint: reduce preprocessor magic for platform target types
 1.17 17-Jan-2021  rillig lint: in strict bool mode, don't treat bool as arithmetic type
 1.16 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.15 04-Jan-2021  rillig lint: revert previous commit, except for the typo
 1.14 04-Jan-2021  rillig lint: fix typo in comment
 1.13 30-Dec-2020  rillig lint: inline STRUCT_ASSIGN

This had only been necessary for some pre-C90 compilers.
 1.12 07-Sep-2018  christos recognize int128
 1.11 15-Apr-2009  christos branches: 1.11.44; 1.11.46;
Lukemify (WARNS=4)
 1.10 26-Sep-2008  matt branches: 1.10.6;
Teach lint about long double _Complex (C99)
 1.9 25-Apr-2008  christos preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
 1.8 07-Feb-2007  hubertf branches: 1.8.10;
Remove unused ctype.h header.
Contributed by Slava Semushin <slava.semushin@gmail.com> in private mail.
 1.7 12-Sep-2004  yamt recognize _Bool.
 1.6 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.5 29-May-2003  christos branches: 1.5.2;
- make all targparam.h files consistent with the arch includes
- add a new INTPTR_IS_LONG define and use it.

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

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

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

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

but it is not that smart (yet).
 1.4 31-Jan-2002  tv Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.3 30-Jan-2002  thorpej Define FLOAT_SIZE, DOUBLE_SIZE, LDOUBLE_SIZE, and ENUM_SIZE in
target-specific headers, and use the definitions when initializing
the type table.
 1.2 21-Jan-2002  tv Add hooks for compiling on non-NetBSD hosts.
 1.1 18-Jan-2002  thorpej Centralize the initialization/declaration of the ttab.
 1.5.2.1 22-Jun-2004  tron Pull up revision 1.6 (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.8.10.1 18-May-2008  yamt sync with head.
 1.10.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.11.46.1 10-Jun-2019  christos Sync with HEAD
 1.11.44.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.42.2.1 02-Aug-2025  perseant Sync with HEAD
 1.51 29-Aug-2024  rillig lint: support GCC's __auto_type

Fixes PR toolchain/58654.
 1.50 12-May-2024  rillig branches: 1.50.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.49 02-Mar-2024  rillig lint: remove custom wrappers around <ctype.h> functions
 1.48 01-Feb-2024  rillig lint: use standard buffer for storing string values

No functional change.
 1.47 20-Jan-2024  rillig lint: unclutter conditional compilation
 1.46 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.45 03-Dec-2023  rillig lint: move function body brace to the left

No functional change.
 1.44 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.43 12-Aug-2023  rillig lint: clean up
 1.42 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.41 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.40 08-Jul-2023  rillig lint: clarify the meaning of 'portable size in bits' of a type

No functional change.
 1.39 06-Jul-2023  rillig lint: add type safety for accessing properties of basic types

No functional change.
 1.38 03-Jul-2023  rillig lint: rename uppercase QUAD to LLONG

No binary change.
 1.37 29-Jun-2023  rillig lint: clean up initialization of type properties

No functional change.
 1.36 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.35 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.34 22-Dec-2021  rillig lint: remove spaces around bit-field colon

As seen in /usr/share/misc/style.

No binary change.
 1.33 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.32 05-Sep-2021  rillig lint: hide irrelevant type information from lint2

No functional change.
 1.31 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.30 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.29 22-Aug-2021  rillig lint: only include code in the binaries that is actually used

No functional change.
 1.28 10-Aug-2021  rillig lint: clean up comments
 1.27 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.26 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.25 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.24 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.23 04-Jan-2021  rillig lint: revert previous commit, except for the typo
 1.22 04-Jan-2021  rillig lint: fix typo in comment
 1.21 02-Jan-2021  rillig lint: use bool instead of u_int:1 in structures

Better late than never.
 1.20 01-Jan-2021  rillig lint: rename styp and utyp
 1.19 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.18 30-Dec-2020  rillig lint: rename more _nxt members to _next
 1.17 28-Dec-2020  rillig lint: spell check
 1.16 28-Dec-2020  rillig lint: rename tspec macros
 1.15 28-Dec-2020  rillig lint: fix typo in comment
 1.14 07-Sep-2018  christos recognize int128
 1.13 15-Apr-2009  christos branches: 1.13.44; 1.13.46;
Lukemify (WARNS=4)
 1.12 26-Sep-2008  matt branches: 1.12.6;
Teach lint about long double _Complex (C99)
 1.11 25-Apr-2008  christos preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
 1.10 30-Mar-2008  dholland branches: 1.10.2;
Add a little const.
 1.9 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.8 12-Sep-2004  yamt recognize _Bool.
 1.7 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

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

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.6 07-Mar-2002  tv Revert previous; <inttypes.h> is auto-generated-empty now.
 1.5 07-Mar-2002  tv Autoconf bracket #include <inttypes.h>.
 1.4 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.3 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.2 21-Jan-2002  tv Add hooks for compiling on non-NetBSD hosts.
 1.1 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.10.2.1 18-May-2008  yamt sync with head.
 1.12.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.13.46.1 10-Jun-2019  christos Sync with HEAD
 1.13.44.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.50.2.1 02-Aug-2025  perseant Sync with HEAD
 1.11 03-Jul-2023  rillig lint: rename uppercase QUAD to LLONG

No binary change.
 1.10 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.9 04-Jan-2021  rillig lint: revert previous commit, except for the typo
 1.8 04-Jan-2021  rillig lint: fix typo in comment
 1.7 16-Nov-2018  scole PR toolchain/53710

allow 64bit target to compile on 32bit host

Ok'ed by <christos>
 1.6 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.5 07-Sep-2018  christos recognize int128
 1.4 27-Mar-2012  christos branches: 1.4.30; 1.4.32;
more cross lint friendlyness
XXX: needs more constants converted double/float
 1.3 21-May-2003  simonb branches: 1.3.56;
Move one group of #define's so this looks more like ilp32.h.
 1.2 20-Feb-2002  thorpej Add constants that describe the target's max/min INT, UINT, LONG, ULONG,
QUAD, and UQUAD values.
 1.1 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.56.1 17-Apr-2012  yamt sync with head
 1.4.32.1 10-Jun-2019  christos Sync with HEAD
 1.4.30.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.4.30.2 20-Oct-2018  pgoyette Sync with head
 1.4.30.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.25 20-Jan-2024  rillig lint: clean up
 1.24 20-Jan-2024  rillig lint: unclutter conditional compilation
 1.23 20-Jan-2024  rillig lint: only define xcalloc if actually used
 1.22 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.21 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.20 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.19 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.18 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.17 22-Aug-2021  rillig lint: only include code in the binaries that is actually used

No functional change.
 1.16 03-Aug-2021  rillig lint: make memory management code easier to read

No functional change.
 1.15 01-Aug-2021  rillig lint: make xasprintf simpler

No functional change.
 1.14 01-Aug-2021  rillig lint: unexport nomem

No functional change.
 1.13 01-Aug-2021  rillig lint: remove xmapalloc

Just trust the standard malloc to be smart enough.

No functional change.
 1.12 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.11 29-Dec-2020  rillig lint: remove redundant parentheses around return value
 1.10 28-Dec-2020  rillig lint: remove trailing whitespace
 1.9 28-Dec-2020  rillig lint: spell check
 1.8 10-Feb-2020  christos use asprintf().
 1.7 20-Jun-2004  jmc branches: 1.7.92;
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.6 22-Oct-2003  christos branches: 1.6.2;
- keep the fd to /dev/zero open
- take advantage of MAP_ANONYMOUS
 1.5 21-Oct-2003  christos 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.4 16-Oct-2003  itojun safer use of realloc
 1.3 31-Jan-2002  tv Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.2 21-Jan-2002  tv Add hooks for compiling on non-NetBSD hosts.
 1.1 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.2.1 22-Jun-2004  tron Pull up revision 1.7 (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.7.92.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13 13-Jul-2023  rillig lint: indent copyright lines consistently
 1.12 10-Jul-2023  rillig lint: clean up wchar_t and hash tables
 1.11 09-Jun-2023  rillig lint: miscellaneous clean-ups

No binary change, except for line numbers in assertions.
 1.10 14-Jan-2023  rillig lint: remove unnecessary MBLKSIZ, use stack buffer in xlint

No functional change.
 1.9 03-Aug-2021  rillig lint: reduce number of negations in preprocessor condition

No functional change.
 1.8 30-Dec-2020  rillig lint: remove unused macro STRBLEN
 1.7 30-Dec-2020  rillig lint: inline STRUCT_ASSIGN

This had only been necessary for some pre-C90 compilers.
 1.6 28-Dec-2020  rillig lint: spell check
 1.5 21-Sep-2003  martin Lint is a host tool - leave the sparc64 hack in place if compiling with
an old compiler.
 1.4 19-Sep-2003  martin No need to avoid long double on sparc64 any more.
 1.3 13-Jun-2002  wiz Remove some __STDC__ tests.
 1.2 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.1 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 27-Mar-2012  christos branches: 1.1.2;
more cross lint friendlyness
XXX: needs more constants converted double/float
 1.1.2.2 17-Apr-2012  yamt sync with head
 1.1.2.1 27-Mar-2012  yamt file schar.h was added on branch yamt-pagecache on 2012-04-17 00:09:44 +0000
 1.67 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.66 24-May-2025  rillig lint: constify
 1.65 08-Dec-2024  rillig lint: warn about do-while macros that end with a semicolon
 1.64 30-Nov-2024  rillig lint: fix type name of prototype function in lint2 messages

Since tyname.c 1.42 from 2021-06-28, when the type names for '(void)'
prototypes was fixed for lint1 but not for lint2.
 1.63 13-Nov-2024  rillig lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
 1.62 09-Mar-2024  rillig branches: 1.62.2;
lint: inline accessor macros for type_t
 1.61 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.60 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.59 01-Feb-2024  rillig lint: use standard buffer for storing string values

No functional change.
 1.58 20-Jan-2024  rillig lint: unclutter conditional compilation
 1.57 02-Aug-2023  rillig lint: distinguish between arguments and parameters
 1.56 29-Jun-2023  rillig lint: use standard terminology for bit-field width

No functional change.
 1.55 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.54 18-Feb-2023  rillig lint: replace INTERNAL_ERROR with plain assert
 1.53 03-Jul-2022  rillig lint: include the width of bit-fields in the type name
 1.52 21-Jun-2022  rillig lint: use is_struct_or_union instead of comparing twice

No functional change.
 1.51 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.50 05-Sep-2021  rillig lint: reduce number of ifdef names

No functional change.
 1.49 04-Sep-2021  rillig lint: remove _Complex from tspec_name

That type is only used in the parser; the expression trees use FCOMPLEX,
DCOMPLEX or LCOMPLEX instead.

Sort the typeinfo definitions according to their order in tspec_t. Do
not add _Complex there since it is not needed. This means that NOTSPEC
and COMPLEX would both trigger an internal error.
 1.48 04-Sep-2021  rillig lint: remove duplicate code in tspec_name

No functional change.
 1.47 04-Sep-2021  rillig lint: reduce indentation in tdeferr

No functional change.
 1.46 31-Aug-2021  rillig lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.
 1.45 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.44 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.43 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.42 28-Jun-2021  rillig lint: fix type name for prototype function without parameters
 1.41 04-Jun-2021  rillig lint: fix typo in comment
 1.40 18-Apr-2021  rillig branches: 1.40.4;
lint: remove redundant CONSTCOND

In do-while-0 loops, these are no longer needed since tree.c 1.202 from
2021-01-31.
 1.39 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.38 09-Apr-2021  rillig lint: for structs and unions, include incompleteness in the type name

This mainly helps to assess the situation where lint warns that a
pointer cast "may be troublesome", see msg_247.exp.
 1.37 02-Apr-2021  rillig lint: add parentheses after sizeof, as required by share/misc/style

No functional change.
 1.36 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.35 26-Mar-2021  rillig lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'

No functional change.
 1.34 07-Mar-2021  rillig lint: in the name of an array type, list the dimension first

before: array of unsigned int[4]
now: array[4] of unsigned int

Listing the array dimension first keeps it in contact with the keyword
'array'. This reduces confusion, especially for nested arrays.
 1.33 28-Feb-2021  rillig lint: extract type_name_of_array from type_name

No functional change.
 1.32 28-Feb-2021  rillig lint: output precise type information for struct/union/enum

Previously, 'typedef enum { E } name' was output as 'name', which
omitted the information that this was an enum type. Now it is output as
'enum typedef name'.

Previously, 'typedef struct { int member; } name' was output as 'struct
<unnamed>', which omitted the typedef name. Now it is output as 'struct
typedef name'.
 1.31 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.30 21-Feb-2021  rillig lint: add type information to message about enum mismatch
 1.29 19-Feb-2021  rillig lint: rename t_isenum and t_aincompl to be more expressive

No functional change.
 1.28 19-Feb-2021  rillig lint: rename tenum_t and its members to be more expressive
 1.27 19-Feb-2021  rillig lint: rename str_t and its members to be more expressive

No functional change.
 1.26 26-Jan-2021  rillig lint: remove __noinline attribute from string interning function

I had committed this accidentally while ensuring that the generated code
is still efficient even though the source code looks heavy with the
double pointer indirection.
 1.25 24-Jan-2021  rillig lint: merge duplicate code for interning type names
 1.24 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.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: fix typos and other minor stylistic issues
 1.21 03-Jan-2021  rillig lint: add detailed type information for functions
 1.20 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.19 02-Jan-2021  rillig lint: order tspec_name in the same way as the enum
 1.18 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.17 31-Dec-2020  rillig lint: check that in "if (cond)", cond is scalar
 1.16 29-Dec-2020  rillig lint: rename functions with very short names
 1.15 29-Dec-2020  rillig lint: fix indentation and alignment that used space-tab
 1.14 29-Dec-2020  rillig lint: remove redundant parentheses around return value
 1.13 07-Sep-2018  christos recognize int128
 1.12 19-Aug-2016  christos branches: 1.12.12; 1.12.14;
add a type comparison function.
 1.11 20-Jun-2012  christos better to print (null) than core-dump
 1.10 26-Sep-2008  matt branches: 1.10.2;
Add a missing label for LCOMPLEX
 1.9 26-Sep-2008  matt Teach lint about long double _Complex (C99)
 1.8 01-May-2008  christos fix const and volatile printing in types.
 1.7 01-May-2008  christos PR/38543: Valery Ushakov: Don't crash printing anonymous unions. XXX: Type
printing is phase2 is buggy since it does not print the qualifiers, but this
is for another day.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 25-Apr-2008  christos preliminary _Complex support.
NB: Does not really understand type conversions between complex and doubles.
 1.4 07-Feb-2007  hubertf branches: 1.4.10;
Remove unused ctype.h header.
Contributed by Slava Semushin <slava.semushin@gmail.com> in private mail.
 1.3 17-Apr-2006  skrll Add RCSId.
 1.2 14-Jun-2005  skd Deal with void * types. Approved by Christos.
 1.1 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.4.10.1 18-May-2008  yamt sync with head.
 1.10.2.1 30-Oct-2012  yamt sync with head
 1.12.14.1 10-Jun-2019  christos Sync with HEAD
 1.12.12.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.40.4.1 06-Jun-2021  cjep sync with head
 1.62.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 27-Mar-2012  christos branches: 1.1.2;
more cross lint friendlyness
XXX: needs more constants converted double/float
 1.1.2.2 17-Apr-2012  yamt sync with head
 1.1.2.1 27-Mar-2012  yamt file uchar.h was added on branch yamt-pagecache on 2012-04-17 00:09:44 +0000

RSS XML Feed