bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warnings in unit tests


From: Bruno Haible
Subject: Re: warnings in unit tests
Date: Tue, 08 Jun 2021 10:56:33 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

Jim Meyering wrote:
> I can live without -Wmissing-prototypes in gnulib tests, but I still
> remember times where using that option exposed a real bug.

-Wmissing-prototypes typically exposes real bugs when a program is composed
of several compilation units. Unit tests are typically a single compilation
unit plus libtests.a, and libtests.a being built from modules with .h / .c
combinations it does not have the kind of bug that -Wmissing-prototypes can
detect.

Anyway, the main point is that I, as the author of 75% of the Gnulib tests
and maintainer of the Gnulib tests, trust a certain set of GCC warnings
(namely, '-Wall -ftrapv'), as they have proven useful for these tests. If
a maintainer of a different package trusts a different set of GCC warnings
or clang warnings or the warnings of some other tool, they are welcome to
report bugs that they found this way. But they are not welcome to force
their preferred set of warning options onto the Gnulib tests, because that
means additional maintenance costs, which goes against the goal of having
a high test coverage.

> My point about the cost/benefit was regarding that 3-line addition for
> a single, deliberate NULL-deref.
> That one really does not deserve to quash -Wnull-dereference for all tests.

Compilers are getting more and more knowledge about POSIX functions.
Over time, they will warn about more and more of the corner cases that
the Gnulib test suite exercises. So, it's not only about the deliberate
pointer access here.

Jeffrey Walton is doing sanitizer-enabled testing of Gnulib. This has
proven to be more useful than listening to large amounts of GCC or clang
warning options.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]