bug-gnulib
[Top][All Lists]
Advanced

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

Re: fopen: Silence a gcc warning


From: Bruno Haible
Subject: Re: fopen: Silence a gcc warning
Date: Tue, 02 May 2023 21:06:53 +0200

Jeffrey Walton wrote:
> > +  /* open_direction is sometimes used, sometimes unused.
> > +     Silence gcc's warning about this situation.  */
> > +  (void) open_direction;
> > +
> >    return orig_fopen (filename, mode);
> >  }
> 
> It may be a good idea to hide it behind a self-documenting macro:
> 
>     #define GNULIB_MAYBE_UNUSED(x) ((void)(x))
>     ...
> 
>     GNULIB_MAYBE_UNUSED(open_direction);

Possibly. We already have a MAYBE_UNUSED macro in attribute.h. And a
module 'ignore-value'. Among these 3 choices, I picked the direct
void-cast as the simplest one.

Bruno






reply via email to

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