bug-gnulib
[Top][All Lists]
Advanced

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

Re: stdlib tweak


From: Eric Blake
Subject: Re: stdlib tweak
Date: Wed, 23 Dec 2009 06:51:52 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 12/23/2009 5:22 AM:
>> Considering that this will appear in nearly every .c file in gnulib/lib,
> 
> You mean, in gnulib/tests/, I guess?

My use of the signature check was only in gnulib/tests.

> 
>> Then, each use would be more concise:
>>
>>     GL_SIG_CHECK (atexit, int, (void (*) (void)));
> 
> I like the idea: it provides an abstraction over this arcane C function 
> pointer
> syntax.

Also agreed, so I'll refactor my patch along those lines.

> 
>> how about a macro to encapsulate whatever idiom we use?
>> Even if it means emitting that into config.h.
> 
> Since it's a utility macro only for the tests, I would much prefer to have it
> in a file such as tests/macros.h, rather than polluting config.h with stuff
> that exists only for the tests. This file tests/macros.h could also contain
> the ubiquitous ASSERT macro. (I try to keep the tests as transparent and
> will as little boilerplate complexity as possible. But a macro that is used
> more than 200 times can certainly be refactored.)

OK, then I'll work on making gnulib-tool always distribute tests/macros.h
along with any test, and move ASSERT into that file (but as separate
steps, to make the reviews easier).

> 
>>> It also means that the gnulib guarantee that _UNUSED_PARAMETER_
>>> expands to __attribute__((__unused__)) is a bit of a misnomer, as in this 
>>> case,
>>> signature_check is not a parameter.  Do we want to introduce a new alias,
>>> _GL_UNUSED, and use that instead of _UNUSED_PARAMETER_?  (Unfortunately, we
>> I would prefer _GL_UNUSED, too.
>> Not only a shorter name, but also more apt.
>> If you want to deprecate _UNUSED_PARAMETER_ outside of gnulib,
> 
> I would leave _UNUSED_PARAMETER_ as it is. It is well named and frequently
> used. You are now trying to use __attribute__((__unused__)) also for a
> different case; that does not mean that _UNUSED_PARAMETER_ needs to be
> changed.

Indeed - that was my original thought when I wrote the following patch
yesterday.  Now pushing:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksyIHgACgkQ84KuGfSFAYA84gCfQTMj26IHBKt2PfSc73eVkpMN
fVEAoLYvktMnO9FdPw+PDNeQKhc+piSh
=ce0J
-----END PGP SIGNATURE-----
From 169ab5dec0e562548959482e3ff63c96c340e0d1 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 22 Dec 2009 15:14:49 -0700
Subject: [PATCH] gnulib-common: prefer _GL_UNUSED over _UNUSED_PARAMETER_

There are more contexts where __attribute__((__unused__)) is
useful than just parameter lists.  Also, naming the macro
_GL_UNUSED fits with the recent addition of _GL_ARG_NONNULL.
Preserve the name _UNUSED_PARAMETER_ for backwards-compatible
use in external projects.

* m4/gnulib-common.m4 (gl_COMMON): Create a more-appropriately
named alias for __attribute__((__unused__)).
* lib/chown.c: Update client.
* lib/fchmodat.c: Likewise.
* lib/fts.c: Likewise.
* lib/getdate.y: Likewise.
* lib/getgroups.c: Likewise.
* lib/getopt.c: Likewise.
* lib/getugroups.c: Likewise.
* lib/mkdir.c: Likewise.
* lib/mkfifo.c: Likewise.
* lib/mkfifoat.c: Likewise.
* lib/mknod.c: Likewise.
* lib/mknodat.c: Likewise.
* lib/readlink.c: Likewise.
* lib/se-context.in.h: Likewise.
* lib/se-selinux.in.h: Likewise.
* lib/sockets.c: Likewise.
* lib/symlink.c: Likewise.
* lib/symlinkat.c: Likewise.
* lib/unicodeio.c: Likewise.
* lib/unistr.h: Likewise.
* tests/test-areadlink.c: Likewise.
* tests/test-areadlinkat.c: Likewise.
* tests/test-filenamecat.c: Likewise.
* tests/test-fseeko.c: Likewise.
* tests/test-ftello.c: Likewise.
* tests/test-getdate.c: Likewise.
* tests/test-getgroups.c: Likewise.
* tests/test-gethostname.c: Likewise.
* tests/test-quotearg.c: Likewise.
* tests/test-version-etc.c: Likewise.
* tests/test-xalloc-die.c: Likewise.
* tests/test-xfprintf-posix.c: Likewise.
* tests/test-xprintf-posix.c: Likewise.
* tests/test-xvasprintf.c: Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                   |   38 ++++++++++++++++++++++++++++++
 lib/chown.c                 |    4 +-
 lib/fchmodat.c              |    2 +-
 lib/fts.c                   |    6 ++--
 lib/getdate.y               |    4 +-
 lib/getgroups.c             |    2 +-
 lib/getopt.c                |    4 +-
 lib/getugroups.c            |    8 +++---
 lib/mkdir.c                 |    2 +-
 lib/mkfifo.c                |    2 +-
 lib/mkfifoat.c              |    4 +-
 lib/mknod.c                 |    4 +-
 lib/mknodat.c               |    4 +-
 lib/readlink.c              |    4 +-
 lib/se-context.in.h         |   22 ++++++++--------
 lib/se-selinux.in.h         |   54 +++++++++++++++++++++---------------------
 lib/sockets.c               |    2 +-
 lib/symlink.c               |    4 +-
 lib/symlinkat.c             |    4 +-
 lib/unicodeio.c             |    4 +-
 lib/unistr.h                |    4 +-
 m4/gnulib-common.m4         |   13 ++++++----
 tests/test-areadlink.c      |    2 +-
 tests/test-areadlinkat.c    |    2 +-
 tests/test-filenamecat.c    |    2 +-
 tests/test-fseeko.c         |    2 +-
 tests/test-ftello.c         |    2 +-
 tests/test-getdate.c        |    2 +-
 tests/test-getgroups.c      |    2 +-
 tests/test-gethostname.c    |    2 +-
 tests/test-quotearg.c       |    2 +-
 tests/test-version-etc.c    |    2 +-
 tests/test-xalloc-die.c     |    2 +-
 tests/test-xfprintf-posix.c |    2 +-
 tests/test-xprintf-posix.c  |    2 +-
 tests/test-xvasprintf.c     |    2 +-
 36 files changed, 132 insertions(+), 91 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 28f92b0..7e1dd76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
 2009-12-23  Eric Blake  <address@hidden>

+       gnulib-common: prefer _GL_UNUSED over _UNUSED_PARAMETER_
+       * m4/gnulib-common.m4 (gl_COMMON): Create a more-appropriately
+       named alias for __attribute__((__unused__)).
+       * lib/chown.c: Update client.
+       * lib/fchmodat.c: Likewise.
+       * lib/fts.c: Likewise.
+       * lib/getdate.y: Likewise.
+       * lib/getgroups.c: Likewise.
+       * lib/getopt.c: Likewise.
+       * lib/getugroups.c: Likewise.
+       * lib/mkdir.c: Likewise.
+       * lib/mkfifo.c: Likewise.
+       * lib/mkfifoat.c: Likewise.
+       * lib/mknod.c: Likewise.
+       * lib/mknodat.c: Likewise.
+       * lib/readlink.c: Likewise.
+       * lib/se-context.in.h: Likewise.
+       * lib/se-selinux.in.h: Likewise.
+       * lib/sockets.c: Likewise.
+       * lib/symlink.c: Likewise.
+       * lib/symlinkat.c: Likewise.
+       * lib/unicodeio.c: Likewise.
+       * lib/unistr.h: Likewise.
+       * tests/test-areadlink.c: Likewise.
+       * tests/test-areadlinkat.c: Likewise.
+       * tests/test-filenamecat.c: Likewise.
+       * tests/test-fseeko.c: Likewise.
+       * tests/test-ftello.c: Likewise.
+       * tests/test-getdate.c: Likewise.
+       * tests/test-getgroups.c: Likewise.
+       * tests/test-gethostname.c: Likewise.
+       * tests/test-quotearg.c: Likewise.
+       * tests/test-version-etc.c: Likewise.
+       * tests/test-xalloc-die.c: Likewise.
+       * tests/test-xfprintf-posix.c: Likewise.
+       * tests/test-xprintf-posix.c: Likewise.
+       * tests/test-xvasprintf.c: Likewise.
+
        tests: avoid compiler warnings
        * tests/test-fcntl.c (main): Delete unused parameters.
        * tests/test-freopen-safer.c (main): Likewise.
diff --git a/lib/chown.c b/lib/chown.c
index 66bb0c8..a19cd34 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 _UNUSED_PARAMETER_, uid_t uid _UNUSED_PARAMETER_,
-       gid_t gid _UNUSED_PARAMETER_)
+chown (const char *file _GL_UNUSED, uid_t uid _GL_UNUSED,
+       gid_t gid _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index 62a5d05..fa1ec47 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -28,7 +28,7 @@
 # undef lchmod
 # define lchmod lchmod_rpl
 static int
-lchmod (char const *f _UNUSED_PARAMETER_, mode_t m _UNUSED_PARAMETER_)
+lchmod (char const *f _GL_UNUSED, mode_t m _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/fts.c b/lib/fts.c
index 9329ef6..8e6e728 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -712,9 +712,9 @@ leaf_optimization_applies (int dir_fd)

 #else
 static bool
-dirent_inode_sort_may_be_useful (int dir_fd _UNUSED_PARAMETER_) { return true; 
}
+dirent_inode_sort_may_be_useful (int dir_fd _GL_UNUSED) { return true; }
 static bool
-leaf_optimization_applies (int dir_fd _UNUSED_PARAMETER_) { return false; }
+leaf_optimization_applies (int dir_fd _GL_UNUSED) { return false; }
 #endif

 #if GNULIB_FTS
@@ -1064,7 +1064,7 @@ check_for_dir:
  */
 /* ARGSUSED */
 int
-fts_set(FTS *sp _UNUSED_PARAMETER_, FTSENT *p, int instr)
+fts_set(FTS *sp _GL_UNUSED, FTSENT *p, int instr)
 {
         if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
             instr != FTS_NOINSTR && instr != FTS_SKIP) {
diff --git a/lib/getdate.y b/lib/getdate.y
index e61ffdf..57aee96 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -1145,8 +1145,8 @@ yylex (YYSTYPE *lvalp, parser_control *pc)

 /* Do nothing if the parser reports an error.  */
 static int
-yyerror (parser_control const *pc _UNUSED_PARAMETER_,
-         char const *s _UNUSED_PARAMETER_)
+yyerror (parser_control const *pc _GL_UNUSED,
+         char const *s _GL_UNUSED)
 {
   return 0;
 }
diff --git a/lib/getgroups.c b/lib/getgroups.c
index e2bb68e..3e7eaad 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -31,7 +31,7 @@
 /* Provide a stub that fails with ENOSYS, since there is no group
    information available on mingw.  */
 int
-getgroups (int n _UNUSED_PARAMETER_, GETGROUPS_T *groups _UNUSED_PARAMETER_)
+getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/getopt.c b/lib/getopt.c
index 5e9a4a5..f2a109f 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -226,8 +226,8 @@ exchange (char **argv, struct _getopt_data *d)
 /* Initialize the internal data when the first call is made.  */

 static const char *
-_getopt_initialize (int argc _UNUSED_PARAMETER_,
-                    char **argv _UNUSED_PARAMETER_, const char *optstring,
+_getopt_initialize (int argc _GL_UNUSED,
+                    char **argv _GL_UNUSED, 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 b17563e..50e1f4d 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -33,10 +33,10 @@
    can do is fail with ENOSYS.  */

 int
-getugroups (int maxcount _UNUSED_PARAMETER_,
-            gid_t *grouplist _UNUSED_PARAMETER_,
-            char const *username _UNUSED_PARAMETER_,
-            gid_t gid _UNUSED_PARAMETER_)
+getugroups (int maxcount _GL_UNUSED,
+            gid_t *grouplist _GL_UNUSED,
+            char const *username _GL_UNUSED,
+            gid_t gid _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mkdir.c b/lib/mkdir.c
index e6dbc78..34cab6c 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -40,7 +40,7 @@
    alias mkdir), only in the nonstandard io.h.  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 # define mkdir(name,mode) _mkdir (name)
-# define maybe_unused _UNUSED_PARAMETER_
+# define maybe_unused _GL_UNUSED
 #else
 # define maybe_unused /* empty */
 #endif
diff --git a/lib/mkfifo.c b/lib/mkfifo.c
index 3c29e8f..5ea8c17 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 _UNUSED_PARAMETER_, mode_t mode _UNUSED_PARAMETER_)
+mkfifo (char const *name _GL_UNUSED, mode_t mode _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mkfifoat.c b/lib/mkfifoat.c
index 89002f2..bef1766 100644
--- a/lib/mkfifoat.c
+++ b/lib/mkfifoat.c
@@ -27,8 +27,8 @@
 /* Mingw lacks mkfifo, so this wrapper is trivial.  */

 int
-mkfifoat (int fd _UNUSED_PARAMETER_, char const *path _UNUSED_PARAMETER_,
-          mode_t mode _UNUSED_PARAMETER_)
+mkfifoat (int fd _GL_UNUSED, char const *path _GL_UNUSED,
+          mode_t mode _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mknod.c b/lib/mknod.c
index 662f5f8..0918be7 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 _UNUSED_PARAMETER_, mode_t mode _UNUSED_PARAMETER_,
-       dev_t dev _UNUSED_PARAMETER_)
+mknod (char const *name _GL_UNUSED, mode_t mode _GL_UNUSED,
+       dev_t dev _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/mknodat.c b/lib/mknodat.c
index b5126bf..a2eae72 100644
--- a/lib/mknodat.c
+++ b/lib/mknodat.c
@@ -27,8 +27,8 @@
 /* Mingw lacks mknod, so this wrapper is trivial.  */

 int
-mknodat (int fd _UNUSED_PARAMETER_, char const *path _UNUSED_PARAMETER_,
-         mode_t mode _UNUSED_PARAMETER_, dev_t dev _UNUSED_PARAMETER_)
+mknodat (int fd _GL_UNUSED, char const *path _GL_UNUSED,
+         mode_t mode _GL_UNUSED, dev_t dev _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/readlink.c b/lib/readlink.c
index 0c6f09a..41c81f9 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -29,8 +29,8 @@
    such as DJGPP 2.03 and mingw32.  */

 ssize_t
-readlink (const char *name, char *buf _UNUSED_PARAMETER_,
-          size_t bufsize _UNUSED_PARAMETER_)
+readlink (const char *name, char *buf _GL_UNUSED,
+          size_t bufsize _GL_UNUSED)
 {
   struct stat statbuf;

diff --git a/lib/se-context.in.h b/lib/se-context.in.h
index 2c36cc2..d69e809 100644
--- a/lib/se-context.in.h
+++ b/lib/se-context.in.h
@@ -4,23 +4,23 @@
 # include <errno.h>

 typedef int context_t;
-static inline context_t context_new (char const *s _UNUSED_PARAMETER_)
+static inline context_t context_new (char const *s _GL_UNUSED)
   { errno = ENOTSUP; return 0; }
-static inline char *context_str (context_t con _UNUSED_PARAMETER_)
+static inline char *context_str (context_t con _GL_UNUSED)
   { errno = ENOTSUP; return (void *) 0; }
-static inline void context_free (context_t c _UNUSED_PARAMETER_) {}
+static inline void context_free (context_t c _GL_UNUSED) {}

-static inline int context_user_set (context_t sc _UNUSED_PARAMETER_,
-                                    char const *s _UNUSED_PARAMETER_)
+static inline int context_user_set (context_t sc _GL_UNUSED,
+                                    char const *s _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int context_role_set (context_t sc _UNUSED_PARAMETER_,
-                                    char const *s _UNUSED_PARAMETER_)
+static inline int context_role_set (context_t sc _GL_UNUSED,
+                                    char const *s _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int context_range_set (context_t sc _UNUSED_PARAMETER_,
-                                     char const *s _UNUSED_PARAMETER_)
+static inline int context_range_set (context_t sc _GL_UNUSED,
+                                     char const *s _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int context_type_set (context_t sc _UNUSED_PARAMETER_,
-                                    char const *s _UNUSED_PARAMETER_)
+static inline int context_type_set (context_t sc _GL_UNUSED,
+                                    char const *s _GL_UNUSED)
   { errno = ENOTSUP; return -1; }

 #endif
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index 3d243ae..228054d 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -18,55 +18,55 @@ typedef unsigned short security_class_t;
 #  define security_context_t char*
 #  define is_selinux_enabled() 0

-static inline int getcon (security_context_t *con _UNUSED_PARAMETER_)
+static inline int getcon (security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline void freecon (security_context_t con _UNUSED_PARAMETER_) {}
+static inline void freecon (security_context_t con _GL_UNUSED) {}


-static inline int getfscreatecon (security_context_t *con _UNUSED_PARAMETER_)
+static inline int getfscreatecon (security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int setfscreatecon (security_context_t con _UNUSED_PARAMETER_)
+static inline int setfscreatecon (security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int matchpathcon (char const *file _UNUSED_PARAMETER_,
-                                mode_t m _UNUSED_PARAMETER_,
-                                security_context_t *con _UNUSED_PARAMETER_)
+static inline int matchpathcon (char const *file _GL_UNUSED,
+                                mode_t m _GL_UNUSED,
+                                security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int getfilecon (char const *file _UNUSED_PARAMETER_,
-                              security_context_t *con _UNUSED_PARAMETER_)
+static inline int getfilecon (char const *file _GL_UNUSED,
+                              security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int lgetfilecon (char const *file _UNUSED_PARAMETER_,
-                               security_context_t *con _UNUSED_PARAMETER_)
+static inline int lgetfilecon (char const *file _GL_UNUSED,
+                               security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
 static inline int fgetfilecon (int fd,
-                               security_context_t *con _UNUSED_PARAMETER_)
+                               security_context_t *con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int setfilecon (char const *file _UNUSED_PARAMETER_,
-                              security_context_t con _UNUSED_PARAMETER_)
+static inline int setfilecon (char const *file _GL_UNUSED,
+                              security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int lsetfilecon (char const *file _UNUSED_PARAMETER_,
-                               security_context_t con _UNUSED_PARAMETER_)
+static inline int lsetfilecon (char const *file _GL_UNUSED,
+                               security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int fsetfilecon (int fd _UNUSED_PARAMETER_,
-                               security_context_t con _UNUSED_PARAMETER_)
+static inline int fsetfilecon (int fd _GL_UNUSED,
+                               security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }

 static inline int security_check_context
-    (security_context_t con _UNUSED_PARAMETER_)
+    (security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
 static inline int security_check_context_raw
-    (security_context_t con _UNUSED_PARAMETER_)
+    (security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
-static inline int setexeccon (security_context_t con _UNUSED_PARAMETER_)
+static inline int setexeccon (security_context_t con _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
 static inline int security_compute_create
-    (security_context_t scon _UNUSED_PARAMETER_,
-     security_context_t tcon _UNUSED_PARAMETER_,
-     security_class_t tclass _UNUSED_PARAMETER_,
-     security_context_t *newcon _UNUSED_PARAMETER_)
+    (security_context_t scon _GL_UNUSED,
+     security_context_t tcon _GL_UNUSED,
+     security_class_t tclass _GL_UNUSED,
+     security_context_t *newcon _GL_UNUSED)
   { errno = ENOTSUP; return -1; }
 static inline int matchpathcon_init_prefix
-    (char const *path _UNUSED_PARAMETER_,
-     char const *prefix _UNUSED_PARAMETER_)
+    (char const *path _GL_UNUSED,
+     char const *prefix _GL_UNUSED)
   { errno = ENOTSUP; return -1; }

 # endif
diff --git a/lib/sockets.c b/lib/sockets.c
index b49e580..3be3279 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -74,7 +74,7 @@ static int initialized_sockets_version /* = 0 */;
 #endif /* WINDOWS_SOCKETS */

 int
-gl_sockets_startup (int version _UNUSED_PARAMETER_)
+gl_sockets_startup (int version _GL_UNUSED)
 {
 #if WINDOWS_SOCKETS
   if (version > initialized_sockets_version)
diff --git a/lib/symlink.c b/lib/symlink.c
index 1e6cbed..d005dbd 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 _UNUSED_PARAMETER_,
-         char const *name _UNUSED_PARAMETER_)
+symlink (char const *contents _GL_UNUSED,
+         char const *name _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/symlinkat.c b/lib/symlinkat.c
index cb52510..721d1c5 100644
--- a/lib/symlinkat.c
+++ b/lib/symlinkat.c
@@ -27,8 +27,8 @@
 # include <errno.h>

 int
-symlinkat (char const *path1 _UNUSED_PARAMETER_, int fd _UNUSED_PARAMETER_,
-           char const *path2 _UNUSED_PARAMETER_)
+symlinkat (char const *path1 _GL_UNUSED, int fd _GL_UNUSED,
+           char const *path2 _GL_UNUSED)
 {
   errno = ENOSYS;
   return -1;
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 79cfbac..177e75c 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -174,7 +174,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 _UNUSED_PARAMETER_)
+                       void *callback_arg _GL_UNUSED)
 {
   if (msg == NULL)
     error (1, 0, _("cannot convert U+%04X to local character set"), code);
@@ -188,7 +188,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 _UNUSED_PARAMETER_,
+                           const char *msg _GL_UNUSED,
                            void *callback_arg)
 {
   FILE *stream = (FILE *) callback_arg;
diff --git a/lib/unistr.h b/lib/unistr.h
index 35cd2da..96c5357 100644
--- a/lib/unistr.h
+++ b/lib/unistr.h
@@ -183,7 +183,7 @@ extern int
        u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
 # else
 static inline int
-u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED)
 {
   uint32_t c = *s;

@@ -253,7 +253,7 @@ extern int
        u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
 # else
 static inline int
-u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED)
 {
   uint32_t c = *s;

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 75da53d..63c6300 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])

diff --git a/tests/test-areadlink.c b/tests/test-areadlink.c
index aa297ce..9a36927 100644
--- a/tests/test-areadlink.c
+++ b/tests/test-areadlink.c
@@ -47,7 +47,7 @@

 /* Wrapper for testing areadlink.  */
 static char *
-do_areadlink (char const *name, size_t ignored _UNUSED_PARAMETER_)
+do_areadlink (char const *name, size_t ignored _GL_UNUSED)
 {
   return areadlink (name);
 }
diff --git a/tests/test-areadlinkat.c b/tests/test-areadlinkat.c
index e567b37..f5deb70 100644
--- a/tests/test-areadlinkat.c
+++ b/tests/test-areadlinkat.c
@@ -49,7 +49,7 @@ static int dfd = AT_FDCWD;

 /* Wrapper for testing areadlinkat.  */
 static char *
-do_areadlinkat (char const *name, size_t ignored _UNUSED_PARAMETER_)
+do_areadlinkat (char const *name, size_t ignored _GL_UNUSED)
 {
   return areadlinkat (dfd, name);
 }
diff --git a/tests/test-filenamecat.c b/tests/test-filenamecat.c
index d10bf5f..2d8fd69 100644
--- a/tests/test-filenamecat.c
+++ b/tests/test-filenamecat.c
@@ -29,7 +29,7 @@
 #include "progname.h"

 int
-main (int argc _UNUSED_PARAMETER_, char *argv[])
+main (int argc _GL_UNUSED, char *argv[])
 {
   static char const *const tests[][3] =
     {
diff --git a/tests/test-fseeko.c b/tests/test-fseeko.c
index 037c7f5..bdf025f 100644
--- a/tests/test-fseeko.c
+++ b/tests/test-fseeko.c
@@ -45,7 +45,7 @@
 #endif

 int
-main (int argc, char **argv _UNUSED_PARAMETER_)
+main (int argc, char **argv _GL_UNUSED)
 {
   /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
      iff argc > 1.  */
diff --git a/tests/test-ftello.c b/tests/test-ftello.c
index ab5c456..dfe5be0 100644
--- a/tests/test-ftello.c
+++ b/tests/test-ftello.c
@@ -46,7 +46,7 @@
 #endif

 int
-main (int argc, char **argv _UNUSED_PARAMETER_)
+main (int argc, char **argv _GL_UNUSED)
 {
   int ch;
   /* Assume stdin is seekable iff argc > 1.  */
diff --git a/tests/test-getdate.c b/tests/test-getdate.c
index 40d80df..2971f97 100644
--- a/tests/test-getdate.c
+++ b/tests/test-getdate.c
@@ -61,7 +61,7 @@ static const char* const day_table[] =
 };

 int
-main (int argc _UNUSED_PARAMETER_, char **argv)
+main (int argc _GL_UNUSED, char **argv)
 {
   struct timespec result;
   struct timespec result2;
diff --git a/tests/test-getgroups.c b/tests/test-getgroups.c
index aed80f1..6d4a514 100644
--- a/tests/test-getgroups.c
+++ b/tests/test-getgroups.c
@@ -38,7 +38,7 @@
   while (0)

 int
-main (int argc, char **argv _UNUSED_PARAMETER_)
+main (int argc, char **argv _GL_UNUSED)
 {
   int result;
   gid_t *groups;
diff --git a/tests/test-gethostname.c b/tests/test-gethostname.c
index 32723da..af1293b 100644
--- a/tests/test-gethostname.c
+++ b/tests/test-gethostname.c
@@ -29,7 +29,7 @@
 #define NOHOSTNAME "magic-gnulib-test-string"

 int
-main (int argc, char *argv[] _UNUSED_PARAMETER_)
+main (int argc, char *argv[] _GL_UNUSED)
 {
   char buf[HOST_NAME_MAX];
   int rc;
diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c
index c9636a1..cb5a73b 100644
--- a/tests/test-quotearg.c
+++ b/tests/test-quotearg.c
@@ -378,7 +378,7 @@ use_quotearg_colon (const char *str, size_t *len)
 }

 int
-main (int argc _UNUSED_PARAMETER_, char *argv[])
+main (int argc _GL_UNUSED, char *argv[])
 {
   int i;
   bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
diff --git a/tests/test-version-etc.c b/tests/test-version-etc.c
index 9ff97c4..26940ab 100644
--- a/tests/test-version-etc.c
+++ b/tests/test-version-etc.c
@@ -24,7 +24,7 @@
 #define AUTHORS "Sergey Poznyakoff", "Eric Blake"

 int
-main (int argc _UNUSED_PARAMETER_, char **argv)
+main (int argc _GL_UNUSED, char **argv)
 {
   set_program_name (argv[0]);
   version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c
index 8b190d0..14cdbe6 100644
--- a/tests/test-xalloc-die.c
+++ b/tests/test-xalloc-die.c
@@ -22,7 +22,7 @@
 #include "progname.h"

 int
-main (int argc _UNUSED_PARAMETER_, char **argv)
+main (int argc _GL_UNUSED, char **argv)
 {
   set_program_name (argv[0]);
   xalloc_die ();
diff --git a/tests/test-xfprintf-posix.c b/tests/test-xfprintf-posix.c
index 70fb93a..b7adf76 100644
--- a/tests/test-xfprintf-posix.c
+++ b/tests/test-xfprintf-posix.c
@@ -44,7 +44,7 @@
 #include "test-fprintf-posix.h"

 int
-main (int argc _UNUSED_PARAMETER_, char *argv[])
+main (int argc _GL_UNUSED, char *argv[])
 {
   set_program_name (argv[0]);

diff --git a/tests/test-xprintf-posix.c b/tests/test-xprintf-posix.c
index baba042..501f04a 100644
--- a/tests/test-xprintf-posix.c
+++ b/tests/test-xprintf-posix.c
@@ -43,7 +43,7 @@
 #include "test-printf-posix.h"

 int
-main (int argc _UNUSED_PARAMETER_, char *argv[])
+main (int argc _GL_UNUSED, char *argv[])
 {
   set_program_name (argv[0]);

diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c
index a18994e..eb230db 100644
--- a/tests/test-xvasprintf.c
+++ b/tests/test-xvasprintf.c
@@ -130,7 +130,7 @@ test_xasprintf ()
 }

 int
-main (int argc _UNUSED_PARAMETER_, char *argv[])
+main (int argc _GL_UNUSED, char *argv[])
 {
   set_program_name (argv[0]);

-- 
1.6.4.2


reply via email to

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