bug-gnulib
[Top][All Lists]
Advanced

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

Re: Unused parameter warnings


From: Marc Nieper-Wißkirchen
Subject: Re: Unused parameter warnings
Date: Tue, 6 Oct 2020 07:58:55 +0200

Thank you! This works perfectly now.

In the meantime, my GCC has reported another warning here.

In file included from lib/gl_linked_list.c:29:
lib/gl_linked_list.c: In function 'gl_linked_iterator_from_to':
lib/gl_anylinked_list2.h:938:1: error: function might be candidate for
attribute 'pure' if it is known to return normally
[-Werror=suggest-attribute=pure]
  938 | gl_linked_iterator_from_to (gl_list_t list,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

Marc

Am Mo., 5. Okt. 2020 um 00:08 Uhr schrieb Bruno Haible <bruno@clisp.org>:
>
> Hi Marc,
>
> Marc Nieper-Wißkirchen wrote:
> > When compiling Gnulib with -Wunused-parameter, I get the following
> > report from GCC:
> >
> > lib/localename.c: In function 'gl_locale_name_thread_unsafe':
> > lib/localename.c:3117:57: error: unused parameter 'categoryname'
> > [-Werror=unused-parameter]
> >  3117 | gl_locale_name_thread_unsafe (int category, const char 
> > *categoryname)
> >       |                                             ~~~~~~~~~~~~^~~~~~~~~~~~
> > lib/localename.c: In function 'gl_locale_name_posix':
> > lib/localename.c:3256:49: error: unused parameter 'categoryname'
> > [-Werror=unused-parameter]
> >  3256 | gl_locale_name_posix (int category, const char *categoryname)
> >       |                                     ~~~~~~~~~~~~^~~~~~~~~~~~
> > lib/localename.c: In function 'gl_locale_name_environ':
> > lib/localename.c:3321:29: error: unused parameter 'category'
> > [-Werror=unused-parameter]
> >  3321 | gl_locale_name_environ (int category, const char *categoryname)
> >       |                         ~~~~^~~~~~~~
> >
> > Wouldn't it make sense to insert MAYBE_UNUSED from "attribute.h" here?
>
> Yes. -Wunused-parameter is part of -Wall, unfortunately. Sigh.
>
> Here I prefer _GL_UNUSED, because it does not require '#include 
> "attribute.h"'.
>
>
> 2020-10-04  Bruno Haible  <bruno@clisp.org>
>
>         localename: Fix a couple of "unused parameter" warnings.
>         Reported by Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> in
>         <https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00014.html>.
>         * lib/localename.c (gl_locale_name_thread_unsafe, 
> gl_locale_name_thread,
>         gl_locale_name_posix, gl_locale_name_environ): Add _GL_UNUSED in
>         parameter list.
>
> diff --git a/lib/localename.c b/lib/localename.c
> index 5731ceb..1bf47ed 100644
> --- a/lib/localename.c
> +++ b/lib/localename.c
> @@ -3114,7 +3114,7 @@ freelocale (locale_t locale)
>  static
>  # endif
>  const char *
> -gl_locale_name_thread_unsafe (int category, const char *categoryname)
> +gl_locale_name_thread_unsafe (int category, const char *categoryname 
> _GL_UNUSED)
>  {
>  # if HAVE_GOOD_USELOCALE
>    {
> @@ -3229,7 +3229,7 @@ gl_locale_name_thread_unsafe (int category, const char 
> *categoryname)
>  #endif
>
>  const char *
> -gl_locale_name_thread (int category, const char *categoryname)
> +gl_locale_name_thread (int category, const char *categoryname _GL_UNUSED)
>  {
>  #if HAVE_GOOD_USELOCALE
>    const char *name = gl_locale_name_thread_unsafe (category, categoryname);
> @@ -3253,7 +3253,7 @@ gl_locale_name_thread (int category, const char 
> *categoryname)
>  #endif
>
>  const char *
> -gl_locale_name_posix (int category, const char *categoryname)
> +gl_locale_name_posix (int category, const char *categoryname _GL_UNUSED)
>  {
>  #if defined WINDOWS_NATIVE
>    if (LC_MIN <= category && category <= LC_MAX)
> @@ -3318,7 +3318,7 @@ gl_locale_name_posix (int category, const char 
> *categoryname)
>  }
>
>  const char *
> -gl_locale_name_environ (int category, const char *categoryname)
> +gl_locale_name_environ (int category _GL_UNUSED, const char *categoryname)
>  {
>    const char *retval;
>
>



reply via email to

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