bug-gnulib
[Top][All Lists]
Advanced

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

Re: "unused parameter" warnings


From: Jim Meyering
Subject: Re: "unused parameter" warnings
Date: Sat, 18 Oct 2008 17:30:05 +0200

Bruno Haible <address@hidden> wrote:
> Reuben Thomas wrote:
>> gl_anylinked_list2.h: In function ‘gl_linked_node_value’:
>> gl_anylinked_list2.h:124: warning: unused parameter ‘list’
>> gl_anylinked_list2.h: In function ‘gl_linked_node_set_value’:
>> gl_anylinked_list2.h:130: warning: unused parameter ‘list’
>> gl_anylinked_list2.h: In function ‘gl_linked_iterator_free’:
>> gl_anylinked_list2.h:910: warning: unused parameter ‘iterator’
>
> This is only a small part of the effects of '-Wunused-parameter'. Over
> all gnulib, it yields warnings in 289 places, when compiling on Linux.
> See attached log.
>
> You can see that
>   - 10 of these warnings alone are from the regex module, which we borrow
>     from glibc, and for which we try to minimize the differences to glibc.
>   - Many unit tests have a 'main' function which ignores argc and argv;
>     there is nothing to warn about.
>   - Some of the functions are defined as callbacks, so it is normal that
>     the body does not use all parameters.
>   - None of the warnings points to a real problem.
>
> Therefore I find it best to ignore this warning.

I understand the sentiment, and it is fine in relatively stable
and carefully-reviewed code.

However, it would be good to accept patches (at least for gnulib's .h
files) that mark each unused parameter with __attribute__ ((__unused__)).
Then, a project that requires use of -Wunused-parameter can use gnulib's
headers without having to relax their standards.

I will accept such patches for the parts I own (both .c and .h files),
although I admit to disliking the seemingly necessary duplication of
the snippet to define __attribute__.




reply via email to

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