History log of /src/tests/usr.bin/xlint/lint1/expr_fold.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.17 10-Apr-2025 rillig

lint: remove now-unnecessary CONSTCOND comments


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.16 08-Jun-2024 rillig

branches: 1.16.2;
lint: add details to warnings about negative constant to unsigned


# 1.15 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.14 10-Mar-2024 rillig

lint: detect more cases of integer overflow in constant expressions

For unsigned integers, detect when 'a + b' wraps around.


# 1.13 10-Mar-2024 rillig

lint: remove wrong warning about overflow in unary '-' for unsigned


# 1.12 09-Mar-2024 rillig

lint: fix excessive overflow warning after division by zero


# 1.11 06-Jan-2024 rillig

lint: remove redundant parentheses, braces and comments

Rename the functions for folding constant expressions, to make the
comments redundant.


# 1.10 09-Jul-2023 rillig

lint: clean up the wording of a few diagnostics


# 1.9 02-Jul-2023 rillig

lint: rename 'quad' to 'signed int' or 'unsigned int'

No functional change.


# 1.8 28-Mar-2023 rillig

lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html


Revision tags: netbsd-10-1-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.7 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.6 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.5 23-Aug-2021 rillig

lint: add quotes around placeholder in message 141


# 1.4 22-Aug-2021 rillig

lint: fix folding of comparisons in constant expressions


# 1.3 22-Aug-2021 rillig

tests/lint: demonstrate wrong folding of 64-bit numbers


# 1.2 19-Aug-2021 rillig

lint: fix wrong integer overflow warning for unsigned types


# 1.1 19-Aug-2021 rillig

tests/lint: test folding of constant expressions

Since November 2001, there is a comment above the function 'fold' that
suggests there are a few bugs concerning overflow detection. Add some
first 'proper regression tests' to prove these bugs.