]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-common: update for C2x 2020-12-11 draft
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 Jul 2021 19:56:24 +0000 (12:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Jul 2021 19:00:34 +0000 (12:00 -0700)
Use blessed-by-draft-standard way to test for [[__deprecated__]]
etc.; this is supported by GCC 11 and the fallback code should
work fine with GCC 10 and earlier, clang, etc.
* NEWS, doc/attribute.texi:
Mention that DEPRECATED etc. must now come first.
* lib/fflush.c, lib/unistr.in.h:
Do not include unused-parameter.h.  All uses of _GL_UNUSED_PARAMETER
(after parameters) replaced by _GL_ATTRIBUTE_MAYBE_UNUSED (before
parameters).  Although perhaps we need a shorter name for
_GL_ATTRIBUTE_MAYBE_UNUSED, that should probably be in
gnulib-common.m4, due to the ubiquity of this issue.
And perhaps the snippet/unused-parameter module should be marked
obsolete since it's no longer compatible with its old use.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macro
_GL_HAS_C_ATTRIBUTE, and use it instead of __STDC_VERSION__ in
deciding whether to use C2x attributes like [[__deprecated__]].
(_GL_ATTRIBUTE_MAYBE_UNUSED): Fall back on _GL_ATTRIBUTE_UNUSED.
(_GL_ATTRIBUTE_UNUSED): New macro, for labels where C2x
[[maybe_unused]] do not work.
(_GL_UNUSED, _GL_UNUSED_LABEL): Use it.
* modules/fflush, modules/unistr/base (Depends-on):
Remove snippet/unused-parameter.
* modules/fflush (selinux/selinux.h, selinux/context.h)
(selinux/label.h): Do not use $(UNUSED_PARAMETER).
Remove useless chmod a-x.

40 files changed:
ChangeLog
NEWS
doc/attribute.texi
lib/anytostr.c
lib/bitset.c
lib/bitset/array.c
lib/bitset/list.c
lib/bitset/stats.c
lib/bitset/table.c
lib/bitset/vector.c
lib/fflush.c
lib/fts_.h
lib/gl_anylinked_list2.h
lib/gl_anytree_list2.h
lib/gl_anytree_omap.h
lib/gl_anytree_oset.h
lib/gl_array_list.c
lib/gl_array_omap.c
lib/gl_array_oset.c
lib/gl_carray_list.c
lib/gl_list.h
lib/gl_map.h
lib/gl_omap.h
lib/gl_oset.h
lib/gl_set.h
lib/hamt.h
lib/hash.h
lib/inttostr.h
lib/safe-alloc.h
lib/se-context.in.h
lib/se-label.in.h
lib/se-selinux.in.h
lib/unistr.in.h
lib/unused-parameter.h
m4/gnulib-common.m4
modules/fflush
modules/selinux-h
modules/unistr/base
tests/test-asyncsafe-linked_list-weak.c
tests/test-ignore-value.c

index 5a1534844d8cd229107051d4726e5fbc1ed61baa..7e388c4ddcb5af7604e74aca4407403596df4463 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2021-07-30  Paul Eggert  <eggert@cs.ucla.edu>
 
+       gnulib-common: update for C2x 2020-12-11 draft
+       Use blessed-by-draft-standard way to test for [[__deprecated__]]
+       etc.; this is supported by GCC 11 and the fallback code should
+       work fine with GCC 10 and earlier.
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macro
+       _GL_HAS_C_ATTRIBUTE, and use it instead of __STDC_VERSION__ in
+       deciding whether to use C2x attributes like [[__deprecated__]].
+
        manywarnings: document GCC 11 warnings
        * build-aux/gcc-warning.spec: Add warnings introduced in GCC 11.
        None of them require Gnulib code changes, so this is just
diff --git a/NEWS b/NEWS
index 345afb1891c11bb69e59d37b204e37a68d11b514..e0f0d836c2a9141a3ae2c89ed7ce23a5d47e7895 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,15 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2021-07-29  (all)           Due to draft C2x, the following attributes should
+                            now appear at the start of a function declaration:
+                              _GL_ATTRIBUTE_DEPRECATED
+                              _GL_ATTRIBUTE_MAYBE_UNUSED
+                              _GL_ATTRIBUTE_NODISCARD
+            attribute       Likewise for DEPRECATED, MAYBE_UNUSED, NODISCARD.
+            snippet/unused-parameter
+                            Likewise for _GL_UNUSED_PARAMETER.
+
 2021-07-01  largefile       AC_SYS_LARGEFILE now also arranges for time_t
                             to be 64-bit on 32-bit GNU/Linux platforms
                             that support it (glibc 2.34 or later).
index acc282ba91d827f632bebbf8d38ae9cf410482d4..983dfc35093fbf114a3327e57d9838191be1d9e1 100644 (file)
@@ -23,11 +23,16 @@ Here is an example of its use:
 @example
 #include <attribute.h>
 
+NODISCARD
 extern char *crypt (char const *, char const *)
   ATTRIBUTE_NOTHROW ATTRIBUTE_LEAF ATTRIBUTE_NONNULL ((1, 2));
 @end example
 
 @noindent
+@code{NODISCARD} expands to @code{[[nodiscard]]} if the compiler
+supports this C2X syntax, otherwise to
+@code{__attribute__ ((__warn_unused_result__))} if the compiler
+is a recent-enough GCC or GCC-like compiler, otherwise to nothing.
 @code{ATTRIBUTE_NOTHROW} expands to @code{__attribute__
 ((__nothrow__))} if the compiler is a recent-enough GCC or GCC-like
 compiler, and to nothing otherwise.  Similarly for
@@ -41,3 +46,6 @@ names are not likely to clash with other macro names.
 These macros are @code{DEPRECATED}, @code{FALLTHROUGH},
 @code{MAYBE_UNUSED}, and @code{NODISCARD}, which can
 be defined to @code{[[deprecated]]} etc.@: on C2X platforms.
+Also, these exceptional macros should be placed at the start of
+function declarations, whereas the @code{ATTRIBUTE_*} macros can be
+placed at the end.
index 6daecb46a51577cf6eba5dffaef319ace8b76866..8294353f95ca44160c90cf80575ef7e0ff7c5766 100644 (file)
@@ -32,7 +32,7 @@
    INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
    printable string, which need not start at BUF.  */
 
-char * _GL_ATTRIBUTE_NODISCARD
+_GL_ATTRIBUTE_NODISCARD char *
 anytostr (inttype i, char *buf)
 {
   char *p = buf + INT_STRLEN_BOUND (inttype);
index 42092a3bd3deb56167f79830656f42cec632e1ea..7725828d7bf18248a69d63018f87d3f69503173d 100644 (file)
@@ -94,7 +94,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
    specified by ATTR.  For variable size bitsets, N_BITS is only a
    hint and may be zero.  */
 enum bitset_type
-bitset_type_choose (bitset_bindex n_bits MAYBE_UNUSED, unsigned attr)
+bitset_type_choose (MAYBE_UNUSED bitset_bindex n_bits, unsigned attr)
 {
   /* Check attributes.  */
   if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
index 6179b79bf5745b3a0871e0188bb681c6b2d236db..a984edefd24c897ce49d0d7eacdcaf33800a6d11 100644 (file)
@@ -84,7 +84,7 @@ abitset_small_list (bitset src, bitset_bindex *list,
 
 /* Set bit BITNO in bitset DST.  */
 static void
-abitset_set (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
+abitset_set (MAYBE_UNUSED bitset dst, MAYBE_UNUSED bitset_bindex bitno)
 {
   /* This should never occur for abitsets since we should always hit
      the cache.  It is likely someone is trying to access outside the
@@ -95,8 +95,8 @@ abitset_set (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
 
 /* Reset bit BITNO in bitset DST.  */
 static void
-abitset_reset (bitset dst MAYBE_UNUSED,
-               bitset_bindex bitno MAYBE_UNUSED)
+abitset_reset (MAYBE_UNUSED bitset dst,
+               MAYBE_UNUSED bitset_bindex bitno)
 {
   /* This should never occur for abitsets since we should always hit
      the cache.  It is likely someone is trying to access outside the
@@ -106,8 +106,8 @@ abitset_reset (bitset dst MAYBE_UNUSED,
 
 /* Test bit BITNO in bitset SRC.  */
 static bool
-abitset_test (bitset src MAYBE_UNUSED,
-              bitset_bindex bitno MAYBE_UNUSED)
+abitset_test (MAYBE_UNUSED bitset src,
+              MAYBE_UNUSED bitset_bindex bitno)
 {
   /* This should never occur for abitsets since we should always
      hit the cache.  */
index eb6e260c8f4e6d04a352bb1561249e87005923b0..6e8724ddd0e1622a239c57937149ac6a42f7be43 100644 (file)
@@ -1229,7 +1229,7 @@ struct bitset_vtable lbitset_vtable = {
 
 /* Return size of initial structure.  */
 size_t
-lbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
+lbitset_bytes (MAYBE_UNUSED bitset_bindex n_bits)
 {
   return sizeof (struct lbitset_struct);
 }
@@ -1237,7 +1237,7 @@ lbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
 
 /* Initialize a bitset.  */
 bitset
-lbitset_init (bitset bset, bitset_bindex n_bits MAYBE_UNUSED)
+lbitset_init (bitset bset, MAYBE_UNUSED bitset_bindex n_bits)
 {
   BITSET_NBITS_ (bset) = n_bits;
   bset->b.vtable = &lbitset_vtable;
index 7bceb6b38954980a1d86e42cfbe32034bc1a9f50..f998b2b55ec232decaca260a81e58ae556f18015 100644 (file)
@@ -208,7 +208,7 @@ bitset_stats_print_1 (FILE *file, const char *name,
 
 /* Print all bitset statistics to FILE.  */
 static void
-bitset_stats_print (FILE *file, bool verbose MAYBE_UNUSED)
+bitset_stats_print (FILE *file, MAYBE_UNUSED bool verbose)
 {
   if (!bitset_stats_info)
     return;
index 3b8db2a7f500e9172fbac4769480633178064fda..b74c8c1a7d2773549ae95282231b4464c15d6a72 100644 (file)
@@ -1132,7 +1132,7 @@ struct bitset_vtable tbitset_vtable = {
 
 /* Return size of initial structure.  */
 size_t
-tbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
+tbitset_bytes (MAYBE_UNUSED bitset_bindex n_bits)
 {
   return sizeof (struct tbitset_struct);
 }
index 6203e11e0f1d307f352a4afb133cf41b26f446f1..f0dc5f5b565e8fcdf7551daba37d85801e7091da 100644 (file)
@@ -126,7 +126,7 @@ vbitset_set (bitset dst, bitset_bindex bitno)
 
 /* Reset bit BITNO in bitset DST.  */
 static void
-vbitset_reset (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
+vbitset_reset (MAYBE_UNUSED bitset dst, MAYBE_UNUSED bitset_bindex bitno)
 {
   /* We must be accessing outside the cache so the bit is
      zero anyway.  */
@@ -135,8 +135,8 @@ vbitset_reset (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
 
 /* Test bit BITNO in bitset SRC.  */
 static bool
-vbitset_test (bitset src MAYBE_UNUSED,
-              bitset_bindex bitno MAYBE_UNUSED)
+vbitset_test (MAYBE_UNUSED bitset src,
+              MAYBE_UNUSED bitset_bindex bitno)
 {
   /* We must be accessing outside the cache so the bit is
      zero anyway.  */
@@ -964,7 +964,7 @@ struct bitset_vtable vbitset_vtable = {
 
 
 size_t
-vbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
+vbitset_bytes (MAYBE_UNUSED bitset_bindex n_bits)
 {
   return sizeof (struct vbitset_struct);
 }
index 7e27c67c11f5ae750d8dfc8020bdaddcf8fdcac1..8fe9d262d2431af51bddf14c2a2bf18adec7ca6f 100644 (file)
@@ -28,8 +28,6 @@
 
 #include "stdio-impl.h"
 
-#include "unused-parameter.h"
-
 #undef fflush
 
 
@@ -96,8 +94,8 @@ restore_seek_optimization (FILE *fp, int saved_flags)
 # else
 
 static void
-update_fpos_cache (FILE *fp _GL_UNUSED_PARAMETER,
-                   off_t pos _GL_UNUSED_PARAMETER)
+update_fpos_cache (_GL_ATTRIBUTE_MAYBE_UNUSED FILE *fp,
+                   _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos)
 {
 #  if defined __sferror || defined __DragonFly__ || defined __ANDROID__
   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
index f1265302b3ad25f9017574f4fb3cc25b2e14bc34..9f4419c0a1062a71e20deef1dbeb2210c5781d70 100644 (file)
@@ -250,12 +250,21 @@ typedef struct _ftsent {
 } FTSENT;
 
 __BEGIN_DECLS
-FTSENT  *fts_children (FTS *, int) __THROW _GL_ATTRIBUTE_NODISCARD;
-int      fts_close (FTS *) __THROW _GL_ATTRIBUTE_NODISCARD;
+
+ _GL_ATTRIBUTE_NODISCARD
+FTSENT  *fts_children (FTS *, int) __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
+int      fts_close (FTS *) __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
 FTS     *fts_open (char * const *, int,
                    int (*)(const FTSENT **, const FTSENT **))
-  __THROW _GL_ATTRIBUTE_NODISCARD;
-FTSENT  *fts_read (FTS *) __THROW _GL_ATTRIBUTE_NODISCARD;
+  __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
+FTSENT  *fts_read (FTS *) __THROW;
+
 int      fts_set (FTS *, FTSENT *, int) __THROW;
 __END_DECLS
 
index 176403a7f4edac9c982826f0f54ebc4258aa0f67..8ed54cab7e742c8213e317248f56a8e13b2d86af 100644 (file)
@@ -170,14 +170,14 @@ gl_linked_size (gl_list_t list)
 }
 
 static const void * _GL_ATTRIBUTE_PURE
-gl_linked_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_linked_node_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                       gl_list_node_t node)
 {
   return node->value;
 }
 
 static int
-gl_linked_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_linked_node_nx_set_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                              gl_list_node_t node,
                              const void *elt)
 {
@@ -1041,7 +1041,7 @@ gl_linked_iterator_next (gl_list_iterator_t *iterator,
 }
 
 static void
-gl_linked_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_linked_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *iterator)
 {
 }
 
index 559ded61d1e177c56826da2877a707c37cdfca0b..536fc30c61b4518648aa09b665e22f86d2d421b0 100644 (file)
@@ -60,14 +60,14 @@ gl_tree_size (gl_list_t list)
 }
 
 static const void * _GL_ATTRIBUTE_PURE
-gl_tree_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_tree_node_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                     gl_list_node_t node)
 {
   return node->value;
 }
 
 static int
-gl_tree_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_tree_node_nx_set_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                            gl_list_node_t node, const void *elt)
 {
 #if WITH_HASHTABLE
@@ -103,7 +103,7 @@ gl_tree_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
 }
 
 static gl_list_node_t _GL_ATTRIBUTE_PURE
-gl_tree_next_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_tree_next_node (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                    gl_list_node_t node)
 {
   if (node->right != NULL)
@@ -122,7 +122,7 @@ gl_tree_next_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
 }
 
 static gl_list_node_t _GL_ATTRIBUTE_PURE
-gl_tree_previous_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
+gl_tree_previous_node (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
                        gl_list_node_t node)
 {
   if (node->left != NULL)
@@ -141,7 +141,7 @@ gl_tree_previous_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED,
 }
 
 static gl_list_node_t _GL_ATTRIBUTE_PURE
-gl_tree_first_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_tree_first_node (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list)
 {
   gl_list_node_t node = list->root;
 
@@ -154,7 +154,7 @@ gl_tree_first_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED)
 }
 
 static gl_list_node_t _GL_ATTRIBUTE_PURE
-gl_tree_last_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_tree_last_node (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list)
 {
   gl_list_node_t node = list->root;
 
@@ -658,7 +658,7 @@ gl_tree_iterator_next (gl_list_iterator_t *iterator,
 }
 
 static void
-gl_tree_iterator_free (gl_list_iterator_t *iterator  _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_tree_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *iterator)
 {
 }
 
index 62c33a15a6ad7142514bdb79adaf9b8621e4a565..0550ce74907fe736152139eeb852757d4ce6c3e6 100644 (file)
@@ -300,6 +300,6 @@ gl_tree_iterator_next (gl_omap_iterator_t *iterator,
 }
 
 static void
-gl_tree_iterator_free (gl_omap_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_tree_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_omap_iterator_t *iterator)
 {
 }
index 9f5161ac638e36c0c6a8f67a23730f13f02ac642..51232052191fba861920631cd176ce2c87346637 100644 (file)
@@ -438,6 +438,6 @@ gl_tree_iterator_next (gl_oset_iterator_t *iterator, const void **eltp)
 }
 
 static void
-gl_tree_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_tree_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_oset_iterator_t *iterator)
 {
 }
index 4d6500cd2dadb513cd4f38e41df92602f61aa332..8485d60fda76fac2ae073f7b7dc12a7a9a115992 100644 (file)
@@ -527,7 +527,7 @@ gl_array_iterator_next (gl_list_iterator_t *iterator,
 }
 
 static void
-gl_array_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_array_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *iterator)
 {
 }
 
index b1e0257771016fe4bd62395d7443282a8c1ba167..d3d4e7b14eca45fa61b2841182a8548ccbee555a 100644 (file)
@@ -370,7 +370,7 @@ gl_array_iterator_next (gl_omap_iterator_t *iterator,
 }
 
 static void
-gl_array_iterator_free (gl_omap_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_array_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_omap_iterator_t *iterator)
 {
 }
 
index 342c8d86e13b52e75556175d5964fd0991f6d10f..146d54e813084acc0ce03693ce3d7c1d8914559f 100644 (file)
@@ -488,7 +488,7 @@ gl_array_iterator_next (gl_oset_iterator_t *iterator, const void **eltp)
 }
 
 static void
-gl_array_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_array_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_oset_iterator_t *iterator)
 {
 }
 
index 33f2338604e1d8233014a9e4006ab7fdbd6aea2a..f7fa0d118e8b3dba4ec24c72cafa28f226c6c480 100644 (file)
@@ -699,7 +699,7 @@ gl_carray_iterator_next (gl_list_iterator_t *iterator,
 }
 
 static void
-gl_carray_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED)
+gl_carray_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *iterator)
 {
 }
 
index d600580efe3738f294f1f9210e7b18b7438ed608..e2da4f1b8dc8208a7c38ec33ef0899ae214c147c 100644 (file)
@@ -197,9 +197,9 @@ extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node);
 extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
                                     const void *elt);
 /* Likewise.  Returns 0 upon success, -1 upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
-                                      const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                      const void *elt);
 
 /* Returns the node immediately after the given node in the list, or NULL
    if the given node is the last (rightmost) one in the list.  */
@@ -245,9 +245,9 @@ extern const void * gl_list_get_last (gl_list_t list);
 extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
                                       const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position,
-                                         const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                         const void *elt);
 
 /* Replaces the element at the first position in the list.
    Returns its node.
@@ -255,8 +255,8 @@ extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position,
 /* declared in gl_xlist.h */
 extern gl_list_node_t gl_list_set_first (gl_list_t list, const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
-extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt);
 
 /* Replaces the element at the last position in the list.
    Returns its node.
@@ -264,8 +264,8 @@ extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt)
 /* declared in gl_xlist.h */
 extern gl_list_node_t gl_list_set_last (gl_list_t list, const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
-extern gl_list_node_t gl_list_nx_set_last (gl_list_t list, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern gl_list_node_t gl_list_nx_set_last (gl_list_t list, const void *elt);
 
 /* Searches whether an element is already in the list.
    Returns its node if found, or NULL if not present in the list.  */
@@ -307,16 +307,16 @@ extern size_t gl_list_indexof_from_to (gl_list_t list,
 /* declared in gl_xlist.h */
 extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
-extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt);
 
 /* Adds an element as the last element of the list.
    Returns its node.  */
 /* declared in gl_xlist.h */
 extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
-extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt);
 
 /* Adds an element before a given element node of the list.
    Returns its node.  */
@@ -324,10 +324,10 @@ extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt)
 extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
                                           const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern gl_list_node_t gl_list_nx_add_before (gl_list_t list,
                                              gl_list_node_t node,
-                                             const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                             const void *elt);
 
 /* Adds an element after a given element node of the list.
    Returns its node.  */
@@ -335,9 +335,9 @@ extern gl_list_node_t gl_list_nx_add_before (gl_list_t list,
 extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
                                          const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node,
-                                            const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                            const void *elt);
 
 /* Adds an element at a given position in the list.
    POSITION must be >= 0 and <= gl_list_size (list).  */
@@ -345,9 +345,9 @@ extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node,
 extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
                                       const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position,
-                                         const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                         const void *elt);
 
 /* Removes an element from the list.
    Returns true.  */
@@ -488,10 +488,10 @@ extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
                                          gl_listelement_compar_fn compar,
                                          const void *elt);
 /* Likewise.  Returns NULL upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list,
                                             gl_listelement_compar_fn compar,
-                                            const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+                                            const void *elt);
 
 /* Searches and removes an element from the list.
    The list is assumed to be sorted with COMPAR.
@@ -630,7 +630,7 @@ gl_list_node_value (gl_list_t list, gl_list_node_t node)
          ->node_value (list, node);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE int
 gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
                            const void *elt)
 {
@@ -685,20 +685,20 @@ gl_list_get_last (gl_list_t list)
   return gl_list_get_at (list, gl_list_size (list) - 1);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
          ->nx_set_at (list, position, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_set_first (gl_list_t list, const void *elt)
 {
   return gl_list_nx_set_at (list, 0, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_set_last (gl_list_t list, const void *elt)
 {
   return gl_list_nx_set_at (list, gl_list_size (list) - 1, elt);
@@ -752,35 +752,35 @@ gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
          ->indexof_from_to (list, start_index, end_index, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_add_first (gl_list_t list, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
          ->nx_add_first (list, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_add_last (gl_list_t list, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
          ->nx_add_last (list, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
          ->nx_add_before (list, node, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
          ->nx_add_after (list, node, elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
@@ -891,7 +891,7 @@ gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar,
                                        elt);
 }
 
-GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t
+_GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
 gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
 {
   return ((const struct gl_list_impl_base *) list)->vtable
index 051ec5944e4fed228dffe402bb7609ad0998c22a..118d4e321cecfba8f09e2f3db4e8e8c7821eb08f 100644 (file)
@@ -145,8 +145,8 @@ extern bool gl_map_search (gl_map_t map, const void *key, const void **valuep);
 /* declared in gl_xmap.h */
 extern bool gl_map_put (gl_map_t map, const void *key, const void *value);
 /* Likewise.  Returns -1 upon out-of-memory.  */
-extern int gl_map_nx_put (gl_map_t map, const void *key, const void *value)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern int gl_map_nx_put (gl_map_t map, const void *key, const void *value);
 
 /* Adds a pair to a map and retrieves the previous value.
    Returns true if a pair with the given key was not already in the map and so
@@ -157,9 +157,9 @@ extern int gl_map_nx_put (gl_map_t map, const void *key, const void *value)
 extern bool gl_map_getput (gl_map_t map, const void *key, const void *value,
                            const void **oldvaluep);
 /* Likewise.  Returns -1 upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern int gl_map_nx_getput (gl_map_t map, const void *key, const void *value,
-                             const void **oldvaluep)
-  _GL_ATTRIBUTE_NODISCARD;
+                             const void **oldvaluep);
 
 /* Removes a pair from a map.
    Returns true if the key was found and its pair removed.
@@ -280,7 +280,7 @@ gl_map_search (gl_map_t map, const void *key, const void **valuep)
          ->search (map, key, valuep);
 }
 
-GL_MAP_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
 gl_map_nx_getput (gl_map_t map, const void *key, const void *value,
                    const void **oldvaluep)
 {
@@ -331,7 +331,7 @@ gl_map_get (gl_map_t map, const void *key)
   return value;
 }
 
-GL_MAP_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_MAP_INLINE int
 gl_map_nx_put (gl_map_t map, const void *key, const void *value)
 {
   const void *oldvalue;
index ca6916c82f55cf5b19fdd2a06b2c277a525c95a6..b2dacfb28342387e3094268756265edcd48a6674 100644 (file)
@@ -155,8 +155,8 @@ extern bool gl_omap_search_atleast (gl_omap_t map,
 /* declared in gl_xomap.h */
 extern bool gl_omap_put (gl_omap_t map, const void *key, const void *value);
 /* Likewise.  Returns -1 upon out-of-memory.  */
-extern int gl_omap_nx_put (gl_omap_t map, const void *key, const void *value)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern int gl_omap_nx_put (gl_omap_t map, const void *key, const void *value);
 
 /* Adds a pair to an ordered map and retrieves the previous value.
    Returns true if a pair with the given key was not already in the map and so
@@ -167,9 +167,9 @@ extern int gl_omap_nx_put (gl_omap_t map, const void *key, const void *value)
 extern bool gl_omap_getput (gl_omap_t map, const void *key, const void *value,
                             const void **oldvaluep);
 /* Likewise.  Returns -1 upon out-of-memory.  */
+_GL_ATTRIBUTE_NODISCARD
 extern int gl_omap_nx_getput (gl_omap_t map, const void *key, const void *value,
-                              const void **oldvaluep)
-  _GL_ATTRIBUTE_NODISCARD;
+                              const void **oldvaluep);
 
 /* Removes a pair from an ordered map.
    Returns true if the key was found and its pair removed.
@@ -298,7 +298,7 @@ gl_omap_search_atleast (gl_omap_t map,
          ->search_atleast (map, threshold_fn, threshold, keyp, valuep);
 }
 
-GL_OMAP_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_OMAP_INLINE int
 gl_omap_nx_getput (gl_omap_t map, const void *key, const void *value,
                    const void **oldvaluep)
 {
@@ -349,7 +349,7 @@ gl_omap_get (gl_omap_t map, const void *key)
   return value;
 }
 
-GL_OMAP_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_OMAP_INLINE int
 gl_omap_nx_put (gl_omap_t map, const void *key, const void *value)
 {
   const void *oldvalue;
index b9ce896d192b8b748e6a3601087aee7b7b91001e..ac90f0445d75ac8ba8da8e82d0a7ca873741e791 100644 (file)
@@ -134,9 +134,10 @@ extern bool gl_oset_search_atleast (gl_oset_t set,
    Returns true if it was not already in the set and added, false otherwise.  */
 /* declared in gl_xoset.h */
 extern bool gl_oset_add (gl_oset_t set, const void *elt);
+
 /* Likewise.  Returns -1 upon out-of-memory.  */
-extern int gl_oset_nx_add (gl_oset_t set, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern int gl_oset_nx_add (gl_oset_t set, const void *elt);
 
 /* Removes an element from an ordered set.
    Returns true if it was found and removed.  */
@@ -272,7 +273,7 @@ gl_oset_search_atleast (gl_oset_t set,
          ->search_atleast (set, threshold_fn, threshold, eltp);
 }
 
-GL_OSET_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_OSET_INLINE int
 gl_oset_nx_add (gl_oset_t set, const void *elt)
 {
   return ((const struct gl_oset_impl_base *) set)->vtable->nx_add (set, elt);
index 3a05b9304197013b3644244a5d6af5cda05ad807..4e68cc739d38ef66d1668fa84fe47045cc83562f 100644 (file)
@@ -124,9 +124,10 @@ extern bool gl_set_search (gl_set_t set, const void *elt);
    Returns true if it was not already in the set and added, false otherwise.  */
 /* declared in gl_xset.h */
 extern bool gl_set_add (gl_set_t set, const void *elt);
+
 /* Likewise.  Returns -1 upon out-of-memory.  */
-extern int gl_set_nx_add (gl_set_t set, const void *elt)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern int gl_set_nx_add (gl_set_t set, const void *elt);
 
 /* Removes an element from a set.
    Returns true if it was found and removed.  */
@@ -230,7 +231,7 @@ gl_set_search (gl_set_t set, const void *elt)
   return ((const struct gl_set_impl_base *) set)->vtable->search (set, elt);
 }
 
-GL_SET_INLINE _GL_ATTRIBUTE_NODISCARD int
+_GL_ATTRIBUTE_NODISCARD GL_SET_INLINE int
 gl_set_nx_add (gl_set_t set, const void *elt)
 {
   return ((const struct gl_set_impl_base *) set)->vtable->nx_add (set, elt);
index 25a0ad9f9dafc7cc1268e1458a8eb1a358a46942..6bbc6a3f4239c3238ac01b5f7de18ec6a1b32aff 100644 (file)
@@ -139,14 +139,15 @@ typedef void (Hamt_freer) (Hamt_entry *elt);
 /****************************/
 
 /* Create and return a new and empty hash array mapped trie.  */
+_GL_ATTRIBUTE_NODISCARD
 extern Hamt *hamt_create (Hamt_hasher *hasher, Hamt_comparator *comparator,
-                          Hamt_freer *freer)
-  _GL_ATTRIBUTE_NODISCARD;
+                          Hamt_freer *freer);
 
 /* Return a copy of HAMT, which is not the same in the sense above.
    This procedure can be used, for example, so that two threads can
    access the same data independently.  */
-extern Hamt *hamt_copy (Hamt *hamt) _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern Hamt *hamt_copy (Hamt *hamt);
 
 /* Free the resources solely allocated by HAMT and all elements solely
    contained in it.  */
@@ -167,20 +168,20 @@ extern Hamt_entry *hamt_lookup (const Hamt *hamt, const void *elt);
 /* If *ELT_PTR matches an element already in HAMT, set *ELT_PTR to the
    existing element and return the original hamt.  Otherwise, insert
    *ELT_PTR into a copy of the hamt and return the copy.  */
-extern Hamt *hamt_insert (Hamt *hamt, Hamt_entry **elt_ptr)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern Hamt *hamt_insert (Hamt *hamt, Hamt_entry **elt_ptr);
 
 /* If *ELT_PTR matches an element already in HAMT, set *ELT_PTR to the
 existing element, remove the element from a copy of the hamt and
 return the copy.  Otherwise, return the original hamt.  */
-extern Hamt *hamt_remove (Hamt *hamt, Hamt_entry **elt_ptr)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern Hamt *hamt_remove (Hamt *hamt, Hamt_entry **elt_ptr);
 
 /* Insert *ELT_PTR into a copy of HAMT and return the copy.  If an
    existing element was replaced, set *ELT_PTR to this element, and to
    NULL otherwise.  */
-extern Hamt *hamt_replace (Hamt *hamt, Hamt_entry **elt_ptr)
-  _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern Hamt *hamt_replace (Hamt *hamt, Hamt_entry **elt_ptr);
 
 /*************/
 /* Iteration */
index a52736d3b69ee09e6f92c7f422f2fdc88b5abba3..230d5cd3805b3fd9e63afbd65ebccb4dcc9a8992 100644 (file)
@@ -172,21 +172,21 @@ typedef void (*Hash_data_freer) (void *entry);
    all of your 'data' data.  This is typically the case when your data is
    simply an auxiliary struct that you have malloc'd to aggregate several
    values.  */
+_GL_ATTRIBUTE_NODISCARD
 extern Hash_table *hash_initialize (size_t candidate,
                                     const Hash_tuning *tuning,
                                     Hash_hasher hasher,
                                     Hash_comparator comparator,
-                                    Hash_data_freer data_freer)
-       _GL_ATTRIBUTE_NODISCARD;
+                                    Hash_data_freer data_freer);
 
 /* Same as hash_initialize, but invokes xalloc_die on memory exhaustion.  */
 /* This function is defined by module 'xhash'.  */
+_GL_ATTRIBUTE_NODISCARD
 extern Hash_table *hash_xinitialize (size_t candidate,
                                      const Hash_tuning *tuning,
                                      Hash_hasher hasher,
                                      Hash_comparator comparator,
-                                     Hash_data_freer data_freer)
-       _GL_ATTRIBUTE_NODISCARD;
+                                     Hash_data_freer data_freer);
 
 /* Make all buckets empty, placing any chained entries on the free list.
    Apply the user-specified function data_freer (if any) to the datas of any
@@ -210,16 +210,16 @@ extern void hash_free (Hash_table *table);
    those already in the table, before any other growth of the hash table size
    occurs.  If TUNING->IS_N_BUCKETS is true, then CANDIDATE specifies the
    exact number of buckets desired.  Return true iff the rehash succeeded.  */
-extern bool hash_rehash (Hash_table *table, size_t candidate)
-       _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern bool hash_rehash (Hash_table *table, size_t candidate);
 
 /* If ENTRY matches an entry already in the hash table, return the pointer
    to the entry from the table.  Otherwise, insert ENTRY and return ENTRY.
    Return NULL if the storage required for insertion cannot be allocated.
    This implementation does not support duplicate entries or insertion of
    NULL.  */
-extern void *hash_insert (Hash_table *table, const void *entry)
-       _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD
+extern void *hash_insert (Hash_table *table, const void *entry);
 
 /* Same as hash_insert, but invokes xalloc_die on memory exhaustion.  */
 /* This function is defined by module 'xhash'.  */
@@ -251,8 +251,8 @@ extern void *hash_remove (Hash_table *table, const void *entry);
 
 /* Same as hash_remove.  This interface is deprecated.
    FIXME: Remove in 2022.  */
-extern void *hash_delete (Hash_table *table, const void *entry)
-       _GL_ATTRIBUTE_DEPRECATED;
+_GL_ATTRIBUTE_DEPRECATED
+extern void *hash_delete (Hash_table *table, const void *entry);
 
 # ifdef __cplusplus
 }
index 9dcac70e9df9b6b02d286fddbd49c1a89828fe93..db1f8fa67dfd8cf992d70aa58967cd541ee86d0a 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "intprops.h"
 
-char *imaxtostr (intmax_t, char *) _GL_ATTRIBUTE_NODISCARD;
-char *inttostr (int, char *) _GL_ATTRIBUTE_NODISCARD;
-char *offtostr (off_t, char *) _GL_ATTRIBUTE_NODISCARD;
-char *uinttostr (unsigned int, char *) _GL_ATTRIBUTE_NODISCARD;
-char *umaxtostr (uintmax_t, char *) _GL_ATTRIBUTE_NODISCARD;
+_GL_ATTRIBUTE_NODISCARD char *imaxtostr (intmax_t, char *);
+_GL_ATTRIBUTE_NODISCARD char *inttostr (int, char *);
+_GL_ATTRIBUTE_NODISCARD char *offtostr (off_t, char *);
+_GL_ATTRIBUTE_NODISCARD char *uinttostr (unsigned int, char *);
+_GL_ATTRIBUTE_NODISCARD char *umaxtostr (uintmax_t, char *);
index 3ba9d2fc2d4253e711ce272587b423ced0e65102..b54d9b4729ee7671c700b972f6ad8d954fe30724 100644 (file)
@@ -38,7 +38,7 @@ safe_alloc_realloc_n (void *ptr, size_t count, size_t size)
     count = size = 1;
   return reallocarray (ptr, count, size);
 }
-SAFE_ALLOC_INLINE int _GL_ATTRIBUTE_NODISCARD
+_GL_ATTRIBUTE_NODISCARD SAFE_ALLOC_INLINE int
 safe_alloc_check (void *ptr)
 {
   /* Return 0 if the allocation was successful, -1 otherwise.  */
index 999a7b413cf8da15bc7511d45922f54d9e8e4e3e..d4ed6a4c1aca8029f96433aa6e684bef2b579718 100644 (file)
@@ -29,34 +29,42 @@ _GL_INLINE_HEADER_BEGIN
 # define SE_CONTEXT_INLINE _GL_INLINE
 #endif
 
-/* The definition of _GL_UNUSED_PARAMETER is copied here.  */
-
 typedef int context_t;
-SE_CONTEXT_INLINE context_t context_new (char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE context_t
+context_new (_GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
   { errno = ENOTSUP; return 0; }
-SE_CONTEXT_INLINE char *context_str (context_t con _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *
+context_str (_GL_ATTRIBUTE_MAYBE_UNUSED context_t con)
   { errno = ENOTSUP; return (void *) 0; }
-SE_CONTEXT_INLINE void context_free (context_t c _GL_UNUSED_PARAMETER) {}
+SE_CONTEXT_INLINE void context_free (_GL_ATTRIBUTE_MAYBE_UNUSED context_t c) {}
 
-SE_CONTEXT_INLINE int context_user_set (context_t sc _GL_UNUSED_PARAMETER,
-                                        char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int
+context_user_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
   { errno = ENOTSUP; return -1; }
-SE_CONTEXT_INLINE int context_role_set (context_t sc _GL_UNUSED_PARAMETER,
-                                        char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int
+context_role_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
   { errno = ENOTSUP; return -1; }
-SE_CONTEXT_INLINE int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
-                                         char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int
+context_range_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                   _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
   { errno = ENOTSUP; return -1; }
-SE_CONTEXT_INLINE int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
-                                        char const *s _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE int
+context_type_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
   { errno = ENOTSUP; return -1; }
-SE_CONTEXT_INLINE char *context_type_get (context_t sc _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *
+context_type_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
   { errno = ENOTSUP; return (void *) 0; }
-SE_CONTEXT_INLINE char *context_range_get (context_t sc _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *
+context_range_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
   { errno = ENOTSUP; return (void *) 0; }
-SE_CONTEXT_INLINE char *context_role_get (context_t sc _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *
+context_role_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
   { errno = ENOTSUP; return (void *) 0; }
-SE_CONTEXT_INLINE char *context_user_get (context_t sc _GL_UNUSED_PARAMETER)
+SE_CONTEXT_INLINE char *
+context_user_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
   { errno = ENOTSUP; return (void *) 0; }
 
 _GL_INLINE_HEADER_END
index 8d892974545a1c0dbca999fdf793eb5cf1f80c74..2bf1eb88c2b5c58479d08c5e258bb29d8bb8f7f7 100644 (file)
@@ -31,27 +31,25 @@ _GL_INLINE_HEADER_BEGIN
 # define SE_LABEL_INLINE _GL_INLINE
 #endif
 
-/* The definition of _GL_UNUSED_PARAMETER is copied here.  */
-
 #define SELABEL_CTX_FILE 0
 
 struct selabel_handle;
 
 SE_LABEL_INLINE int
-selabel_lookup (struct selabel_handle *hnd _GL_UNUSED_PARAMETER,
-                char **context _GL_UNUSED_PARAMETER,
-                char const *key _GL_UNUSED_PARAMETER,
-                int type _GL_UNUSED_PARAMETER)
+selabel_lookup (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char **context,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char const *key,
+                _GL_ATTRIBUTE_MAYBE_UNUSED int type)
 { errno = ENOTSUP; return -1; }
 
 SE_LABEL_INLINE struct selabel_handle *
-selabel_open (int backend _GL_UNUSED_PARAMETER,
-              struct selinux_opt *options _GL_UNUSED_PARAMETER,
-              unsigned nopt _GL_UNUSED_PARAMETER)
+selabel_open (_GL_ATTRIBUTE_MAYBE_UNUSED int backend,
+              _GL_ATTRIBUTE_MAYBE_UNUSED struct selinux_opt *options,
+              _GL_ATTRIBUTE_MAYBE_UNUSED unsigned nopt)
 { errno = ENOTSUP; return 0; }
 
 SE_LABEL_INLINE void
-selabel_close (struct selabel_handle *hnd _GL_UNUSED_PARAMETER)
+selabel_close (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd)
 { errno = ENOTSUP; }
 
 _GL_INLINE_HEADER_END
index 60cc493e6953d589803c354b7a687b871703936f..85dae11810f6428389cc7a7729b8d24764ad1250 100644 (file)
@@ -38,8 +38,6 @@ _GL_INLINE_HEADER_BEGIN
 #   define SE_SELINUX_INLINE _GL_INLINE
 #  endif
 
-/* The definition of _GL_UNUSED_PARAMETER is copied here.  */
-
 #  if !GNULIB_defined_security_types
 
 typedef unsigned short security_class_t;
@@ -47,67 +45,67 @@ struct selinux_opt;
 #   define is_selinux_enabled() 0
 
 SE_SELINUX_INLINE int
-getcon (char **con _GL_UNUSED_PARAMETER)
+getcon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE void
-freecon (char *con _GL_UNUSED_PARAMETER) {}
+freecon (_GL_ATTRIBUTE_MAYBE_UNUSED char *con) {}
 
 SE_SELINUX_INLINE int
-getfscreatecon (char **con _GL_UNUSED_PARAMETER)
+getfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-setfscreatecon (char const *con _GL_UNUSED_PARAMETER)
+setfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-matchpathcon (char const *file _GL_UNUSED_PARAMETER,
-              mode_t m _GL_UNUSED_PARAMETER,
-              char **con _GL_UNUSED_PARAMETER)
+matchpathcon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+              _GL_ATTRIBUTE_MAYBE_UNUSED mode_t m,
+              _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-getfilecon (char const *file _GL_UNUSED_PARAMETER,
-            char **con _GL_UNUSED_PARAMETER)
+getfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+            _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
-             char **con _GL_UNUSED_PARAMETER)
+lgetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+             _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-fgetfilecon (int fd, char **con _GL_UNUSED_PARAMETER)
+fgetfilecon (int fd,_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-setfilecon (char const *file _GL_UNUSED_PARAMETER,
-            char const *con _GL_UNUSED_PARAMETER)
+setfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+            _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
-             char const *con _GL_UNUSED_PARAMETER)
+lsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+             _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 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; }
 
 SE_SELINUX_INLINE int
-security_check_context (char const *con _GL_UNUSED_PARAMETER)
+security_check_context (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-security_check_context_raw (char const *con _GL_UNUSED_PARAMETER)
+security_check_context_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-setexeccon (char const *con _GL_UNUSED_PARAMETER)
+setexeccon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE int
-security_compute_create (char const *scon _GL_UNUSED_PARAMETER,
-                         char const *tcon _GL_UNUSED_PARAMETER,
-                         security_class_t tclass _GL_UNUSED_PARAMETER,
-                         char **newcon _GL_UNUSED_PARAMETER)
+security_compute_create (_GL_ATTRIBUTE_MAYBE_UNUSED char const *scon,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED char const *tcon,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED security_class_t tclass,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED char **newcon)
   { errno = ENOTSUP; return -1; }
 SE_SELINUX_INLINE security_class_t
 string_to_security_class (char const *name)
   { errno = ENOTSUP; return 0; }
 SE_SELINUX_INLINE int
-matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
-                          char const *prefix _GL_UNUSED_PARAMETER)
+matchpathcon_init_prefix (_GL_ATTRIBUTE_MAYBE_UNUSED char const *path,
+                          _GL_ATTRIBUTE_MAYBE_UNUSED char const *prefix)
   { errno = ENOTSUP; return -1; }
 
 #   define GNULIB_defined_security_types 1
index 2441a72b8116ba4d6638473e7f6fa6704c7f3746..ed657773c4893430880df2b4bb51e2bceced0d37 100644 (file)
@@ -19,9 +19,6 @@
 
 #include "unitypes.h"
 
-/* Get common macros for C.  */
-#include "unused-parameter.h"
-
 /* Get bool.  */
 #include <stdbool.h>
 
@@ -193,7 +190,7 @@ extern int
 # else
 static inline int
 u32_mbtouc_unsafe (ucs4_t *puc,
-                   const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
+                   const uint32_t *s, _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)
 {
   uint32_t c = *s;
 
@@ -259,7 +256,8 @@ 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 _GL_UNUSED_PARAMETER)
+u32_mbtouc (ucs4_t *puc, const uint32_t *s,
+            _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)
 {
   uint32_t c = *s;
 
index 34f05d9efb43db3e1b82388f667cec79edf93183..047a0d895be69c9035d6e3f55ac686863867ffb1 100644 (file)
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
-/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
+/* _GL_UNUSED_PARAMETER is a marker that can be prepended to function parameter
    declarations for parameters that are not used.  This helps to reduce
    warnings, such as from GCC -Wunused-parameter.  The syntax is as follows:
-       type param _GL_UNUSED_PARAMETER
+       _GL_UNUSED_PARAMETER type param
    or more generally
-       param_decl _GL_UNUSED_PARAMETER
+       _GL_UNUSED_PARAMETER param_decl
    For example:
-       int param _GL_UNUSED_PARAMETER
-       int *(*param)(void) _GL_UNUSED_PARAMETER
-   Other possible, but obscure and discouraged syntaxes:
-       int _GL_UNUSED_PARAMETER *(*param)(void)
-       _GL_UNUSED_PARAMETER int *(*param)(void)
+       _GL_UNUSED_PARAMETER int param
+       _GL_UNUSED_PARAMETER int *(*param) (void)
  */
 #ifndef _GL_UNUSED_PARAMETER
 # define _GL_UNUSED_PARAMETER _GL_ATTRIBUTE_MAYBE_UNUSED
index bfa1645db25e764b3208653187c2e9da7043124a..347462d1d9d74b09954ef19393d6fdb7355e2f08 100644 (file)
@@ -103,6 +103,12 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
 #endif
 
+#ifdef __has_c_attribute
+# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
+#else
+# define _GL_HAS_C_ATTRIBUTE(attr) 0
+#endif
+
 ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead.
 [
 #if _GL_HAS_ATTRIBUTE (alloc_size)
@@ -142,7 +148,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTRIBUTE_CONST
 #endif
 
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (deprecated)
 # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
 #elif _GL_HAS_ATTRIBUTE (deprecated)
 # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
@@ -168,7 +174,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 #endif
 
 /* FALLTHROUGH is special, because it always expands to something.  */
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (fallthrough)
 # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
 #elif _GL_HAS_ATTRIBUTE (fallthrough)
 # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
@@ -195,15 +201,12 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTRIBUTE_MAY_ALIAS
 #endif
 
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (maybe_unused)
 # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
-#elif _GL_HAS_ATTRIBUTE (unused)
-# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
 #else
-# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
 #endif
 /* Earlier spellings of this macro.  */
-#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
 #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
 
 #if _GL_HAS_ATTRIBUTE (malloc)
@@ -212,7 +215,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTRIBUTE_MALLOC
 #endif
 
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (nodiscard)
 # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
 #elif _GL_HAS_ATTRIBUTE (warn_unused_result)
 # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
@@ -270,11 +273,19 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTRIBUTE_SENTINEL(pos)
 #endif
 
+#if _GL_HAS_ATTRIBUTE (unused)
+# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#else
+# define _GL_ATTRIBUTE_UNUSED
+#endif
+/* Earlier spellings of this macro.  */
+#define _GL_UNUSED _GL_ATTRIBUTE_UNUSED
+
 ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
 [
 /* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'.  */
 #if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5)
-# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED
+# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
 #else
 # define _GL_UNUSED_LABEL
 #endif
index 858a25aaf278055103fb6b00aa951947bcdf66e6..bda975a2a59262e951eb7fac775cb89f97b0940e 100644 (file)
@@ -8,7 +8,6 @@ m4/fflush.m4
 
 Depends-on:
 stdio
-snippet/unused-parameter  [test $REPLACE_FFLUSH = 1]
 fpurge                    [test $REPLACE_FFLUSH = 1]
 ftello                    [test $REPLACE_FFLUSH = 1]
 freading                  [test $REPLACE_FFLUSH = 1]
index 26face8a782040085e856a679f601c779de9aca6..00328bf20f412f6fd075c99a6ad43ce915fd6eba 100644 (file)
@@ -16,7 +16,6 @@ m4/selinux-selinux-h.m4
 Depends-on:
 errno
 extern-inline
-snippet/unused-parameter
 
 configure.ac:
 gl_HEADERS_SELINUX_SELINUX_H
@@ -31,7 +30,7 @@ lib_SOURCES += se-context.in.h se-label.in.h se-selinux.in.h \
   se-context.c se-label.c se-selinux.c
 
 BUILT_SOURCES += selinux/selinux.h
-selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H)
+selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status
        $(AM_V_at)$(MKDIR_P) selinux
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
@@ -40,23 +39,19 @@ selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAME
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SELINUX_SELINUX_H''@|$(NEXT_SELINUX_SELINUX_H)|g' \
-             -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
              < $(srcdir)/se-selinux.in.h; \
        } > $@-t && \
-       chmod a-x $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t
 
 BUILT_SOURCES += $(SELINUX_CONTEXT_H)
 if GL_GENERATE_SELINUX_CONTEXT_H
-selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H)
+selinux/context.h: se-context.in.h $(top_builddir)/config.status
        $(AM_V_at)$(MKDIR_P) selinux
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
-             < $(srcdir)/se-context.in.h; \
+         cat $(srcdir)/se-context.in.h; \
        } > $@-t && \
-       chmod a-x $@-t && \
        mv $@-t $@
 else
 selinux/context.h: $(top_builddir)/config.status
@@ -66,14 +61,12 @@ MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
 
 BUILT_SOURCES += $(SELINUX_LABEL_H)
 if GL_GENERATE_SELINUX_LABEL_H
-selinux/label.h: se-label.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H)
+selinux/label.h: se-label.in.h $(top_builddir)/config.status
        $(AM_V_at)$(MKDIR_P) selinux
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
-         sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
-             < $(srcdir)/se-label.in.h; \
+         cat $(srcdir)/se-label.in.h; \
        } > $@-t && \
-       chmod a-x $@-t && \
        mv $@-t $@
 else
 selinux/label.h: $(top_builddir)/config.status
index a85fdab4d78573eb87dc779ef4954ecbfb5b7549..4f2fb3737fd674175ea0930f46e6aaced11207a7 100644 (file)
@@ -7,7 +7,6 @@ m4/libunistring-base.m4
 
 Depends-on:
 unitypes
-snippet/unused-parameter
 stdbool
 inline
 
index f2b0d61c2cc68697b7220c756ae5141c18b81325..e0596017cf40bcc6b0c1600006fabb1a371acd26 100644 (file)
@@ -128,7 +128,7 @@ bag_from_list (gl_list_t list)
 }
 
 /* Returns true if and only if the given bag is empty.  */
-static bool _GL_ATTRIBUTE_MAYBE_UNUSED
+_GL_ATTRIBUTE_MAYBE_UNUSED static bool
 bag_is_empty (bag_t bag)
 {
   size_t i;
@@ -165,7 +165,7 @@ bag_equals (bag_t bag1, bag_t bag2)
 
 /* Returns a bag that contains the elements of BAG1 and the elements of
    BAG2.  */
-static bag_t _GL_ATTRIBUTE_MAYBE_UNUSED
+_GL_ATTRIBUTE_MAYBE_UNUSED static bag_t
 bag_or (bag_t bag1, bag_t bag2)
 {
   bag_t bag;
@@ -192,7 +192,7 @@ bag_xor (bag_t bag1, bag_t bag2)
 }
 
 /* Returns a bag that contains the elements of BAG1 that are not in BAG2.  */
-static bag_t _GL_ATTRIBUTE_MAYBE_UNUSED
+_GL_ATTRIBUTE_MAYBE_UNUSED static bag_t
 bag_and_not (bag_t bag1, bag_t bag2)
 {
   bag_t bag;
index 3b8d0a69167c6a8e351f7af03c5bee038a044240..6191d7dd314ed2dbe3114e6a7ad73ee027d6f11e 100644 (file)
 #include "attribute.h"
 
 struct s { int i; };
-static char doChar (void) NODISCARD;
-static int doInt (void) NODISCARD;
-static off_t doOff (void) NODISCARD;
-static void *doPtr (void) NODISCARD;
-static struct s doStruct (void) NODISCARD;
+NODISCARD static char doChar (void);
+NODISCARD static int doInt (void);
+NODISCARD static off_t doOff (void);
+NODISCARD static void *doPtr (void);
+NODISCARD static struct s doStruct (void);
 
 static char
 doChar (void)