From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>
Subject: Re: Unused parameter warnings
Date: Mon, 05 Oct 2020 00:08:44 +0200 [thread overview]
Message-ID: <3883129.xPQGiW7nDS@omega> (raw)
In-Reply-To: <CAEYrNrReJrFvgzS+A42p+dR8ByWEyDeRzU3jhu2k+2LnWvsMUg@mail.gmail.com>
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;
next prev parent reply other threads:[~2020-10-04 22:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-04 20:23 Unused parameter warnings Marc Nieper-Wißkirchen
2020-10-04 22:08 ` Bruno Haible [this message]
2020-10-06 5:58 ` Marc Nieper-Wißkirchen
2020-10-06 21:05 ` Bruno Haible
2020-10-07 6:07 ` Marc Nieper-Wißkirchen
2020-10-10 13:50 ` Bruno Haible
2020-10-10 14:31 ` Marc Nieper-Wißkirchen
2020-10-10 14:39 ` Bruno Haible
2020-10-10 15:00 ` Marc Nieper-Wißkirchen
2020-10-10 18:50 ` Paul Eggert
2020-10-10 21:00 ` Bruno Haible
2020-10-11 23:10 ` Paul Eggert
2020-10-12 2:21 ` Jeffrey Walton
2020-10-14 1:24 ` 'const' function attribute Bruno Haible
2020-10-14 14:57 ` Paul Eggert
2020-10-18 14:27 ` Bruno Haible
2020-10-10 20:43 ` Unused parameter warnings Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3883129.xPQGiW7nDS@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=marc.nieper+gnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).