bug-gnulib
[Top][All Lists]
Advanced

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

Re: warnings in unit tests


From: Dmitry V. Levin
Subject: Re: warnings in unit tests
Date: Wed, 9 Jun 2021 03:41:02 +0300

On Tue, Jun 08, 2021 at 10:56:33AM +0200, Bruno Haible wrote:
> 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.

Unlike many other gcc warnings, -Wmissing-prototypes is especially useful
because it doesn't report false positives, so I don't see why one may want
to turn -Wmissing-prototypes off.

In case of recurse_1(), the function isn't declared static for a specific
reason that isn't obvious for casual readers.  In such cases it's usually
a good idea to add a comment explaining why this case is different from
the common pattern.


-- 
ldv



reply via email to

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