Bruno Haible <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> 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 agree regarding gnulib's public .h files. I'll handle unistr.h. > >> although I admit to disliking the seemingly necessary duplication of >> the snippet to define __attribute__. > > One could define __attribute__, or a special-purpose macro, in an extra > module. But then keeping track of the module dependency is some work. > It's easier to define it in generated config.h always. > > I propose this. A special-purpose macro called _UNUSED_PARAMETER_ is as > understandable as is __attribute__ ((__unused__)), and may accomodate other > compilers (whereas #defining __attribute__ is gcc specific).
It's a trade off. "stand-alone" usability (i.e., outside of gnulib context) vs. maintainability. I've learned that as gnulib matures, the value of the former is diminishing. > gcc 2.7.2.3 already supported __attribute__ ((__unused__)), as far as I can > see. > > 2008-10-18 Bruno Haible <[EMAIL PROTECTED]> > > Avoid -Wunused-parameter warnings in public gnulib header files. > * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _UNUSED_PARAMETER_ as a > macro. > * lib/unistr.h (u32_mbtouc_unsafe, u32_mbtouc): Use it. This is a good change. Whether to replace all existing __attribute__ ((__attribute__)) uses with _UNUSED_PARAMETER_ is a harder call.