bug-gnulib
[Top][All Lists]
Advanced

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

Re: Unused parameter warnings


From: Bruno Haible
Subject: Re: Unused parameter warnings
Date: Mon, 05 Oct 2020 00:08:44 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

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]