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

RSS XML Feed