bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / code / Atom feed
* Using C2x attributes more effectively in Gnulib
@ 2021-07-31 19:52 Paul Eggert
  2021-08-08  1:40 ` Bruno Haible
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2021-07-31 19:52 UTC (permalink / raw)
  To: Gnulib bugs

Because draft C2x requires using [[maybe_unused]] before a parameter 
instead of after, the recent C2x-related changes to Gnulib caused me to 
move all uses of _GL_UNUSED_PARAMETER; and while I was at it I changed 
it to _GL_ATTRIBUTE_MAYBE_UNUSED FILE thus removing a dependency on the 
snippet/unused-parameter module. For example:

   SE_SELINUX_INLINE int
  -fsetfilecon (int fd _GL_UNUSED_PARAMETER,
  -             char const *con _GL_UNUSED_PARAMETER)
  +fsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED int fd,
  +             _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
     { errno = ENOTSUP; return -1; }

A nice property of the change is that the text lines up a bit better. 
However, _GL_ATTRIBUTE_MAYBE_UNUSED is too long, so I propose we rename 
it to something shorter.

Also, draft C2x lets one write the above function without naming the 
parameters, as follows:

   SE_SELINUX_INLINE int
   fsetfilecon (int, char const *)
     { errno = ENOTSUP; return -1; }

This is nicer than [[maybe_unused]], because it says the arguments are 
*definitely* unused instead of merely *maybe* unused, and that allows a 
bit more checking of the code.

So, how about the following ideas:

* Rename _GL_ATTRIBUTE_MAYBE_UNUSED to _GL_maybe_unused. Similarly for 
_GL_deprecated, _GL_fallthrough, and _GL_nodiscard. As C2x becomes more 
popular, it'll be easy to read _GL_deprecated as shorthand for 
"[[deprecated]] if supported, empty otherwise". Using lowercase in the 
macro names helps readability and will help avoid collisions between 
future C2x-like attributes and other Gnulib macros.

* Remove all uses of _GL_UNUSED after arguments in Gnulib, replacing 
them with _GL_maybe_unused before arguments. This will support non-GCC 
C2x compilers better.  Deprecate _GL_UNUSED.

* Define a macro _GL_UNUSED_ARG(TYPE, NAME) that expands to 'TYPE' in 
draft C2x, and to '_GL_maybe_unused TYPE NAME' otherwise. That way, one 
can write:

   SE_SELINUX_INLINE int
   fsetfilecon (_GL_UNUSED_ARG (int, fd),
                _GL_UNUSED_ARG (char const *, con))
     { errno = ENOTSUP; return -1; }

* Define a macro _GL_UNUSED_ARGNAME(NAME) that expands to NAME if not 
draft C2x, empty otherwise. Programs can use this macro for complicated 
argument types where _GL_UNUSED_ARG does not suffice, e.g., 
'_GL_maybe_unused int (*_GL_UNUSED_ARGNAME (p)) (int)'.

* Remove the snippet/unused-parameter module as it's not used now.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using C2x attributes more effectively in Gnulib
  2021-07-31 19:52 Using C2x attributes more effectively in Gnulib Paul Eggert
@ 2021-08-08  1:40 ` Bruno Haible
  2021-08-09 10:08   ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2021-08-08  1:40 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Paul Eggert

Hi Paul,

> Because draft C2x requires using [[maybe_unused]] before a parameter 
> instead of after, the recent C2x-related changes to Gnulib caused me to 
> move all uses of _GL_UNUSED_PARAMETER

Agreed. We should follow standards. The new standard picked a different
position for the marker than what we used to have.

> _GL_ATTRIBUTE_MAYBE_UNUSED is too long, so I propose we rename 
> it to something shorter.

In implementation code, it is more convenient to include "attribute.h" and
then use MAYBE_UNUSED. The names with _GL_ prefix are, IMO, only for
places where including "attribute.h" is not desired, namely in public
header files. And in public header files we don't have many function
definitions that ignore some arguments. It's basically only
  lib/se-context.in.h
  lib/se-label.in.h
  lib/se-selinux.in.h
IMO that's not enough justification for introducing a new name for
_GL_ATTRIBUTE_MAYBE_UNUSED.

> Also, draft C2x lets one write the above function without naming the 
> parameters, as follows:
> 
>    SE_SELINUX_INLINE int
>    fsetfilecon (int, char const *)
>      { errno = ENOTSUP; return -1; }
> 
> This is nicer than [[maybe_unused]], because it says the arguments are 
> *definitely* unused instead of merely *maybe* unused, and that allows a 
> bit more checking of the code.

I disagree on this one. For a human reader who wants to understand the code,
the parameter name is more important than its type. Therefore, for
maintainability your example should better read

     SE_SELINUX_INLINE int
     fsetfilecon (fd, context)
       { errno = ENOTSUP; return -1; }

In other words, it is a misfeature in the standard. They have designed
this language feature from the perspective what the compiler needs in
order to generate machine code, not from the perspective of the programmer
and maintainability.

So, we should better not use this misfeature.

> So, how about the following ideas:
> 
> * Rename _GL_ATTRIBUTE_MAYBE_UNUSED to _GL_maybe_unused. Similarly for 
> _GL_deprecated, _GL_fallthrough, and _GL_nodiscard.

Ohhhhhh. This breaks a decades-long convention. We have the convention
in GNU that macro names are upper case, to distinguish them from function
and variable names. This is good convention.

I have personally used mixed-case macro names in GNU clisp, and I can
assert (in hindsight) that it did *not* contribute to maintainability.

> As C2x becomes more 
> popular, it'll be easy to read _GL_deprecated as shorthand for 
> "[[deprecated]] if supported, empty otherwise".

Whether the expansion is mainly lowercase or not, is irrelevant.
Breaking said convention is not good.

> * Remove all uses of _GL_UNUSED after arguments in Gnulib, replacing 
> them with _GL_maybe_unused before arguments. This will support non-GCC 
> C2x compilers better.  Deprecate _GL_UNUSED.

Hmm. This _GL_UNUSED macro is used a lot in .c code, simply because it
it short (and the "maybe" in _GL_ATTRIBUTE_MAYBE_UNUSED is more of a
compiler technicality). I'm OK with moving all _GL_UNUSED from after
the parameter declaration to before the parameter declaration. Then
we can continue to have
  #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED

> * Define a macro _GL_UNUSED_ARG(TYPE, NAME) that expands to 'TYPE' in 
> draft C2x, and to '_GL_maybe_unused TYPE NAME' otherwise. That way, one 
> can write:
> 
>    SE_SELINUX_INLINE int
>    fsetfilecon (_GL_UNUSED_ARG (int, fd),
>                 _GL_UNUSED_ARG (char const *, con))
>      { errno = ENOTSUP; return -1; }

Such macros with type parameters have two problems:

  * Maintainability problem: The reader needs to understand the macro
    first, before they can understand the declaration.
    Whereas when the declaration reads

       SE_SELINUX_INLINE int
       fsetfilecon (_GL_UNUSED int fd, _GL_UNUSED char const *con)

    the reader understands 70% of the syntax and can treat _GL_UNUSED
    as "some token I don't need to know about".

  * It doesn't apply to function types that are not typedefs. How would
    you write

              int foo (_GL_UNUSED int (*p) (const void *) )

    ?

> * Define a macro _GL_UNUSED_ARGNAME(NAME) that expands to NAME if not 
> draft C2x, empty otherwise. Programs can use this macro for complicated 
> argument types where _GL_UNUSED_ARG does not suffice, e.g., 
> '_GL_maybe_unused int (*_GL_UNUSED_ARGNAME (p)) (int)'.

I object for two reasons:
  - it's a macro with type parameter (see above),
  - its purpose is just to make use of a misfeature in the language (see
    above as well).

> * Remove the snippet/unused-parameter module as it's not used now.

Indeed, this module is unused in gnulib. It may be used in packages that
use gnulib; therefore I vote for marking it 'obsolete' and remove it only
in a year or two.

Bruno



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using C2x attributes more effectively in Gnulib
  2021-08-08  1:40 ` Bruno Haible
@ 2021-08-09 10:08   ` Paul Eggert
  2021-08-22 13:33     ` Bruno Haible
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Eggert @ 2021-08-09 10:08 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib

On 8/7/21 6:40 PM, Bruno Haible wrote:

>> Also, draft C2x lets one write the above function without naming the
>> parameters, as follows:
>>
>>     SE_SELINUX_INLINE int
>>     fsetfilecon (int, char const *)
>>       { errno = ENOTSUP; return -1; }
>>
>> This is nicer than [[maybe_unused]], because it says the arguments are
>> *definitely* unused instead of merely *maybe* unused, and that allows a
>> bit more checking of the code.
> 
> I disagree on this one. For a human reader who wants to understand the code,
> the parameter name is more important than its type.

OK, perhaps this would do instead (assuming C2x):

     SE_SELINUX_INLINE int
     fsetfilecon (int /*fd*/, char const * /*context*/)
       { errno = ENOTSUP; return -1; }
> they have designed
> this language feature from the perspective what the compiler needs in
> order to generate machine code

It's more than just machine code. It's telling the reader that the 
arguments are definitely unused. This gives the reader more information 
than [[maybe_unused]] does.

It's a C2x feature I find helpful from a readability point of view, 
since I find the names to be clutter in situations like these. Indeed, 
I'd rather see something like this:

   SE_SELINUX_INLINE fsetfilecon { errno = ENOTSUP; return -1; }

since setfilecon's signature (which I can easily navigate to, or ask 
about) tells me all I need to know about the API that doesn't matter here.

Admittedly readability tastes differ.

> I have personally used mixed-case macro names in GNU clisp, and I can
> assert (in hindsight) that it did *not* contribute to maintainability.

Fair enough; let's stick to uppercase.

> Hmm. This _GL_UNUSED macro is used a lot in .c code, simply because it
> it short (and the "maybe" in _GL_ATTRIBUTE_MAYBE_UNUSED is more of a
> compiler technicality).

It's not merely a technicality. I often write code where an argument may 
be unused, in the sense that there's an ifdef where it's used on some 
platforms but not others. MAYBE_UNUSED is helpful in this situations.

> I'm OK with moving all _GL_UNUSED from after
> the parameter declaration to before the parameter declaration. Then
> we can continue to have
>    #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED

Yes, this sounds like a win. It's a lot simpler than my proposal. 
Although it loses a bit of information when the arg is definitely 
unused, perhaps that's not worth worrying about.

>> * Remove the snippet/unused-parameter module as it's not used now.
> 
> Indeed, this module is unused in gnulib. It may be used in packages that
> use gnulib; therefore I vote for marking it 'obsolete' and remove it only
> in a year or two.

Sounds good to me too.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using C2x attributes more effectively in Gnulib
  2021-08-09 10:08   ` Paul Eggert
@ 2021-08-22 13:33     ` Bruno Haible
  2021-08-22 20:05     ` gnulib-common.m4: Use C2x [[maybe_unused]] when possible Bruno Haible
  2021-08-23  1:06     ` snippet/unused-parameter: Mark unused module obsolete Bruno Haible
  2 siblings, 0 replies; 6+ messages in thread
From: Bruno Haible @ 2021-08-22 13:33 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

Paul Eggert wrote:
> >> Also, draft C2x lets one write the above function without naming the
> >> parameters, as follows:
> >>
> >>     SE_SELINUX_INLINE int
> >>     fsetfilecon (int, char const *)
> >>       { errno = ENOTSUP; return -1; }
> >>
> >> This is nicer than [[maybe_unused]], because it says the arguments are
> >> *definitely* unused instead of merely *maybe* unused, and that allows a
> >> bit more checking of the code.
> > 
> > I disagree on this one. For a human reader who wants to understand the code,
> > the parameter name is more important than its type.
> 
> OK, perhaps this would do instead (assuming C2x):
> 
>      SE_SELINUX_INLINE int
>      fsetfilecon (int /*fd*/, char const * /*context*/)
>        { errno = ENOTSUP; return -1; }

Yes, this style is fine with me. The human reader understands what each
argument designates.

> > they have designed
> > this language feature from the perspective what the compiler needs in
> > order to generate machine code
> 
> It's more than just machine code. It's telling the reader that the 
> arguments are definitely unused. This gives the reader more information 
> than [[maybe_unused]] does.

True. But I dislike that there is no [[unused]] / [[definitely_unused]] marker;
they have picked a completely different syntax for the unused parameter than
for [[maybe_unused]].

Also, I think/hope that [[maybe_unused]] will not be used in .h files, only
in .c files. Then, in .c files we can #include "attributes.h".

> It's a C2x feature I find helpful from a readability point of view, 
> since I find the names to be clutter in situations like these. Indeed, 
> I'd rather see something like this:
> 
>    SE_SELINUX_INLINE fsetfilecon { errno = ENOTSUP; return -1; }
> 
> since setfilecon's signature (which I can easily navigate to, or ask 
> about) tells me all I need to know about the API that doesn't matter here.

This syntax — defining a function without specifying its prototype — looks
quite odd in C.

By the way, the "which I can easily navigate to" idea is fallacious: It leads
to programming languages that _depend_ on a development environment. Yes, in
a development environment you can easily navigate between declaration and
definition. However, it is frequent to consider patch files sent by mail,
to do temporary edits on remote machines where no development environment is
installed, or [not in GNU, but elsewhere] to perform code reviews through
a web-based interface. In these cases the user doesn't have a development
environment.

> > I have personally used mixed-case macro names in GNU clisp, and I can
> > assert (in hindsight) that it did *not* contribute to maintainability.
> 
> Fair enough; let's stick to uppercase.

Thanks.

> > I'm OK with moving all _GL_UNUSED from after
> > the parameter declaration to before the parameter declaration. Then
> > we can continue to have
> >    #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
> 
> Yes, this sounds like a win. It's a lot simpler than my proposal. 
> Although it loses a bit of information when the arg is definitely 
> unused, perhaps that's not worth worrying about.

OK, I'll do that.

> >> * Remove the snippet/unused-parameter module as it's not used now.
> > 
> > Indeed, this module is unused in gnulib. It may be used in packages that
> > use gnulib; therefore I vote for marking it 'obsolete' and remove it only
> > in a year or two.
> 
> Sounds good to me too.

I'll do that too.

Bruno





^ permalink raw reply	[flat|nested] 6+ messages in thread

* gnulib-common.m4: Use C2x [[maybe_unused]] when possible
  2021-08-09 10:08   ` Paul Eggert
  2021-08-22 13:33     ` Bruno Haible
@ 2021-08-22 20:05     ` Bruno Haible
  2021-08-23  1:06     ` snippet/unused-parameter: Mark unused module obsolete Bruno Haible
  2 siblings, 0 replies; 6+ messages in thread
From: Bruno Haible @ 2021-08-22 20:05 UTC (permalink / raw)
  To: bug-gnulib, Paul Eggert

Paul Eggert wrote:
> > I'm OK with moving all _GL_UNUSED from after
> > the parameter declaration to before the parameter declaration. Then
> > we can continue to have
> >    #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
> 
> Yes, this sounds like a win. It's a lot simpler than my proposal. 
> Although it loses a bit of information when the arg is definitely 
> unused, perhaps that's not worth worrying about.

Done through this patch.


2021-08-22  Bruno Haible  <bruno@clisp.org>

	gnulib-common.m4: Use C2x [[maybe_unused]] when possible.
	* m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of
	_GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED.
	* lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the
	declaration.
	* lib/c-stack.c (null_action, segv_handler, overflow_handler,
	c_stack_action): Likewise.
	* lib/chown.c (chown): Likewise.
	* lib/clean-temp-simple.c (cleanup_action): Likewise.
	* lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization,
	fts_set): Likewise.
	* lib/getgroups.c (getgroups): Likewise.
	* lib/getopt.c (_getopt_initialize): Likewise.
	* lib/getugroups.c (getugroups): Likewise.
	* lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread,
	gl_locale_name_posix, gl_locale_name_environ): Likewise.
	* lib/mkdir.c (rpl_mkdir): Likewise.
	* lib/mkfifo.c (mkfifo): Likewise.
	* lib/mkfifoat.c (mkfifoat): Likewise.
	* lib/mknod.c (mknod): Likewise.
	* lib/mknodat.c (mknodat): Likewise.
	* lib/mountlist.c (me_remote): Likewise.
	* lib/openpty.c (openpty): Likewise.
	* lib/parse-datetime.y (yyerror): Likewise.
	* lib/passfd.c (sendfd, recvfd): Likewise.
	* lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init,
	pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal,
	pthread_cond_broadcast, pthread_cond_destroy): Likewise.
	* lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init,
	pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock,
	pthread_mutex_unlock, pthread_mutex_destroy): Likewise.
	* lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init,
	pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise.
	* lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock,
	pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy):
	Likewise.
	* lib/pthread-thread.c (pthread_attr_destroy): Likewise.
	* lib/readlink.c (readlink): Likewise.
	* lib/rename.c (rpl_rename): Likewise.
	* lib/set-permissions.c (set_permissions): Likewise.
	* lib/sockets.c (gl_sockets_startup): Likewise.
	* lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime,
	stat_time_normalize): Likewise.
	* lib/strptime.c (__strptime_internal): Likewise.
	* lib/strtod.c (LDEXP): Likewise.
	* lib/symlink.c (symlink): Likewise.
	* lib/symlinkat.c (symlinkat): Likewise.
	* lib/tempname.c (try_dir, try_nocreate): Likewise.
	* lib/textstyle.in.h (styled_ostream_begin_use_class,
	styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref,
	styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink,
	styled_ostream_flush_to_current_style, fd_ostream_create,
	term_ostream_get_color, term_ostream_set_color,
	term_ostream_get_bgcolor, term_ostream_set_bgcolor,
	term_ostream_get_weight, term_ostream_set_weight,
	term_ostream_get_posture, term_ostream_set_posture,
	term_ostream_get_underline, term_ostream_set_underline,
	term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id,
	term_ostream_set_hyperlink, term_ostream_create,
	term_styled_ostream_create, html_styled_ostream_create,
	handle_color_option, handle_style_option, style_file_prepare,
	styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise.
	* lib/unicodeio.c (exit_failure_callback, fallback_failure_callback):
	Likewise.
	* lib/wait-process.c (cleanup_slaves_action): Likewise.
	* tests/signature.h (SIGNATURE_CHECK2): Likewise.
	* tests/test-areadlink.c (do_areadlink): Likewise.
	* tests/test-areadlinkat.c (do_areadlinkat): Likewise.
	* tests/test-ceilf-ieee.c (main): Likewise.
	* tests/test-ceilf1.c (main): Likewise.
	* tests/test-dirent.c (dir): Likewise.
	* tests/test-fchownat.c (main): Likewise.
	* tests/test-fdopendir.c (main): Likewise.
	* tests/test-filenamecat.c (main): Likewise.
	* tests/test-floor1.c (main): Likewise.
	* tests/test-floorf-ieee.c (main): Likewise.
	* tests/test-floorf1.c (main): Likewise.
	* tests/test-fseeko.c (main): Likewise.
	* tests/test-fstatat.c (main): Likewise.
	* tests/test-ftello.c (main): Likewise.
	* tests/test-getdomainname.c (main): Likewise.
	* tests/test-getgroups.c (main): Likewise.
	* tests/test-gethostname.c (main): Likewise.
	* tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise.
	* tests/test-mkdirat.c (main): Likewise.
	* tests/test-openat.c (main): Likewise.
	* tests/test-parse-datetime.c (main): Likewise.
	* tests/test-quotearg-simple.c (main): Likewise.
	* tests/test-quotearg.c (main): Likewise.
	* tests/test-sethostname2.c (main): Likewise.
	* tests/test-unlinkat.c (main): Likewise.
	* tests/test-version-etc.c (main): Likewise.
	* tests/test-xalloc-die.c (main): Likewise.
	* tests/test-xfprintf-posix.c (main): Likewise.
	* tests/test-xprintf-posix.c (main): Likewise.
	* tests/test-xvasprintf.c (main): Likewise.

diff --git a/lib/binary-io.h b/lib/binary-io.h
index 0fa8d546f..642f08b1b 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -47,7 +47,7 @@ _GL_INLINE_HEADER_BEGIN
   /* Use a function rather than a macro, to avoid gcc warnings
      "warning: statement with no effect".  */
 BINARY_IO_INLINE int
-__gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED)
+__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode)
 {
   return O_BINARY;
 }
diff --git a/lib/c-stack.c b/lib/c-stack.c
index 1965bdd0c..5540cc112 100644
--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -126,7 +126,7 @@ die (int signo)
 }
 
 static _GL_ASYNC_SAFE void
-null_action (int signo _GL_UNUSED)
+null_action (_GL_UNUSED int signo)
 {
 }
 
@@ -142,7 +142,7 @@ static volatile int segv_handler_missing;
    overflow.  This function is async-signal-safe.  */
 
 static _GL_ASYNC_SAFE int
-segv_handler (void *address _GL_UNUSED, int serious)
+segv_handler (_GL_UNUSED void *address, int serious)
 {
 # if DEBUG
   {
@@ -165,7 +165,7 @@ segv_handler (void *address _GL_UNUSED, int serious)
    overflow and exit.  This function is async-signal-safe.  */
 
 static _GL_ASYNC_SAFE _Noreturn void
-overflow_handler (int emergency, stackoverflow_context_t context _GL_UNUSED)
+overflow_handler (int emergency, _GL_UNUSED stackoverflow_context_t context)
 {
 # if DEBUG
   {
@@ -205,7 +205,7 @@ c_stack_action (_GL_ASYNC_SAFE void (*action) (int))
 #else /* !HAVE_STACK_OVERFLOW_RECOVERY */
 
 int
-c_stack_action (_GL_ASYNC_SAFE void (*action) (int)  _GL_UNUSED)
+c_stack_action (_GL_ASYNC_SAFE void (*action) (_GL_UNUSED int) )
 {
   errno = ENOTSUP;
   return -1;
diff --git a/lib/chown.c b/lib/chown.c
index 101c4dc6b..335c31d03 100644
--- a/lib/chown.c
+++ b/lib/chown.c
@@ -33,8 +33,8 @@
 
 /* Simple stub that always fails with ENOSYS, for mingw.  */
 int
-chown (const char *file _GL_UNUSED, uid_t uid _GL_UNUSED,
-       gid_t gid _GL_UNUSED)
+chown (_GL_UNUSED const char *file, _GL_UNUSED uid_t uid,
+       _GL_UNUSED gid_t gid)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/clean-temp-simple.c b/lib/clean-temp-simple.c
index 4a9c42778..30b41b7ed 100644
--- a/lib/clean-temp-simple.c
+++ b/lib/clean-temp-simple.c
@@ -184,7 +184,7 @@ clean_temp_init_asyncsafe_close (void)
 
 /* The signal handler.  It gets called asynchronously.  */
 static _GL_ASYNC_SAFE void
-cleanup_action (int sig _GL_UNUSED)
+cleanup_action (_GL_UNUSED int sig)
 {
   size_t i;
 
diff --git a/lib/foo.c b/lib/foo.c
new file mode 100644
index 000000000..bf409c677
--- /dev/null
+++ b/lib/foo.c
@@ -0,0 +1,11 @@
+int foo (int x)
+{
+  x += 2;
+  if (x & 1)
+    goto a;
+b:
+__attribute__ ((__maybe_unused__));
+  x *= 3;
+a:
+  return x;
+}
diff --git a/lib/foo.s b/lib/foo.s
new file mode 100644
index 000000000..7e6fa5df0
--- /dev/null
+++ b/lib/foo.s
@@ -0,0 +1,40 @@
+	.text
+	.file	"foo.c"
+	.globl	_Z3fooi                         # -- Begin function _Z3fooi
+	.p2align	4, 0x90
+	.type	_Z3fooi,@function
+_Z3fooi:                                # @_Z3fooi
+	.cfi_startproc
+# %bb.0:
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+	movl	%edi, -4(%rbp)
+	movl	-4(%rbp), %eax
+	addl	$2, %eax
+	movl	%eax, -4(%rbp)
+	movl	-4(%rbp), %eax
+	andl	$1, %eax
+	cmpl	$0, %eax
+	je	.LBB0_2
+# %bb.1:
+	jmp	.LBB0_4
+.LBB0_2:
+	jmp	.LBB0_3
+.LBB0_3:
+	imull	$3, -4(%rbp), %eax
+	movl	%eax, -4(%rbp)
+.LBB0_4:
+	movl	-4(%rbp), %eax
+	popq	%rbp
+	.cfi_def_cfa %rsp, 8
+	retq
+.Lfunc_end0:
+	.size	_Z3fooi, .Lfunc_end0-_Z3fooi
+	.cfi_endproc
+                                        # -- End function
+	.ident	"clang version 11.0.0"
+	.section	".note.GNU-stack","",@progbits
+	.addrsig
diff --git a/lib/fts.c b/lib/fts.c
index e6603f40e..31ff21d00 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -813,13 +813,13 @@ leaf_optimization (FTSENT const *p, int dir_fd)
 
 #else
 static bool
-dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED,
-                                 int dir_fd _GL_UNUSED)
+dirent_inode_sort_may_be_useful (_GL_UNUSED FTSENT const *p,
+                                 _GL_UNUSED int dir_fd)
 {
   return true;
 }
 static enum leaf_optimization
-leaf_optimization (FTSENT const *p _GL_UNUSED, int dir_fd _GL_UNUSED)
+leaf_optimization (_GL_UNUSED FTSENT const *p, _GL_UNUSED int dir_fd)
 {
   return NO_LEAF_OPTIMIZATION;
 }
@@ -1093,7 +1093,7 @@ cd_dot_dot:
  */
 /* ARGSUSED */
 int
-fts_set(FTS *sp _GL_UNUSED, FTSENT *p, int instr)
+fts_set(_GL_UNUSED FTS *sp, FTSENT *p, int instr)
 {
         if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
             instr != FTS_NOINSTR && instr != FTS_SKIP) {
diff --git a/lib/getgroups.c b/lib/getgroups.c
index 2092bd277..96665257f 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -30,7 +30,7 @@
 /* Provide a stub that fails with ENOSYS, since there is no group
    information available on mingw.  */
 int
-getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED)
+getgroups (_GL_UNUSED int n, _GL_UNUSED GETGROUPS_T *groups)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/getopt.c b/lib/getopt.c
index b1069891e..7f3aa5aa3 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -378,8 +378,8 @@ process_long_option (int argc, char **argv, const char *optstring,
 /* Initialize internal data upon the first call to getopt.  */
 
 static const char *
-_getopt_initialize (int argc _GL_UNUSED,
-		    char **argv _GL_UNUSED, const char *optstring,
+_getopt_initialize (_GL_UNUSED int argc,
+		    _GL_UNUSED char **argv, const char *optstring,
 		    struct _getopt_data *d, int posixly_correct)
 {
   /* Start processing options with ARGV-element 1 (since ARGV-element 0
diff --git a/lib/getugroups.c b/lib/getugroups.c
index 679961522..70cec63c7 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -36,10 +36,10 @@
    defined in the library.  */
 
 int
-getugroups (int maxcount _GL_UNUSED,
-            gid_t *grouplist _GL_UNUSED,
-            char const *username _GL_UNUSED,
-            gid_t gid _GL_UNUSED)
+getugroups (_GL_UNUSED int maxcount,
+            _GL_UNUSED gid_t *grouplist,
+            _GL_UNUSED char const *username,
+            _GL_UNUSED gid_t gid)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/localename.c b/lib/localename.c
index 5ee676431..9d6397730 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -3095,7 +3095,7 @@ freelocale (locale_t locale)
 static
 # endif
 const char *
-gl_locale_name_thread_unsafe (int category, const char *categoryname _GL_UNUSED)
+gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname)
 {
 # if HAVE_GOOD_USELOCALE
   {
@@ -3210,7 +3210,7 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname _GL_UNUSED)
 #endif
 
 const char *
-gl_locale_name_thread (int category, const char *categoryname _GL_UNUSED)
+gl_locale_name_thread (int category, _GL_UNUSED const char *categoryname)
 {
 #if HAVE_GOOD_USELOCALE
   const char *name = gl_locale_name_thread_unsafe (category, categoryname);
@@ -3234,7 +3234,7 @@ gl_locale_name_thread (int category, const char *categoryname _GL_UNUSED)
 #endif
 
 const char *
-gl_locale_name_posix (int category, const char *categoryname _GL_UNUSED)
+gl_locale_name_posix (int category, _GL_UNUSED const char *categoryname)
 {
 #if defined WINDOWS_NATIVE
   if (LC_MIN <= category && category <= LC_MAX)
@@ -3299,7 +3299,7 @@ gl_locale_name_posix (int category, const char *categoryname _GL_UNUSED)
 }
 
 const char *
-gl_locale_name_environ (int category _GL_UNUSED, const char *categoryname)
+gl_locale_name_environ (_GL_UNUSED int category, const char *categoryname)
 {
   const char *retval;
 
diff --git a/lib/mkdir.c b/lib/mkdir.c
index 2766cc786..0e3b60303 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -48,7 +48,7 @@
 /* This function is required at least for NetBSD 1.5.2.  */
 
 int
-rpl_mkdir (char const *dir, mode_t mode maybe_unused)
+rpl_mkdir (char const *dir, maybe_unused mode_t mode)
 {
   int ret_val;
   char *tmp_dir;
diff --git a/lib/mkfifo.c b/lib/mkfifo.c
index 1fc9d2d11..982575c2c 100644
--- a/lib/mkfifo.c
+++ b/lib/mkfifo.c
@@ -27,7 +27,7 @@
 /* Mingw lacks mkfifo; always fail with ENOSYS.  */
 
 int
-mkfifo (char const *name _GL_UNUSED, mode_t mode _GL_UNUSED)
+mkfifo (_GL_UNUSED char const *name, _GL_UNUSED mode_t mode)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mkfifoat.c b/lib/mkfifoat.c
index 785a1a761..d496e2fc4 100644
--- a/lib/mkfifoat.c
+++ b/lib/mkfifoat.c
@@ -66,8 +66,8 @@ rpl_mkfifoat (int fd, char const *file, mode_t mode)
 /* Mingw lacks mkfifo, so this wrapper is trivial.  */
 
 int
-mkfifoat (int fd _GL_UNUSED, char const *path _GL_UNUSED,
-          mode_t mode _GL_UNUSED)
+mkfifoat (_GL_UNUSED int fd, _GL_UNUSED char const *path,
+          _GL_UNUSED mode_t mode)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mknod.c b/lib/mknod.c
index 00615e71f..c54e60c97 100644
--- a/lib/mknod.c
+++ b/lib/mknod.c
@@ -27,8 +27,8 @@
 /* Mingw lacks mknod; always fail with ENOSYS.  */
 
 int
-mknod (char const *name _GL_UNUSED, mode_t mode _GL_UNUSED,
-       dev_t dev _GL_UNUSED)
+mknod (_GL_UNUSED char const *name, _GL_UNUSED mode_t mode,
+       _GL_UNUSED dev_t dev)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mknodat.c b/lib/mknodat.c
index 6d0f6773a..c0fd811fe 100644
--- a/lib/mknodat.c
+++ b/lib/mknodat.c
@@ -66,8 +66,8 @@ rpl_mknodat (int fd, char const *file, mode_t mode, dev_t dev)
 /* Mingw lacks mknod, so this wrapper is trivial.  */
 
 int
-mknodat (int fd _GL_UNUSED, char const *path _GL_UNUSED,
-         mode_t mode _GL_UNUSED, dev_t dev _GL_UNUSED)
+mknodat (_GL_UNUSED int fd, _GL_UNUSED char const *path,
+         _GL_UNUSED mode_t mode, _GL_UNUSED dev_t dev)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mountlist.c b/lib/mountlist.c
index e4c177982..adc8740bf 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -202,7 +202,7 @@
 /* All cygwin mount points include ':' or start with '//'; so it
    requires a native Windows call to determine remote disks.  */
 static bool
-me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
+me_remote (char const *fs_name, _GL_UNUSED char const *fs_type)
 {
   if (fs_name[0] && fs_name[1] == ':')
     {
diff --git a/lib/openpty.c b/lib/openpty.c
index bebe41d87..a43755326 100644
--- a/lib/openpty.c
+++ b/lib/openpty.c
@@ -37,10 +37,10 @@ rpl_openpty (int *amaster, int *aslave, char *name,
 # include <errno.h>
 
 int
-openpty (int *amaster _GL_UNUSED, int *aslave _GL_UNUSED,
-         char *name _GL_UNUSED,
-         struct termios const *termp _GL_UNUSED,
-         struct winsize const *winp _GL_UNUSED)
+openpty (_GL_UNUSED int *amaster, _GL_UNUSED int *aslave,
+         _GL_UNUSED char *name,
+         _GL_UNUSED struct termios const *termp,
+         _GL_UNUSED struct winsize const *winp)
 {
   /* Mingw lacks pseudo-terminals altogether.  */
   errno = ENOSYS;
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 552fe5c90..4149cacc3 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1544,8 +1544,8 @@ yylex (union YYSTYPE *lvalp, parser_control *pc)
 
 /* Do nothing if the parser reports an error.  */
 static int
-yyerror (parser_control const *pc _GL_UNUSED,
-         char const *s _GL_UNUSED)
+yyerror (_GL_UNUSED parser_control const *pc,
+         _GL_UNUSED char const *s)
 {
   return 0;
 }
diff --git a/lib/passfd.c b/lib/passfd.c
index a5176840d..8a3b7bd10 100644
--- a/lib/passfd.c
+++ b/lib/passfd.c
@@ -90,7 +90,7 @@ sendfd (int sock, int fd)
 }
 #else
 int
-sendfd (int sock _GL_UNUSED, int fd _GL_UNUSED)
+sendfd (_GL_UNUSED int sock, _GL_UNUSED int fd)
 {
   errno = ENOSYS;
   return -1;
@@ -201,7 +201,7 @@ recvfd (int sock, int flags)
 }
 #else
 int
-recvfd (int sock _GL_UNUSED, int flags _GL_UNUSED)
+recvfd (_GL_UNUSED int sock, _GL_UNUSED int flags)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/pthread-cond.c b/lib/pthread-cond.c
index a4c95f1a1..9ce0692e6 100644
--- a/lib/pthread-cond.c
+++ b/lib/pthread-cond.c
@@ -40,7 +40,7 @@ pthread_condattr_init (pthread_condattr_t *attr)
 }
 
 int
-pthread_condattr_destroy (pthread_condattr_t *attr _GL_UNUSED)
+pthread_condattr_destroy (_GL_UNUSED pthread_condattr_t *attr)
 {
   return 0;
 }
@@ -52,7 +52,7 @@ pthread_condattr_destroy (pthread_condattr_t *attr _GL_UNUSED)
 
 int
 pthread_cond_init (pthread_cond_t *cond,
-                   const pthread_condattr_t *attr _GL_UNUSED)
+                   _GL_UNUSED const pthread_condattr_t *attr)
 {
   return glwthread_cond_init (cond);
 }
@@ -100,16 +100,16 @@ pthread_cond_destroy (pthread_cond_t *cond)
 /* Provide a dummy implementation for single-threaded applications.  */
 
 int
-pthread_cond_init (pthread_cond_t *cond _GL_UNUSED,
-                   const pthread_condattr_t *attr _GL_UNUSED)
+pthread_cond_init (_GL_UNUSED pthread_cond_t *cond,
+                   _GL_UNUSED const pthread_condattr_t *attr)
 {
   /* COND is never seriously used.  */
   return 0;
 }
 
 int
-pthread_cond_wait (pthread_cond_t *cond _GL_UNUSED,
-                   pthread_mutex_t *mutex _GL_UNUSED)
+pthread_cond_wait (_GL_UNUSED pthread_cond_t *cond,
+                   _GL_UNUSED pthread_mutex_t *mutex)
 {
   /* No other thread can signal this condition variable.
      Wait endlessly.  */
@@ -124,8 +124,8 @@ pthread_cond_wait (pthread_cond_t *cond _GL_UNUSED,
 }
 
 int
-pthread_cond_timedwait (pthread_cond_t *cond _GL_UNUSED,
-                        pthread_mutex_t *mutex _GL_UNUSED,
+pthread_cond_timedwait (_GL_UNUSED pthread_cond_t *cond,
+                        _GL_UNUSED pthread_mutex_t *mutex,
                         const struct timespec *abstime)
 {
   /* No other thread can signal this condition variable.
@@ -176,21 +176,21 @@ pthread_cond_timedwait (pthread_cond_t *cond _GL_UNUSED,
 }
 
 int
-pthread_cond_signal (pthread_cond_t *cond _GL_UNUSED)
+pthread_cond_signal (_GL_UNUSED pthread_cond_t *cond)
 {
   /* No threads can currently be blocked on COND.  */
   return 0;
 }
 
 int
-pthread_cond_broadcast (pthread_cond_t *cond _GL_UNUSED)
+pthread_cond_broadcast (_GL_UNUSED pthread_cond_t *cond)
 {
   /* No threads can currently be blocked on COND.  */
   return 0;
 }
 
 int
-pthread_cond_destroy (pthread_cond_t *cond _GL_UNUSED)
+pthread_cond_destroy (_GL_UNUSED pthread_cond_t *cond)
 {
   /* COND is never seriously used.  */
   return 0;
diff --git a/lib/pthread-mutex.c b/lib/pthread-mutex.c
index 73c3b3449..e8f3057e3 100644
--- a/lib/pthread-mutex.c
+++ b/lib/pthread-mutex.c
@@ -77,7 +77,7 @@ pthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int robust)
 }
 
 int
-pthread_mutexattr_destroy (pthread_mutexattr_t *attr _GL_UNUSED)
+pthread_mutexattr_destroy (_GL_UNUSED pthread_mutexattr_t *attr)
 {
   return 0;
 }
@@ -207,15 +207,15 @@ pthread_mutex_destroy (pthread_mutex_t *mutex)
 /* Provide a dummy implementation for single-threaded applications.  */
 
 int
-pthread_mutex_init (pthread_mutex_t *mutex _GL_UNUSED,
-                    const pthread_mutexattr_t *attr _GL_UNUSED)
+pthread_mutex_init (_GL_UNUSED pthread_mutex_t *mutex,
+                    _GL_UNUSED const pthread_mutexattr_t *attr)
 {
   /* MUTEX is never seriously used.  */
   return 0;
 }
 
 int
-pthread_mutex_lock (pthread_mutex_t *mutex _GL_UNUSED)
+pthread_mutex_lock (_GL_UNUSED pthread_mutex_t *mutex)
 {
   /* There is only one thread, so it always gets the lock.  This
      implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
@@ -223,7 +223,7 @@ pthread_mutex_lock (pthread_mutex_t *mutex _GL_UNUSED)
 }
 
 int
-pthread_mutex_trylock (pthread_mutex_t *mutex _GL_UNUSED)
+pthread_mutex_trylock (_GL_UNUSED pthread_mutex_t *mutex)
 {
   /* There is only one thread, so it always gets the lock.  This
      implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
@@ -231,8 +231,8 @@ pthread_mutex_trylock (pthread_mutex_t *mutex _GL_UNUSED)
 }
 
 int
-pthread_mutex_timedlock (pthread_mutex_t *mutex _GL_UNUSED,
-                         const struct timespec *abstime _GL_UNUSED)
+pthread_mutex_timedlock (_GL_UNUSED pthread_mutex_t *mutex,
+                         _GL_UNUSED const struct timespec *abstime)
 {
   /* There is only one thread, so it always gets the lock.  This
      implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
@@ -240,7 +240,7 @@ pthread_mutex_timedlock (pthread_mutex_t *mutex _GL_UNUSED,
 }
 
 int
-pthread_mutex_unlock (pthread_mutex_t *mutex _GL_UNUSED)
+pthread_mutex_unlock (_GL_UNUSED pthread_mutex_t *mutex)
 {
   /* There is only one thread, so it always unlocks successfully.
      This implementation does not support robust mutexes or
@@ -249,7 +249,7 @@ pthread_mutex_unlock (pthread_mutex_t *mutex _GL_UNUSED)
 }
 
 int
-pthread_mutex_destroy (pthread_mutex_t *mutex _GL_UNUSED)
+pthread_mutex_destroy (_GL_UNUSED pthread_mutex_t *mutex)
 {
   /* MUTEX is never seriously used.  */
   return 0;
diff --git a/lib/pthread-rwlock.c b/lib/pthread-rwlock.c
index 15622eb32..82209af2b 100644
--- a/lib/pthread-rwlock.c
+++ b/lib/pthread-rwlock.c
@@ -40,7 +40,7 @@ pthread_rwlockattr_init (pthread_rwlockattr_t *attr)
 }
 
 int
-pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr _GL_UNUSED)
+pthread_rwlockattr_destroy (_GL_UNUSED pthread_rwlockattr_t *attr)
 {
   return 0;
 }
@@ -52,7 +52,7 @@ pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr _GL_UNUSED)
 
 int
 pthread_rwlock_init (pthread_rwlock_t *lock,
-                     const pthread_rwlockattr_t *attr _GL_UNUSED)
+                     _GL_UNUSED const pthread_rwlockattr_t *attr)
 {
   glwthread_timedrwlock_init (lock);
   return 0;
@@ -115,7 +115,7 @@ pthread_rwlock_destroy (pthread_rwlock_t *lock)
 
 int
 pthread_rwlock_init (pthread_rwlock_t *lock,
-                     const pthread_rwlockattr_t *attr _GL_UNUSED)
+                     _GL_UNUSED const pthread_rwlockattr_t *attr)
 {
   int err;
 
@@ -485,7 +485,7 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *lock,
 
 int
 pthread_rwlock_init (pthread_rwlock_t *lock,
-                     const pthread_rwlockattr_t *attr _GL_UNUSED)
+                     _GL_UNUSED const pthread_rwlockattr_t *attr)
 {
   *lock = 0;
   return 0;
@@ -523,14 +523,14 @@ pthread_rwlock_trywrlock (pthread_rwlock_t *lock)
 
 int
 pthread_rwlock_timedrdlock (pthread_rwlock_t *lock,
-                            const struct timespec *abstime _GL_UNUSED)
+                            _GL_UNUSED const struct timespec *abstime)
 {
   return pthread_rwlock_rdlock (lock);
 }
 
 int
 pthread_rwlock_timedwrlock (pthread_rwlock_t *lock,
-                            const struct timespec *abstime _GL_UNUSED)
+                            _GL_UNUSED const struct timespec *abstime)
 {
   return pthread_rwlock_wrlock (lock);
 }
diff --git a/lib/pthread-spin.c b/lib/pthread-spin.c
index 3ba1c0a23..a82437c83 100644
--- a/lib/pthread-spin.c
+++ b/lib/pthread-spin.c
@@ -32,7 +32,7 @@
 
 int
 pthread_spin_init (pthread_spinlock_t *lock,
-                   int shared_across_processes _GL_UNUSED)
+                   _GL_UNUSED int shared_across_processes)
 {
   glwthread_spin_init (lock);
   return 0;
@@ -81,7 +81,7 @@ pthread_spin_destroy (pthread_spinlock_t *lock)
 
 int
 pthread_spin_init (pthread_spinlock_t *lock,
-                   int shared_across_processes _GL_UNUSED)
+                   _GL_UNUSED int shared_across_processes)
 {
   __atomic_store_n ((unsigned int *) lock, 0, __ATOMIC_SEQ_CST);
   return 0;
@@ -127,7 +127,7 @@ pthread_spin_unlock (pthread_spinlock_t *lock)
 
 int
 pthread_spin_init (pthread_spinlock_t *lock,
-                   int shared_across_processes _GL_UNUSED)
+                   _GL_UNUSED int shared_across_processes)
 {
   __atomic_clear (lock, __ATOMIC_SEQ_CST);
   return 0;
@@ -173,7 +173,7 @@ pthread_spin_destroy (pthread_spinlock_t *lock)
 
 int
 pthread_spin_init (pthread_spinlock_t *lock,
-                   int shared_across_processes _GL_UNUSED)
+                   _GL_UNUSED int shared_across_processes)
 {
   * (volatile unsigned int *) lock = 0;
   __sync_synchronize ();
@@ -217,7 +217,7 @@ pthread_spin_destroy (pthread_spinlock_t *lock)
 
 int
 pthread_spin_init (pthread_spinlock_t *lock,
-                   int shared_across_processes _GL_UNUSED)
+                   _GL_UNUSED int shared_across_processes)
 {
   return pthread_mutex_init (lock, NULL);
 }
@@ -252,32 +252,32 @@ pthread_spin_destroy (pthread_spinlock_t *lock)
 /* Provide a dummy implementation for single-threaded applications.  */
 
 int
-pthread_spin_init (pthread_spinlock_t *lock _GL_UNUSED,
-                   int shared_across_processes _GL_UNUSED)
+pthread_spin_init (_GL_UNUSED pthread_spinlock_t *lock,
+                   _GL_UNUSED int shared_across_processes)
 {
   return 0;
 }
 
 int
-pthread_spin_lock (pthread_spinlock_t *lock _GL_UNUSED)
+pthread_spin_lock (_GL_UNUSED pthread_spinlock_t *lock)
 {
   return 0;
 }
 
 int
-pthread_spin_trylock (pthread_spinlock_t *lock _GL_UNUSED)
+pthread_spin_trylock (_GL_UNUSED pthread_spinlock_t *lock)
 {
   return 0;
 }
 
 int
-pthread_spin_unlock (pthread_spinlock_t *lock _GL_UNUSED)
+pthread_spin_unlock (_GL_UNUSED pthread_spinlock_t *lock)
 {
   return 0;
 }
 
 int
-pthread_spin_destroy (pthread_spinlock_t *lock _GL_UNUSED)
+pthread_spin_destroy (_GL_UNUSED pthread_spinlock_t *lock)
 {
   return 0;
 }
diff --git a/lib/pthread-thread.c b/lib/pthread-thread.c
index 6e603bcf7..1455ec511 100644
--- a/lib/pthread-thread.c
+++ b/lib/pthread-thread.c
@@ -57,7 +57,7 @@ pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate)
 }
 
 int
-pthread_attr_destroy (pthread_attr_t *attr _GL_UNUSED)
+pthread_attr_destroy (_GL_UNUSED pthread_attr_t *attr)
 {
   return 0;
 }
diff --git a/lib/readlink.c b/lib/readlink.c
index d4f4b08e9..ad4d51dc6 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -29,8 +29,8 @@
    such as DJGPP 2.03 and mingw32.  */
 
 ssize_t
-readlink (char const *file, char *buf _GL_UNUSED,
-          size_t bufsize _GL_UNUSED)
+readlink (char const *file, _GL_UNUSED char *buf,
+          _GL_UNUSED size_t bufsize)
 {
   struct stat statbuf;
 
diff --git a/lib/rename.c b/lib/rename.c
index a3b7dc641..2f40ccf0b 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -287,7 +287,7 @@ rpl_rename (char const *src, char const *dst)
   char *dst_temp = (char *) dst;
   bool src_slash;
   bool dst_slash;
-  bool dst_exists _GL_UNUSED;
+  _GL_UNUSED bool dst_exists;
   int ret_val = -1;
   int rename_errno = ENOTDIR;
   struct stat src_st;
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 607983cb9..5c837f123 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -775,7 +775,7 @@ chmod_or_fchmod (const char *name, int desc, mode_t mode)
 int
 set_permissions (struct permission_context *ctx, const char *name, int desc)
 {
-  bool acls_set _GL_UNUSED = false;
+  _GL_UNUSED bool acls_set = false;
   bool early_chmod;
   bool must_chmod = false;
   int ret = 0;
diff --git a/lib/sockets.c b/lib/sockets.c
index 934da73d2..f7846b33a 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -113,7 +113,7 @@ static int initialized_sockets_version /* = 0 */;
 #endif /* WINDOWS_SOCKETS */
 
 int
-gl_sockets_startup (int version _GL_UNUSED)
+gl_sockets_startup (_GL_UNUSED int version)
 {
 #if WINDOWS_SOCKETS
   if (version > initialized_sockets_version)
diff --git a/lib/stat-time.h b/lib/stat-time.h
index fe3483d63..6b2cc686a 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -102,7 +102,7 @@ get_stat_mtime_ns (struct stat const *st)
 
 /* Return the nanosecond component of *ST's birth time.  */
 _GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
-get_stat_birthtime_ns (struct stat const *st _GL_UNUSED)
+get_stat_birthtime_ns (_GL_UNUSED struct stat const *st)
 {
 # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
   return STAT_TIMESPEC (st, st_birthtim).tv_nsec;
@@ -158,7 +158,7 @@ get_stat_mtime (struct stat const *st)
 /* Return *ST's birth time, if available; otherwise return a value
    with tv_sec and tv_nsec both equal to -1.  */
 _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
-get_stat_birthtime (struct stat const *st _GL_UNUSED)
+get_stat_birthtime (_GL_UNUSED struct stat const *st)
 {
   struct timespec t;
 
@@ -208,7 +208,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED)
    errno to EOVERFLOW if normalization overflowed.  This function
    is intended to be private to this .h file.  */
 _GL_STAT_TIME_INLINE int
-stat_time_normalize (int result, struct stat *st _GL_UNUSED)
+stat_time_normalize (int result, _GL_UNUSED struct stat *st)
 {
 #if defined __sun && defined STAT_TIMESPEC
   if (result == 0)
diff --git a/lib/strptime.c b/lib/strptime.c
index 7745f10b8..928783c18 100644
--- a/lib/strptime.c
+++ b/lib/strptime.c
@@ -684,7 +684,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
              specify hours.  If fours digits are used, minutes are
              also specified.  */
           {
-            bool neg _GL_UNUSED;
+            _GL_UNUSED bool neg;
             int n;
 
             val = 0;
diff --git a/lib/strtod.c b/lib/strtod.c
index 26cf6935d..158549889 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -106,7 +106,7 @@ decimal_point_char (void)
  #undef LDEXP
  #define LDEXP dummy_ldexp
  /* A dummy definition that will never be invoked.  */
- static DOUBLE LDEXP (DOUBLE x _GL_UNUSED, int exponent _GL_UNUSED)
+ static DOUBLE LDEXP (_GL_UNUSED DOUBLE x, _GL_UNUSED int exponent)
  {
    abort ();
    return L_(0.0);
diff --git a/lib/symlink.c b/lib/symlink.c
index 6e488986c..4bb0884ac 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -47,8 +47,8 @@ rpl_symlink (char const *contents, char const *name)
 
 /* The system does not support symlinks.  */
 int
-symlink (char const *contents _GL_UNUSED,
-         char const *name _GL_UNUSED)
+symlink (_GL_UNUSED char const *contents,
+         _GL_UNUSED char const *name)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/symlinkat.c b/lib/symlinkat.c
index 58ddb8905..4fe823188 100644
--- a/lib/symlinkat.c
+++ b/lib/symlinkat.c
@@ -52,8 +52,8 @@ rpl_symlinkat (char const *contents, int fd, char const *name)
    wrapper than to go through at-func.c to call rpl_symlink.  */
 
 int
-symlinkat (char const *path1 _GL_UNUSED, int fd _GL_UNUSED,
-           char const *path2 _GL_UNUSED)
+symlinkat (_GL_UNUSED char const *path1, _GL_UNUSED int fd,
+           _GL_UNUSED char const *path2)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/tempname.c b/lib/tempname.c
index 5f804b38d..7675aa076 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -181,13 +181,13 @@ try_file (char *tmpl, void *flags)
 }
 
 static int
-try_dir (char *tmpl, void *flags _GL_UNUSED)
+try_dir (char *tmpl, _GL_UNUSED void *flags)
 {
   return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
 }
 
 static int
-try_nocreate (char *tmpl, void *flags _GL_UNUSED)
+try_nocreate (char *tmpl, _GL_UNUSED void *flags)
 {
   struct_stat64 st;
 
diff --git a/lib/textstyle.in.h b/lib/textstyle.in.h
index 04846761d..a160cda48 100644
--- a/lib/textstyle.in.h
+++ b/lib/textstyle.in.h
@@ -167,38 +167,38 @@ typedef ostream_t styled_ostream_t;
 #define styled_ostream_free ostream_free
 
 static inline void
-styled_ostream_begin_use_class (styled_ostream_t stream _GL_UNUSED,
-                                const char *classname _GL_UNUSED)
+styled_ostream_begin_use_class (_GL_UNUSED styled_ostream_t stream,
+                                _GL_UNUSED const char *classname)
 {
 }
 
 static inline void
-styled_ostream_end_use_class (styled_ostream_t stream _GL_UNUSED,
-                              const char *classname _GL_UNUSED)
+styled_ostream_end_use_class (_GL_UNUSED styled_ostream_t stream,
+                              _GL_UNUSED const char *classname)
 {
 }
 
 static inline const char *
-styled_ostream_get_hyperlink_ref (styled_ostream_t stream _GL_UNUSED)
+styled_ostream_get_hyperlink_ref (_GL_UNUSED styled_ostream_t stream)
 {
   return NULL;
 }
 
 static inline const char *
-styled_ostream_get_hyperlink_id (styled_ostream_t stream _GL_UNUSED)
+styled_ostream_get_hyperlink_id (_GL_UNUSED styled_ostream_t stream)
 {
   return NULL;
 }
 
 static inline void
-styled_ostream_set_hyperlink (styled_ostream_t stream _GL_UNUSED,
-                              const char *ref _GL_UNUSED,
-                              const char *id _GL_UNUSED)
+styled_ostream_set_hyperlink (_GL_UNUSED styled_ostream_t stream,
+                              _GL_UNUSED const char *ref,
+                              _GL_UNUSED const char *id)
 {
 }
 
 static inline void
-styled_ostream_flush_to_current_style (styled_ostream_t stream _GL_UNUSED)
+styled_ostream_flush_to_current_style (_GL_UNUSED styled_ostream_t stream)
 {
 }
 
@@ -225,8 +225,8 @@ typedef ostream_t fd_ostream_t;
 #define fd_ostream_free ostream_free
 
 static inline fd_ostream_t
-fd_ostream_create (int fd, const char *filename _GL_UNUSED,
-                   bool buffered _GL_UNUSED)
+fd_ostream_create (int fd, _GL_UNUSED const char *filename,
+                   _GL_UNUSED bool buffered)
 {
   if (fd == 1)
     return stdout;
@@ -272,81 +272,81 @@ typedef ostream_t term_ostream_t;
 #define term_ostream_free ostream_free
 
 static inline term_color_t
-term_ostream_get_color (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_color (_GL_UNUSED term_ostream_t stream)
 {
   return COLOR_DEFAULT;
 }
 
 static inline void
-term_ostream_set_color (term_ostream_t stream _GL_UNUSED,
-                        term_color_t color _GL_UNUSED)
+term_ostream_set_color (_GL_UNUSED term_ostream_t stream,
+                        _GL_UNUSED term_color_t color)
 {
 }
 
 static inline term_color_t
-term_ostream_get_bgcolor (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_bgcolor (_GL_UNUSED term_ostream_t stream)
 {
   return COLOR_DEFAULT;
 }
 
 static inline void
-term_ostream_set_bgcolor (term_ostream_t stream _GL_UNUSED,
-                          term_color_t color _GL_UNUSED)
+term_ostream_set_bgcolor (_GL_UNUSED term_ostream_t stream,
+                          _GL_UNUSED term_color_t color)
 {
 }
 
 static inline term_weight_t
-term_ostream_get_weight (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_weight (_GL_UNUSED term_ostream_t stream)
 {
   return WEIGHT_DEFAULT;
 }
 
 static inline void
-term_ostream_set_weight (term_ostream_t stream _GL_UNUSED,
-                         term_weight_t weight _GL_UNUSED)
+term_ostream_set_weight (_GL_UNUSED term_ostream_t stream,
+                         _GL_UNUSED term_weight_t weight)
 {
 }
 
 static inline term_posture_t
-term_ostream_get_posture (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_posture (_GL_UNUSED term_ostream_t stream)
 {
   return POSTURE_DEFAULT;
 }
 
 static inline void
-term_ostream_set_posture (term_ostream_t stream _GL_UNUSED,
-                          term_posture_t posture _GL_UNUSED)
+term_ostream_set_posture (_GL_UNUSED term_ostream_t stream,
+                          _GL_UNUSED term_posture_t posture)
 {
 }
 
 static inline term_underline_t
-term_ostream_get_underline (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_underline (_GL_UNUSED term_ostream_t stream)
 {
   return UNDERLINE_DEFAULT;
 }
 
 static inline void
-term_ostream_set_underline (term_ostream_t stream _GL_UNUSED,
-                            term_underline_t underline _GL_UNUSED)
+term_ostream_set_underline (_GL_UNUSED term_ostream_t stream,
+                            _GL_UNUSED term_underline_t underline)
 {
 }
 
 static inline const char *
-term_ostream_get_hyperlink_ref (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_hyperlink_ref (_GL_UNUSED term_ostream_t stream)
 {
   return NULL;
 }
 
 static inline const char *
-term_ostream_get_hyperlink_id (term_ostream_t stream _GL_UNUSED)
+term_ostream_get_hyperlink_id (_GL_UNUSED term_ostream_t stream)
 {
   return NULL;
 }
 
 static inline void
-term_ostream_set_hyperlink (term_ostream_t stream _GL_UNUSED,
-                            const char *ref _GL_UNUSED,
-                            const char *id _GL_UNUSED)
+term_ostream_set_hyperlink (_GL_UNUSED term_ostream_t stream,
+                            _GL_UNUSED const char *ref,
+                            _GL_UNUSED const char *id)
 {
 }
 
@@ -374,7 +374,7 @@ typedef enum
 
 static inline term_ostream_t
 term_ostream_create (int fd, const char *filename,
-                     ttyctl_t tty_control _GL_UNUSED)
+                     _GL_UNUSED ttyctl_t tty_control)
 {
   return fd_ostream_create (fd, filename, true);
 }
@@ -395,8 +395,8 @@ typedef styled_ostream_t term_styled_ostream_t;
 
 static inline term_styled_ostream_t
 term_styled_ostream_create (int fd, const char *filename,
-                            ttyctl_t tty_control _GL_UNUSED,
-                            const char *css_filename _GL_UNUSED)
+                            _GL_UNUSED ttyctl_t tty_control,
+                            _GL_UNUSED const char *css_filename)
 {
   return fd_ostream_create (fd, filename, true);
 }
@@ -406,8 +406,8 @@ term_styled_ostream_create (int fd, const char *filename,
 typedef styled_ostream_t html_styled_ostream_t;
 
 static inline html_styled_ostream_t
-html_styled_ostream_create (ostream_t destination _GL_UNUSED,
-                            const char *css_filename _GL_UNUSED)
+html_styled_ostream_create (_GL_UNUSED ostream_t destination,
+                            _GL_UNUSED const char *css_filename)
 {
   abort ();
   return NULL;
@@ -423,13 +423,13 @@ enum color_option { color_no, color_tty, color_yes, color_html };
 #define style_file_name NULL
 
 static inline bool
-handle_color_option (const char *option _GL_UNUSED)
+handle_color_option (_GL_UNUSED const char *option)
 {
   return false;
 }
 
 static inline void
-handle_style_option (const char *option _GL_UNUSED)
+handle_style_option (_GL_UNUSED const char *option)
 {
 }
 
@@ -440,10 +440,10 @@ print_color_test (void)
 }
 
 static inline void
-style_file_prepare (const char *style_file_envvar _GL_UNUSED,
-                    const char *stylesdir_envvar _GL_UNUSED,
-                    const char *stylesdir_after_install _GL_UNUSED,
-                    const char *default_style_file _GL_UNUSED)
+style_file_prepare (_GL_UNUSED const char *style_file_envvar,
+                    _GL_UNUSED const char *stylesdir_envvar,
+                    _GL_UNUSED const char *stylesdir_after_install,
+                    _GL_UNUSED const char *default_style_file)
 {
 }
 
@@ -451,14 +451,14 @@ style_file_prepare (const char *style_file_envvar _GL_UNUSED,
 
 static inline styled_ostream_t
 styled_ostream_create (int fd, const char *filename,
-                       ttyctl_t tty_control _GL_UNUSED,
-                       const char *css_filename _GL_UNUSED)
+                       _GL_UNUSED ttyctl_t tty_control,
+                       _GL_UNUSED const char *css_filename)
 {
   return fd_ostream_create (fd, filename, true);
 }
 
 static inline void
-libtextstyle_set_failure_exit_code (int exit_code _GL_UNUSED)
+libtextstyle_set_failure_exit_code (_GL_UNUSED int exit_code)
 {
 }
 
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 8ac819810..0b058c39f 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -192,7 +192,7 @@ fwrite_success_callback (const char *buf, size_t buflen, void *callback_arg)
 /* Simple failure callback that displays an error and exits.  */
 static long
 exit_failure_callback (unsigned int code, const char *msg,
-                       void *callback_arg _GL_UNUSED)
+                       _GL_UNUSED void *callback_arg)
 {
   if (msg == NULL)
     error (1, 0, _("cannot convert U+%04X to local character set"), code);
@@ -206,7 +206,7 @@ exit_failure_callback (unsigned int code, const char *msg,
    ASCII, using the same notation as ISO C99 strings.  */
 static long
 fallback_failure_callback (unsigned int code,
-                           const char *msg _GL_UNUSED,
+                           _GL_UNUSED const char *msg,
                            void *callback_arg)
 {
   FILE *stream = (FILE *) callback_arg;
diff --git a/lib/wait-process.c b/lib/wait-process.c
index bbf5de2a0..9b48b6aee 100644
--- a/lib/wait-process.c
+++ b/lib/wait-process.c
@@ -105,7 +105,7 @@ cleanup_slaves (void)
 /* The cleanup action, taking a signal argument.
    It gets called asynchronously.  */
 static _GL_ASYNC_SAFE void
-cleanup_slaves_action (int sig _GL_UNUSED)
+cleanup_slaves_action (_GL_UNUSED int sig)
 {
   cleanup_slaves ();
 }
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 174113b28..801c7127b 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -302,6 +302,8 @@ AC_DEFUN([gl_COMMON_BODY], [
 #else
 # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
 #endif
+/* Alternative spelling of this macro, for convenience.  */
+#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
 /* Earlier spellings of this macro.  */
 #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
 
@@ -409,8 +411,6 @@ AC_DEFUN([gl_COMMON_BODY], [
 #else
 # define _GL_ATTRIBUTE_UNUSED
 #endif
-/* Alternative spelling of this macro, for convenience.  */
-#define _GL_UNUSED _GL_ATTRIBUTE_UNUSED
 
 ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
 [
diff --git a/tests/signature.h b/tests/signature.h
index f7917835b..7e9d180c5 100644
--- a/tests/signature.h
+++ b/tests/signature.h
@@ -43,6 +43,6 @@
 # define SIGNATURE_CHECK1(fn, ret, args, id) \
   SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */
 # define SIGNATURE_CHECK2(fn, ret, args, id) \
-  static ret (* _GL_UNUSED signature_check ## id) args = fn
+  _GL_UNUSED static ret (*signature_check ## id) args = fn
 
 #endif /* SIGNATURE_CHECK */
diff --git a/tests/test-areadlink.c b/tests/test-areadlink.c
index d1313dbc5..d3338496e 100644
--- a/tests/test-areadlink.c
+++ b/tests/test-areadlink.c
@@ -38,7 +38,7 @@
 
 /* Wrapper for testing areadlink.  */
 static char *
-do_areadlink (char const *name, size_t ignored _GL_UNUSED)
+do_areadlink (char const *name, _GL_UNUSED size_t ignored)
 {
   return areadlink (name);
 }
diff --git a/tests/test-areadlinkat.c b/tests/test-areadlinkat.c
index 43a66c12e..76bb4cc3c 100644
--- a/tests/test-areadlinkat.c
+++ b/tests/test-areadlinkat.c
@@ -40,7 +40,7 @@ static int dfd = AT_FDCWD;
 
 /* Wrapper for testing areadlinkat.  */
 static char *
-do_areadlinkat (char const *name, size_t ignored _GL_UNUSED)
+do_areadlinkat (char const *name, _GL_UNUSED size_t ignored)
 {
   return areadlinkat (dfd, name);
 }
diff --git a/tests/test-ceilf-ieee.c b/tests/test-ceilf-ieee.c
index 8e65060cc..946d296f2 100644
--- a/tests/test-ceilf-ieee.c
+++ b/tests/test-ceilf-ieee.c
@@ -36,7 +36,7 @@ dummy (float f)
 }
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   float (*my_ceilf) (float) = argc ? ceilf : dummy;
 
diff --git a/tests/test-ceilf1.c b/tests/test-ceilf1.c
index 118e27061..8d62fb32f 100644
--- a/tests/test-ceilf1.c
+++ b/tests/test-ceilf1.c
@@ -41,7 +41,7 @@ dummy (float f)
 }
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   float (*my_ceilf) (float) = argc ? ceilf : dummy;
 
diff --git a/tests/test-dirent.c b/tests/test-dirent.c
index e96433002..84cb8fbbc 100644
--- a/tests/test-dirent.c
+++ b/tests/test-dirent.c
@@ -21,7 +21,7 @@
 #include <dirent.h>
 
 /* Check for existence of required types.  */
-static DIR *dir _GL_UNUSED;
+_GL_UNUSED static DIR *dir;
 static struct dirent d;
 static ino_t i;
 
diff --git a/tests/test-fchownat.c b/tests/test-fchownat.c
index db6de7e91..c785a3ddc 100644
--- a/tests/test-fchownat.c
+++ b/tests/test-fchownat.c
@@ -68,7 +68,7 @@ do_lchown (char const *name, uid_t user, gid_t group)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   int result1; /* Skip because of no chown/symlink support.  */
   int result2; /* Skip because of no lchown support.  */
diff --git a/tests/test-fdopendir.c b/tests/test-fdopendir.c
index 7d53b8ac5..6452c873b 100644
--- a/tests/test-fdopendir.c
+++ b/tests/test-fdopendir.c
@@ -30,7 +30,7 @@ SIGNATURE_CHECK (fdopendir, DIR *, (int));
 #include "macros.h"
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   DIR *d;
   int fd;
diff --git a/tests/test-filenamecat.c b/tests/test-filenamecat.c
index 384342d0f..4a72acbc6 100644
--- a/tests/test-filenamecat.c
+++ b/tests/test-filenamecat.c
@@ -31,7 +31,7 @@
 
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   static char const *const tests[][3] =
     {
diff --git a/tests/test-floor1.c b/tests/test-floor1.c
index 97723e737..3a88ded2d 100644
--- a/tests/test-floor1.c
+++ b/tests/test-floor1.c
@@ -30,7 +30,7 @@ SIGNATURE_CHECK (floor, double, (double));
 #include "macros.h"
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   /* Zero.  */
   ASSERT (floor (0.0) == 0.0);
diff --git a/tests/test-floorf-ieee.c b/tests/test-floorf-ieee.c
index 2cf8d9174..3d261ed30 100644
--- a/tests/test-floorf-ieee.c
+++ b/tests/test-floorf-ieee.c
@@ -36,7 +36,7 @@ dummy (float f)
 }
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   float (*my_floorf) (float) = argc ? floorf : dummy;
 
diff --git a/tests/test-floorf1.c b/tests/test-floorf1.c
index a4f5ef86d..0ad606859 100644
--- a/tests/test-floorf1.c
+++ b/tests/test-floorf1.c
@@ -41,7 +41,7 @@ dummy (float f)
 }
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   float (*my_floorf) (float) = argc ? floorf : dummy;
 
diff --git a/tests/test-fseeko.c b/tests/test-fseeko.c
index ce6c21257..0bc828ead 100644
--- a/tests/test-fseeko.c
+++ b/tests/test-fseeko.c
@@ -34,7 +34,7 @@ SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int));
 #endif
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
      iff argc > 1.  */
diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c
index 3c8ce743c..b3964342e 100644
--- a/tests/test-fstatat.c
+++ b/tests/test-fstatat.c
@@ -67,7 +67,7 @@ do_lstat (char const *name, struct stat *st)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   int result;
 
diff --git a/tests/test-ftello.c b/tests/test-ftello.c
index f74d5c686..7a51bcf46 100644
--- a/tests/test-ftello.c
+++ b/tests/test-ftello.c
@@ -34,7 +34,7 @@ SIGNATURE_CHECK (ftello, off_t, (FILE *));
 #endif
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   int ch;
   /* Assume stdin is seekable iff argc > 1.  */
diff --git a/tests/test-getdomainname.c b/tests/test-getdomainname.c
index 718dfb087..de1a6f057 100644
--- a/tests/test-getdomainname.c
+++ b/tests/test-getdomainname.c
@@ -32,7 +32,7 @@ SIGNATURE_CHECK (getdomainname, int, (char *, size_t));
 #define NODOMAINNAME "magic-gnulib-test-string"
 
 int
-main (int argc, char *argv[] _GL_UNUSED)
+main (int argc, _GL_UNUSED char *argv[])
 {
   char buf[YPMAXDOMAIN];
   int rc;
diff --git a/tests/test-getgroups.c b/tests/test-getgroups.c
index dcea0332b..e89636a3d 100644
--- a/tests/test-getgroups.c
+++ b/tests/test-getgroups.c
@@ -40,7 +40,7 @@ SIGNATURE_CHECK (getgroups, int, (int, gid_t[]));
 #endif
 
 int
-main (int argc, char **argv _GL_UNUSED)
+main (int argc, _GL_UNUSED char **argv)
 {
   int result;
   gid_t *groups;
diff --git a/tests/test-gethostname.c b/tests/test-gethostname.c
index d5f035101..4e5357c77 100644
--- a/tests/test-gethostname.c
+++ b/tests/test-gethostname.c
@@ -33,7 +33,7 @@ SIGNATURE_CHECK (gethostname, int, (char *, size_t));
 #define NOHOSTNAME "magic-gnulib-test-string"
 
 int
-main (int argc, char *argv[] _GL_UNUSED)
+main (int argc, _GL_UNUSED char *argv[])
 {
   char buf[HOST_NAME_MAX];
   int rc;
diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc
index 758cda2cc..09fd83c5b 100644
--- a/tests/test-math-c++.cc
+++ b/tests/test-math-c++.cc
@@ -34,7 +34,7 @@
   OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
   OVERLOADED_CHECK (func, rettype3, parameters3, _3)
 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
-  static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
+  _GL_UNUSED static rettype (* signature_check_ ## func ## suffix) parameters \
     = static_cast<rettype(*)parameters>(GNULIB_NAMESPACE::func)
 
 
diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c
index 70e3ad268..24fab8d1b 100644
--- a/tests/test-mkdirat.c
+++ b/tests/test-mkdirat.c
@@ -47,7 +47,7 @@ do_mkdir (char const *name, mode_t mode)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   int result;
 
diff --git a/tests/test-openat.c b/tests/test-openat.c
index d876a779a..4c87dd079 100644
--- a/tests/test-openat.c
+++ b/tests/test-openat.c
@@ -58,7 +58,7 @@ do_open (char const *name, int flags, ...)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   int result;
 
diff --git a/tests/test-parse-datetime.c b/tests/test-parse-datetime.c
index b972e9623..d6c26c189 100644
--- a/tests/test-parse-datetime.c
+++ b/tests/test-parse-datetime.c
@@ -111,7 +111,7 @@ gmt_offset (time_t s)
 }
 
 int
-main (int argc _GL_UNUSED, char **argv)
+main (_GL_UNUSED int argc, char **argv)
 {
   struct timespec result;
   struct timespec result2;
diff --git a/tests/test-quotearg-simple.c b/tests/test-quotearg-simple.c
index 795e30fdb..53f8ba7ea 100644
--- a/tests/test-quotearg-simple.c
+++ b/tests/test-quotearg-simple.c
@@ -255,7 +255,7 @@ use_quote_double_quotes (const char *str, size_t *len)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   int i;
   bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c
index ccacd93ae..8dc15c99e 100644
--- a/tests/test-quotearg.c
+++ b/tests/test-quotearg.c
@@ -60,7 +60,7 @@ static struct result_groups locale_results[] = {
 #endif /* ENABLE_NLS */
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
 #if ENABLE_NLS
   /* Clean up environment.  */
diff --git a/tests/test-sethostname2.c b/tests/test-sethostname2.c
index 2af95f620..e2b4047ca 100644
--- a/tests/test-sethostname2.c
+++ b/tests/test-sethostname2.c
@@ -41,7 +41,7 @@
 #endif
 
 int
-main (int argc, char *argv[] _GL_UNUSED)
+main (int argc, _GL_UNUSED char *argv[])
 {
   char origname[HOST_NAME_MAX];
   char newname[HOST_NAME_MAX];
diff --git a/tests/test-unlinkat.c b/tests/test-unlinkat.c
index 730fdc2d2..0e226559c 100644
--- a/tests/test-unlinkat.c
+++ b/tests/test-unlinkat.c
@@ -56,7 +56,7 @@ unlinker (char const *name)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   /* FIXME: Add tests of fd other than ".".  */
   int result1;
diff --git a/tests/test-version-etc.c b/tests/test-version-etc.c
index a09855637..da71e3686 100644
--- a/tests/test-version-etc.c
+++ b/tests/test-version-etc.c
@@ -23,7 +23,7 @@
 #define AUTHORS "Sergey Poznyakoff", "Eric Blake"
 
 int
-main (int argc _GL_UNUSED, char **argv)
+main (_GL_UNUSED int argc, char **argv)
 {
   version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
                (const char *) NULL);
diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c
index 3da598ba3..de01858f1 100644
--- a/tests/test-xalloc-die.c
+++ b/tests/test-xalloc-die.c
@@ -21,7 +21,7 @@
 #include "xalloc.h"
 
 int
-main (int argc _GL_UNUSED, char **argv)
+main (_GL_UNUSED int argc, char **argv)
 {
   xalloc_die ();
   return 0;
diff --git a/tests/test-xfprintf-posix.c b/tests/test-xfprintf-posix.c
index 692bae819..f2c110b26 100644
--- a/tests/test-xfprintf-posix.c
+++ b/tests/test-xfprintf-posix.c
@@ -30,7 +30,7 @@
 #include "test-fprintf-posix.h"
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   test_function (xfprintf);
   return 0;
diff --git a/tests/test-xprintf-posix.c b/tests/test-xprintf-posix.c
index f499fcadf..0cb247a14 100644
--- a/tests/test-xprintf-posix.c
+++ b/tests/test-xprintf-posix.c
@@ -29,7 +29,7 @@
 #include "test-printf-posix.h"
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   test_function (xprintf);
   return 0;
diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c
index b63744465..e9c5a4445 100644
--- a/tests/test-xvasprintf.c
+++ b/tests/test-xvasprintf.c
@@ -126,7 +126,7 @@ test_xasprintf (void)
 }
 
 int
-main (int argc _GL_UNUSED, char *argv[])
+main (_GL_UNUSED int argc, char *argv[])
 {
   test_xvasprintf ();
   test_xasprintf ();





^ permalink raw reply	[flat|nested] 6+ messages in thread

* snippet/unused-parameter: Mark unused module obsolete
  2021-08-09 10:08   ` Paul Eggert
  2021-08-22 13:33     ` Bruno Haible
  2021-08-22 20:05     ` gnulib-common.m4: Use C2x [[maybe_unused]] when possible Bruno Haible
@ 2021-08-23  1:06     ` Bruno Haible
  2 siblings, 0 replies; 6+ messages in thread
From: Bruno Haible @ 2021-08-23  1:06 UTC (permalink / raw)
  To: bug-gnulib, Paul Eggert

Paul Eggert wrote:
> >> * Remove the snippet/unused-parameter module as it's not used now.
> > 
> > Indeed, this module is unused in gnulib. It may be used in packages that
> > use gnulib; therefore I vote for marking it 'obsolete' and remove it only
> > in a year or two.
> 
> Sounds good to me too.

Done:


2021-08-22  Bruno Haible  <bruno@clisp.org>

	snippet/unused-parameter: Mark unused module obsolete.
	* modules/snippet/unused-parameter (Status, Notice): Mark as obsolete.

diff --git a/modules/snippet/unused-parameter b/modules/snippet/unused-parameter
index 561b3e45a..78a3e3328 100644
--- a/modules/snippet/unused-parameter
+++ b/modules/snippet/unused-parameter
@@ -1,6 +1,12 @@
 Description:
 A C macro for declaring that specific function parameters are not used.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Applicability:
 all
 





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-23  1:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31 19:52 Using C2x attributes more effectively in Gnulib Paul Eggert
2021-08-08  1:40 ` Bruno Haible
2021-08-09 10:08   ` Paul Eggert
2021-08-22 13:33     ` Bruno Haible
2021-08-22 20:05     ` gnulib-common.m4: Use C2x [[maybe_unused]] when possible Bruno Haible
2021-08-23  1:06     ` snippet/unused-parameter: Mark unused module obsolete Bruno Haible

Code repositories for project(s) associated with this inbox:

	../../../mirrors/gnulib.git

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).