Jim Meyering wrote:
> I wrote these changes some time ago, and
> am going to push them shortly.
>
> +#undef UNUSED_PARAM
> +#ifdef __linux__
> +# define UNUSED_PARAM _UNUSED_PARAMETER_
> +#else
> +# define UNUSED_PARAM
> +#endif
> +
> ...
> 
> +#undef UNUSED_PARAM
> +#ifdef GETFSTYP
> +# define UNUSED_PARAM
> +#else
> +# define UNUSED_PARAM _UNUSED_PARAMETER_
> +#endif
> +

Now this gets really ugly. Not only because a macro with the same name is being
undefined and redefined repeatedly, but also because the #if conditions for
this macro must be the same as the #if conditions inside the function's body.
When they get out of sync, the warning will reappear.

The other way to silence this warning is a statement
  (void)param;
in the function's body. (Or was there some problem with that? I just tested
gcc 2.95.3 to 4.3.2, and in all versions such a void cast makes the warning
disappear.)

Bottom line: Whenever the _UNUSED_PARAMETER_ macro cannot be used
unconditionally, I would use a cast to void.

Bruno


Reply via email to