[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unused parameter warnings
From: |
Jeffrey Walton |
Subject: |
Re: Unused parameter warnings |
Date: |
Sun, 11 Oct 2020 22:21:58 -0400 |
On Sun, Oct 11, 2020 at 7:11 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> > -static size_t
> > +static size_t _GL_ATTRIBUTE_PURE
> > gl_tree_size (gl_list_t list)
>
> Although changes like these don't break anything, I generally don't bother
> doing
> them if only older GCCs warn about a missing attribute, under the theory that
> people stuck with older compilers can build with --disable-gcc-warnings and it
> lessens the maintenance burden if we don't bloat the code with obvious detail
> that a decent compiler should deduce automatically.
For this particular warning, I find it is easier to forgo the compiler
specific attributes and then use an UNUSED macro. The UNUSED macro
works everywhere with all compilers. It also does not pollute the
function signature.
#ifndef GNULIB_UNUSED
# define GNULIB_UNUSED(x) ((void)(x))
#endif
And then:
const char*
gl_locale_name_thread_unsafe (int category, const char *categoryname)
{
GNULIB_UNUSED(category);
...
}
Jeff
- Re: Unused parameter warnings, (continued)
- Re: Unused parameter warnings, Marc Nieper-Wißkirchen, 2020/10/06
- Re: Unused parameter warnings, Bruno Haible, 2020/10/06
- Re: Unused parameter warnings, Marc Nieper-Wißkirchen, 2020/10/07
- Re: Unused parameter warnings, Bruno Haible, 2020/10/10
- Re: Unused parameter warnings, Marc Nieper-Wißkirchen, 2020/10/10
- Re: Unused parameter warnings, Bruno Haible, 2020/10/10
- Re: Unused parameter warnings, Marc Nieper-Wißkirchen, 2020/10/10
- Re: Unused parameter warnings, Paul Eggert, 2020/10/10
- Re: Unused parameter warnings, Bruno Haible, 2020/10/10
- Re: Unused parameter warnings, Paul Eggert, 2020/10/11
- Re: Unused parameter warnings,
Jeffrey Walton <=
- Re: 'const' function attribute, Bruno Haible, 2020/10/13
- Re: 'const' function attribute, Paul Eggert, 2020/10/14
- Re: 'const' function attribute, Bruno Haible, 2020/10/18
- Re: Unused parameter warnings, Bruno Haible, 2020/10/10