[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: |
Thu, 10 Jun 2021 22:05:32 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
Dmitry V. Levin wrote:
> 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.
Sometimes a function in a test is not used on some platforms. What are the
possible ways to deal with it?
(1) The test function could be put into a #if. This #if condition needs
to be updated in some circumstances.
=> This approach (which I would use in lib/ code) is not zero-cost.
(2) The test function can be made 'static'; then we get a compiler warning
about an unused function (already with '-Wall', IIRC).
(3) The test function can be made global; then we have no warning.
But -Wmissing-prototypes makes it into a warning.
(4) Then we need to add a prototype to fix that warning.
You see my point? These are small considerations each time, but they
contribute to making test authoring+maintenance a hassle. And they have
no benefit (as I said, in a test that consists of a single compilation
unit, linked against one or more .a files).
Bruno
- Re: new module 'sigsegv', Dmitry V. Levin, 2021/06/06
- Re: new module 'sigsegv', Bruno Haible, 2021/06/06
- Re: new module 'sigsegv', Dmitry V. Levin, 2021/06/07
- Re: new module 'sigsegv', Jim Meyering, 2021/06/07
- warnings in unit tests, Bruno Haible, 2021/06/07
- Re: warnings in unit tests, Jim Meyering, 2021/06/08
- Re: warnings in unit tests, Bruno Haible, 2021/06/08
- Re: warnings in unit tests, Dmitry V. Levin, 2021/06/08
- Re: warnings in unit tests,
Bruno Haible <=
- Message not available
- Re: warnings in unit tests, Bruno Haible, 2021/06/08
- Re: warnings in unit tests, Paul Eggert, 2021/06/08
- Re: warnings in unit tests, Dmitry V. Levin, 2021/06/09
- Re: warnings in unit tests, Bruno Haible, 2021/06/09
- Re: warnings in unit tests, Bruno Haible, 2021/06/10
- Re: warnings in unit tests, Bernhard Voelker, 2021/06/09
- Re: warnings in unit tests, Bruno Haible, 2021/06/09
- Re: warnings in unit tests, Simon Josefsson, 2021/06/10
- Re: warnings in unit tests, Bruno Haible, 2021/06/10
- Re: warnings in unit tests, Simon Josefsson, 2021/06/10