History log of /src/tests/usr.bin/xlint/lint1/msg_161.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.13 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.12 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.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.11 19-Jun-2023 rillig

branches: 1.11.2;
tests/lint: comma operators are not allowed in constant expressions


# 1.10 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.9 16-Jun-2022 rillig

tests/lint: make expectation lines in the tests more detailed

This commit migrates msg_100 until msg_199.


# 1.8 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 '=='.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.7 21-Mar-2021 rillig

lint: fix reachability for while (0)


# 1.6 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.5 28-Feb-2021 rillig

tests/lint: add test for constant expression involving sizeof


# 1.4 31-Jan-2021 rillig

lint: don't warn about constant condition in 'do { } while (0)'


# 1.3 31-Jan-2021 rillig

lint: add expectations to test for message 161


# 1.2 31-Jan-2021 rillig

lint: add tests for 'constant in conditional context'

One of these tests explains why 'do { } while (0)' is so usual that
there is no reason to warn about it. That warning will not survive for
long.


# 1.1 02-Jan-2021 rillig

lint: add a test for each message produced by lint1

Having a test for each message ensures that upcoming refactorings don't
break the basic functionality. Adding the tests will also discover
previously unknown bugs in lint.

The tests ensure that every lint message can actually be triggered, and
they demonstrate how to do so. Having a separate file for each test
leaves enough space for documenting historical anecdotes, rationale or
edge cases, keeping them away from the source code.

The interesting details of this commit are in Makefile and
t_integration.sh. All other files are just auto-generated.

When running the tests as part of ATF, they are packed together as a
single test case. Conceptually, it would have been better to have each
test as a separate test case, but ATF quickly becomes very slow as soon
as a test program defines too many test cases, and 50 is already too
many. The time complexity is O(n^2), not O(n) as one would expect.
It's the same problem as in tests/usr.bin/make, which has over 300 test
cases as well.