Home | History | Annotate | Download | only in common
History log of /src/usr.bin/xlint/common/lint.h
RevisionDateAuthorComments
 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

RSS XML Feed