[Top][All Lists]

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

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

From: Eric Blake
Subject: Re: [PATCH] Avoid one "parameter unused" warnings.
Date: Tue, 2 Jan 2018 15:41:35 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 01/01/2018 03:55 AM, Bruno Haible wrote:
> Hi,
> Michal Privoznik wrote:
>> diff --git a/lib/stat-time.h b/lib/stat-time.h
>> index 5f8bf4e12..11acbfb1f 100644
>> --- a/lib/stat-time.h
>> +++ b/lib/stat-time.h
>> @@ -244,6 +244,8 @@ stat_time_normalize (int result, struct stat *st)
>>          }
>>      }
>>  #endif
>> +  /* Avoid a "parameter unused" warning.  */
>> +  (void) st;
>>    return result;
>>  }
> Thanks, but this was already discussed and rejected recently:
> https://lists.gnu.org/archive/html/bug-gnulib/2017-12/msg00078.html

Compiling gnulib .c files with -Wno-unused-parameter makes total sense
to me (we already recommend that projects use a smaller set of -W for
gnulib .c files than for their own files, if they like a particularly
strict warning).  But for inline functions in .h files, where we have
less control of which -W options are in effect, it makes more sense to
me to accept some form of patch to shut up the compiler.  I'm not sure
that a cast-to-void is the best approach, or if we can add some compiler
attribute instead of a pragma to push/pop a temporary warning
relaxation, but I'm not sure we should discard this patch wholesale
merely because not all projects  use -Wunused-parameter.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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