bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] Avoid one "parameter unused" warnings.


From: Michal Privoznik
Subject: Re: [PATCH] Avoid one "parameter unused" warnings.
Date: Tue, 2 Jan 2018 09:20:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 01/02/2018 08:38 AM, Paul Eggert wrote:
> Michal Privoznik wrote:
> 
>> it's not a false positive either
> 
> It depends on what we're looking for. I'm looking for bugs. To take an
> extreme example, if GCC warned about every character string literal
> containing an unescaped ASCII apostrophe, on the grounds that the
> apostrophe could be a typo and program quality would be improved by
> requiring programmers to manually check and explicitly escape every
> string-literal apostrophe, I'd disable such a warning first thing. Any
> benefits of the warning would not be worth the hassle.
> 
> The warning we're talking about is not as bad as this hypothetical
> example. But it's pretty bad. I'd rather not contort good code to pacify
> it.
> 
>> Try running 'make syntax-check' which fails because of gnulib's
>> copyright_check.
> 
> This sounds like a different and unrelated problem.

Yes it is. It's just that when I wanted to update gnulib submodule I ran
into this problem of unused parameter.

> 
>> BTW: the patch of yours don't help really. Firstly, unused-parameter
>> sneaks back in (through -Wextra I assume). And secondly, in libvirt we
>> want to use Wunused-parameter and we do mark unused parameters
>> explicitly (see ATTRIBUTE_UNUSED macro).
> 
> In that case, I suggest doing what coreutils and other programs do: use
> a different set of warnings for Gnulib code than for the libvirt code.
> You can specify -Wno-unused-parameter just for Gnulib; this will
> override -Wextra.

I don't think this is going to fly. Problem is a .c file includes
stat-time.h from gnulib:

make[3]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
  CC       storage/libvirt_driver_storage_impl_la-storage_util.lo
In file included from storage/storage_util.c:67:0:
../gnulib/lib/stat-time.h: In function 'stat_time_normalize':
../gnulib/lib/stat-time.h:215:47: error: unused parameter 'st'
[-Werror=unused-parameter]
 stat_time_normalize (int result, struct stat *st)
                                               ^~
cc1: all warnings being treated as errors


Different CFLAGS for gnulib won't work IMO. Maybe we can use #pragma to
disable warnings when #including the gnulib file? Although, that's very
unfortunate.

Michal



reply via email to

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