[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'sigsegv'
From: |
Dmitry V. Levin |
Subject: |
Re: new module 'sigsegv' |
Date: |
Mon, 7 Jun 2021 13:29:32 +0300 |
Hi,
On Mon, Jun 07, 2021 at 02:49:35AM +0200, Bruno Haible wrote:
[...]
> > -volatile int *
> > +static volatile int *
> > recurse_1 (int n, volatile int *p)
> > {
> > if (n < INT_MAX)
> > @@ -80,7 +80,7 @@ recurse_1 (int n, volatile int *p)
> > return p;
> > }
> >
> > -int
> > +static int
> > recurse (volatile int n)
> > {
> > return *recurse_1 (n, &n);
>
> This part should better not be applied. It may enable compiler optimizations
> (now or in the future) that, in the end, turn an endless recursion into an
> endless loop.
I'm not sure there is any difference left in the modern world of
lto-enabled compilers. Anyway, in most cases warnings issued by
-Wmissing-prototypes are not related to functions with volatile return
types, so making them static shouldn't affect the result.
> > @@ -183,6 +183,9 @@ main ()
> > *(volatile int *) (page + 0x678) = 42;
> > break;
> > case 3:
> > +#if 6 < __GNUC__
> > +# pragma GCC diagnostic ignored "-Wnull-dereference"
> > +#endif
> > *(volatile int *) 0 = 42;
> > break;
> > case 4:
>
> We shouldn't spend time eliminating warnings from test code.
>
> The goal is to have a good coverage of the lib/* code with unit tests.
> That means, we need to
> - make it easy to write unit tests,
> - not make it time-consuming to maintain them.
>
> Eliminating warnings from lib/* code is useful, to avoid bugs in the
> programs. But eliminating warnings from tests/* code goes against the
> goal of increasing test coverage.
>
> I think the right fix would be that gnulib-tool's --import/--update
> option, when creating a tests directory, adds a $(CFLAG_ALLOW_WARNING)
> to tests/Makefile.am, where CFLAG_ALLOW_WARNING is defined as
> -Wno-error when the compiler is GCC or clang,
> empty otherwise
> Will that work in GNU grep?
GNU grep explicitly disables some warnings and enables -Werror for gnulib
tests [1][2], so I'd like to ask Jim what's the preferred way of handling
this in GNU grep.
[1]
https://git.savannah.gnu.org/gitweb/?p=grep.git;a=commitdiff;h=v3.6-2-g623008c
[2]
https://git.savannah.gnu.org/gitweb/?p=grep.git;a=commitdiff;h=v3.6-17-g74cda43
--
ldv
- 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 <=
- 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, 2021/06/10
- 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