From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6CEF61F8C6 for ; Sat, 31 Jul 2021 19:02:14 +0000 (UTC) Received: from localhost ([::1]:42188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9uFR-00089o-EC for normalperson@yhbt.net; Sat, 31 Jul 2021 15:02:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uF9-0007k6-3Y for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:55 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37134) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uF4-00069x-BK for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:54 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F2AA71600F1 for ; Sat, 31 Jul 2021 12:01:48 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id VRf9CThJa2FO; Sat, 31 Jul 2021 12:01:43 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AB62B1600DB; Sat, 31 Jul 2021 12:01:43 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aQzIrjOvgO1T; Sat, 31 Jul 2021 12:01:43 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 56D5C160083; Sat, 31 Jul 2021 12:01:43 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH 3/6] gnulib-common: update for C2x 2020-12-11 draft Date: Sat, 31 Jul 2021 12:01:20 -0700 Message-Id: <20210731190124.279622-3-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210731190124.279622-1-eggert@cs.ucla.edu> References: <20210731190124.279622-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" 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. --- ChangeLog | 8 ++++ NEWS | 9 ++++ doc/attribute.texi | 8 ++++ lib/anytostr.c | 2 +- lib/bitset.c | 2 +- lib/bitset/array.c | 10 ++--- lib/bitset/list.c | 4 +- lib/bitset/stats.c | 2 +- lib/bitset/table.c | 2 +- lib/bitset/vector.c | 8 ++-- lib/fflush.c | 6 +-- lib/fts_.h | 17 +++++-- lib/gl_anylinked_list2.h | 6 +-- lib/gl_anytree_list2.h | 14 +++--- lib/gl_anytree_omap.h | 2 +- lib/gl_anytree_oset.h | 2 +- lib/gl_array_list.c | 2 +- lib/gl_array_omap.c | 2 +- lib/gl_array_oset.c | 2 +- lib/gl_carray_list.c | 2 +- lib/gl_list.h | 60 ++++++++++++------------- lib/gl_map.h | 12 ++--- lib/gl_omap.h | 12 ++--- lib/gl_oset.h | 7 +-- lib/gl_set.h | 7 +-- lib/hamt.h | 19 ++++---- lib/hash.h | 20 ++++----- lib/inttostr.h | 10 ++--- lib/safe-alloc.h | 2 +- lib/se-context.in.h | 42 ++++++++++------- lib/se-label.in.h | 18 ++++---- lib/se-selinux.in.h | 56 +++++++++++------------ lib/unistr.in.h | 8 ++-- lib/unused-parameter.h | 13 +++--- m4/gnulib-common.m4 | 29 ++++++++---- modules/fflush | 1 - modules/selinux-h | 17 +++---- modules/unistr/base | 1 - tests/test-asyncsafe-linked_list-weak.c | 6 +-- tests/test-ignore-value.c | 10 ++--- 40 files changed, 248 insertions(+), 212 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a1534844..7e388c4dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2021-07-30 Paul Eggert =20 + 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 345afb189..e0f0d836c 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,15 @@ User visible incompatible changes =20 Date Modules Changes =20 +2021-07-29 (all) Due to draft C2x, the following attributes s= hould + now appear at the start of a function declar= ation: + _GL_ATTRIBUTE_DEPRECATED + _GL_ATTRIBUTE_MAYBE_UNUSED + _GL_ATTRIBUTE_NODISCARD + attribute Likewise for DEPRECATED, MAYBE_UNUSED, NODIS= CARD. + 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). diff --git a/doc/attribute.texi b/doc/attribute.texi index acc282ba9..983dfc350 100644 --- a/doc/attribute.texi +++ b/doc/attribute.texi @@ -23,11 +23,16 @@ Here is an example of its use: @example #include =20 +NODISCARD extern char *crypt (char const *, char const *) ATTRIBUTE_NOTHROW ATTRIBUTE_LEAF ATTRIBUTE_NONNULL ((1, 2)); @end example =20 @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. diff --git a/lib/anytostr.c b/lib/anytostr.c index 6daecb46a..8294353f9 100644 --- a/lib/anytostr.c +++ b/lib/anytostr.c @@ -32,7 +32,7 @@ INT_BUFSIZE_BOUND (INTTYPE) bytes long. Return the address of the printable string, which need not start at BUF. */ =20 -char * _GL_ATTRIBUTE_NODISCARD +_GL_ATTRIBUTE_NODISCARD char * anytostr (inttype i, char *buf) { char *p =3D buf + INT_STRLEN_BOUND (inttype); diff --git a/lib/bitset.c b/lib/bitset.c index 42092a3bd..7725828d7 100644 --- a/lib/bitset.c +++ b/lib/bitset.c @@ -94,7 +94,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bi= tset_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) diff --git a/lib/bitset/array.c b/lib/bitset/array.c index 6179b79bf..a984edefd 100644 --- a/lib/bitset/array.c +++ b/lib/bitset/array.c @@ -84,7 +84,7 @@ abitset_small_list (bitset src, bitset_bindex *list, =20 /* 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 bit= no MAYBE_UNUSED) =20 /* 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, =20 /* 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. */ diff --git a/lib/bitset/list.c b/lib/bitset/list.c index eb6e260c8..6e8724ddd 100644 --- a/lib/bitset/list.c +++ b/lib/bitset/list.c @@ -1229,7 +1229,7 @@ struct bitset_vtable lbitset_vtable =3D { =20 /* 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) =20 /* 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) =3D n_bits; bset->b.vtable =3D &lbitset_vtable; diff --git a/lib/bitset/stats.c b/lib/bitset/stats.c index 7bceb6b38..f998b2b55 100644 --- a/lib/bitset/stats.c +++ b/lib/bitset/stats.c @@ -208,7 +208,7 @@ bitset_stats_print_1 (FILE *file, const char *name, =20 /* 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; diff --git a/lib/bitset/table.c b/lib/bitset/table.c index 3b8db2a7f..b74c8c1a7 100644 --- a/lib/bitset/table.c +++ b/lib/bitset/table.c @@ -1132,7 +1132,7 @@ struct bitset_vtable tbitset_vtable =3D { =20 /* 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); } diff --git a/lib/bitset/vector.c b/lib/bitset/vector.c index 6203e11e0..f0dc5f5b5 100644 --- a/lib/bitset/vector.c +++ b/lib/bitset/vector.c @@ -126,7 +126,7 @@ vbitset_set (bitset dst, bitset_bindex bitno) =20 /* 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) =20 /* 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 =3D { =20 =20 size_t -vbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED) +vbitset_bytes (MAYBE_UNUSED bitset_bindex n_bits) { return sizeof (struct vbitset_struct); } diff --git a/lib/fflush.c b/lib/fflush.c index 7e27c67c1..8fe9d262d 100644 --- a/lib/fflush.c +++ b/lib/fflush.c @@ -28,8 +28,6 @@ =20 #include "stdio-impl.h" =20 -#include "unused-parameter.h" - #undef fflush =20 =20 @@ -96,8 +94,8 @@ restore_seek_optimization (FILE *fp, int saved_flags) # else =20 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, And= roid */ diff --git a/lib/fts_.h b/lib/fts_.h index f1265302b..9f4419c0a 100644 --- a/lib/fts_.h +++ b/lib/fts_.h @@ -250,12 +250,21 @@ typedef struct _ftsent { } FTSENT; =20 __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 =20 diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h index 176403a7f..8ed54cab7 100644 --- a/lib/gl_anylinked_list2.h +++ b/lib/gl_anylinked_list2.h @@ -170,14 +170,14 @@ gl_linked_size (gl_list_t list) } =20 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; } =20 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 *iterat= or, } =20 static void -gl_linked_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYB= E_UNUSED) +gl_linked_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *= iterator) { } =20 diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h index 559ded61d..536fc30c6 100644 --- a/lib/gl_anytree_list2.h +++ b/lib/gl_anytree_list2.h @@ -60,14 +60,14 @@ gl_tree_size (gl_list_t list) } =20 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; } =20 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_ATTRIBU= TE_MAYBE_UNUSED, } =20 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 !=3D NULL) @@ -122,7 +122,7 @@ gl_tree_next_node (gl_list_t list _GL_ATTRIBUTE_MAYBE= _UNUSED, } =20 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 !=3D NULL) @@ -141,7 +141,7 @@ gl_tree_previous_node (gl_list_t list _GL_ATTRIBUTE_M= AYBE_UNUSED, } =20 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 =3D list->root; =20 @@ -154,7 +154,7 @@ gl_tree_first_node (gl_list_t list _GL_ATTRIBUTE_MAYB= E_UNUSED) } =20 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 =3D list->root; =20 @@ -658,7 +658,7 @@ gl_tree_iterator_next (gl_list_iterator_t *iterator, } =20 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 *it= erator) { } =20 diff --git a/lib/gl_anytree_omap.h b/lib/gl_anytree_omap.h index 62c33a15a..0550ce749 100644 --- a/lib/gl_anytree_omap.h +++ b/lib/gl_anytree_omap.h @@ -300,6 +300,6 @@ gl_tree_iterator_next (gl_omap_iterator_t *iterator, } =20 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 *it= erator) { } diff --git a/lib/gl_anytree_oset.h b/lib/gl_anytree_oset.h index 9f5161ac6..512320521 100644 --- a/lib/gl_anytree_oset.h +++ b/lib/gl_anytree_oset.h @@ -438,6 +438,6 @@ gl_tree_iterator_next (gl_oset_iterator_t *iterator, = const void **eltp) } =20 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 *it= erator) { } diff --git a/lib/gl_array_list.c b/lib/gl_array_list.c index 4d6500cd2..8485d60fd 100644 --- a/lib/gl_array_list.c +++ b/lib/gl_array_list.c @@ -527,7 +527,7 @@ gl_array_iterator_next (gl_list_iterator_t *iterator, } =20 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 *i= terator) { } =20 diff --git a/lib/gl_array_omap.c b/lib/gl_array_omap.c index b1e025777..d3d4e7b14 100644 --- a/lib/gl_array_omap.c +++ b/lib/gl_array_omap.c @@ -370,7 +370,7 @@ gl_array_iterator_next (gl_omap_iterator_t *iterator, } =20 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 *i= terator) { } =20 diff --git a/lib/gl_array_oset.c b/lib/gl_array_oset.c index 342c8d86e..146d54e81 100644 --- a/lib/gl_array_oset.c +++ b/lib/gl_array_oset.c @@ -488,7 +488,7 @@ gl_array_iterator_next (gl_oset_iterator_t *iterator,= const void **eltp) } =20 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 *i= terator) { } =20 diff --git a/lib/gl_carray_list.c b/lib/gl_carray_list.c index 33f233860..f7fa0d118 100644 --- a/lib/gl_carray_list.c +++ b/lib/gl_carray_list.c @@ -699,7 +699,7 @@ gl_carray_iterator_next (gl_list_iterator_t *iterator= , } =20 static void -gl_carray_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYB= E_UNUSED) +gl_carray_iterator_free (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_iterator_t *= iterator) { } =20 diff --git a/lib/gl_list.h b/lib/gl_list.h index d600580ef..e2da4f1b8 100644 --- a/lib/gl_list.h +++ b/lib/gl_list.h @@ -197,9 +197,9 @@ extern const void * gl_list_node_value (gl_list_t lis= t, 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 nod= e, - const void *elt) - _GL_ATTRIBUTE_NODISCARD; + const void *elt); =20 /* Returns the node immediately after the given node in the list, or NUL= L 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); =20 /* 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 li= st, 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); =20 /* 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 *e= lt) - _GL_ATTRIBUTE_NODISCARD; +_GL_ATTRIBUTE_NODISCARD +extern gl_list_node_t gl_list_nx_set_last (gl_list_t list, const void *e= lt); =20 /* 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 li= st, /* 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); =20 /* 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 *e= lt) - _GL_ATTRIBUTE_NODISCARD; +_GL_ATTRIBUTE_NODISCARD +extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *e= lt); =20 /* 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); =20 /* 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); =20 /* Adds an element at a given position in the list. POSITION must be >=3D 0 and <=3D 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); =20 /* 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 com= par, - const void *elt) - _GL_ATTRIBUTE_NODISCARD; + const void *elt); =20 /* 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 no= de) ->node_value (list, node); } =20 -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); } =20 -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); } =20 -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); } =20 -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 sta= rt_index, size_t end_index, ->indexof_from_to (list, start_index, end_index, elt); } =20 -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); } =20 -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); } =20 -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); } =20 -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 *e= lt) { return ((const struct gl_list_impl_base *) list)->vtable ->nx_add_after (list, node, elt); } =20 -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_lis= telement_compar_fn compar, elt); } =20 -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, c= onst void *elt) { return ((const struct gl_list_impl_base *) list)->vtable diff --git a/lib/gl_map.h b/lib/gl_map.h index 051ec5944..118d4e321 100644 --- a/lib/gl_map.h +++ b/lib/gl_map.h @@ -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 *val= ue) - _GL_ATTRIBUTE_NODISCARD; +_GL_ATTRIBUTE_NODISCARD +extern int gl_map_nx_put (gl_map_t map, const void *key, const void *val= ue); =20 /* 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 *k= ey, const void *value) extern bool gl_map_getput (gl_map_t map, const void *key, const void *va= lue, 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); =20 /* 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 v= oid **valuep) ->search (map, key, valuep); } =20 -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; } =20 -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; diff --git a/lib/gl_omap.h b/lib/gl_omap.h index ca6916c82..b2dacfb28 100644 --- a/lib/gl_omap.h +++ b/lib/gl_omap.h @@ -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 *val= ue); /* Likewise. Returns -1 upon out-of-memory. */ -extern int gl_omap_nx_put (gl_omap_t map, const void *key, const void *v= alue) - _GL_ATTRIBUTE_NODISCARD; +_GL_ATTRIBUTE_NODISCARD +extern int gl_omap_nx_put (gl_omap_t map, const void *key, const void *v= alue); =20 /* 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); =20 /* 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); } =20 -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; } =20 -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; diff --git a/lib/gl_oset.h b/lib/gl_oset.h index b9ce896d1..ac90f0445 100644 --- a/lib/gl_oset.h +++ b/lib/gl_oset.h @@ -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 otherw= ise. */ /* 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); =20 /* 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); } =20 -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); diff --git a/lib/gl_set.h b/lib/gl_set.h index 3a05b9304..4e68cc739 100644 --- a/lib/gl_set.h +++ b/lib/gl_set.h @@ -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 otherw= ise. */ /* 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); =20 /* 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, e= lt); } =20 -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, e= lt); diff --git a/lib/hamt.h b/lib/hamt.h index 25a0ad9f9..6bbc6a3f4 100644 --- a/lib/hamt.h +++ b/lib/hamt.h @@ -139,14 +139,15 @@ typedef void (Hamt_freer) (Hamt_entry *elt); /****************************/ =20 /* Create and return a new and empty hash array mapped trie. */ +_GL_ATTRIBUTE_NODISCARD extern Hamt *hamt_create (Hamt_hasher *hasher, Hamt_comparator *comparat= or, - Hamt_freer *freer) - _GL_ATTRIBUTE_NODISCARD; + Hamt_freer *freer); =20 /* 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); =20 /* 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, c= onst 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); =20 /* 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); =20 /* 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); =20 /*************/ /* Iteration */ diff --git a/lib/hash.h b/lib/hash.h index a52736d3b..230d5cd38 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -172,21 +172,21 @@ typedef void (*Hash_data_freer) (void *entry); all of your 'data' data. This is typically the case when your data i= s simply an auxiliary struct that you have malloc'd to aggregate severa= l 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); =20 /* 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); =20 /* 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 th= e exact number of buckets desired. Return true iff the rehash succeede= d. */ -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); =20 /* If ENTRY matches an entry already in the hash table, return the point= er to the entry from the table. Otherwise, insert ENTRY and return ENTR= Y. Return NULL if the storage required for insertion cannot be allocated= . This implementation does not support duplicate entries or insertion o= f 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); =20 /* 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 vo= id *entry); =20 /* 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); =20 # ifdef __cplusplus } diff --git a/lib/inttostr.h b/lib/inttostr.h index 9dcac70e9..db1f8fa67 100644 --- a/lib/inttostr.h +++ b/lib/inttostr.h @@ -22,8 +22,8 @@ =20 #include "intprops.h" =20 -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 *); diff --git a/lib/safe-alloc.h b/lib/safe-alloc.h index 3ba9d2fc2..b54d9b472 100644 --- a/lib/safe-alloc.h +++ b/lib/safe-alloc.h @@ -38,7 +38,7 @@ safe_alloc_realloc_n (void *ptr, size_t count, size_t s= ize) count =3D size =3D 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. */ diff --git a/lib/se-context.in.h b/lib/se-context.in.h index 999a7b413..d4ed6a4c1 100644 --- a/lib/se-context.in.h +++ b/lib/se-context.in.h @@ -29,34 +29,42 @@ _GL_INLINE_HEADER_BEGIN # define SE_CONTEXT_INLINE _GL_INLINE #endif =20 -/* 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_PARAME= TER) +SE_CONTEXT_INLINE context_t +context_new (_GL_ATTRIBUTE_MAYBE_UNUSED char const *s) { errno =3D 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 =3D 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) {} =20 -SE_CONTEXT_INLINE int context_user_set (context_t sc _GL_UNUSED_PARAMETE= R, - char const *s _GL_UNUSED_PARAMET= ER) +SE_CONTEXT_INLINE int +context_user_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc, + _GL_ATTRIBUTE_MAYBE_UNUSED char const *s) { errno =3D ENOTSUP; return -1; } -SE_CONTEXT_INLINE int context_role_set (context_t sc _GL_UNUSED_PARAMETE= R, - char const *s _GL_UNUSED_PARAMET= ER) +SE_CONTEXT_INLINE int +context_role_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc, + _GL_ATTRIBUTE_MAYBE_UNUSED char const *s) { errno =3D ENOTSUP; return -1; } -SE_CONTEXT_INLINE int context_range_set (context_t sc _GL_UNUSED_PARAMET= ER, - char const *s _GL_UNUSED_PARAME= TER) +SE_CONTEXT_INLINE int +context_range_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc, + _GL_ATTRIBUTE_MAYBE_UNUSED char const *s) { errno =3D ENOTSUP; return -1; } -SE_CONTEXT_INLINE int context_type_set (context_t sc _GL_UNUSED_PARAMETE= R, - char const *s _GL_UNUSED_PARAMET= ER) +SE_CONTEXT_INLINE int +context_type_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc, + _GL_ATTRIBUTE_MAYBE_UNUSED char const *s) { errno =3D ENOTSUP; return -1; } -SE_CONTEXT_INLINE char *context_type_get (context_t sc _GL_UNUSED_PARAME= TER) +SE_CONTEXT_INLINE char * +context_type_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc) { errno =3D ENOTSUP; return (void *) 0; } -SE_CONTEXT_INLINE char *context_range_get (context_t sc _GL_UNUSED_PARAM= ETER) +SE_CONTEXT_INLINE char * +context_range_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc) { errno =3D ENOTSUP; return (void *) 0; } -SE_CONTEXT_INLINE char *context_role_get (context_t sc _GL_UNUSED_PARAME= TER) +SE_CONTEXT_INLINE char * +context_role_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc) { errno =3D ENOTSUP; return (void *) 0; } -SE_CONTEXT_INLINE char *context_user_get (context_t sc _GL_UNUSED_PARAME= TER) +SE_CONTEXT_INLINE char * +context_user_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc) { errno =3D ENOTSUP; return (void *) 0; } =20 _GL_INLINE_HEADER_END diff --git a/lib/se-label.in.h b/lib/se-label.in.h index 8d8929745..2bf1eb88c 100644 --- a/lib/se-label.in.h +++ b/lib/se-label.in.h @@ -31,27 +31,25 @@ _GL_INLINE_HEADER_BEGIN # define SE_LABEL_INLINE _GL_INLINE #endif =20 -/* The definition of _GL_UNUSED_PARAMETER is copied here. */ - #define SELABEL_CTX_FILE 0 =20 struct selabel_handle; =20 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 =3D ENOTSUP; return -1; } =20 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 =3D ENOTSUP; return 0; } =20 SE_LABEL_INLINE void -selabel_close (struct selabel_handle *hnd _GL_UNUSED_PARAMETER) +selabel_close (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd) { errno =3D ENOTSUP; } =20 _GL_INLINE_HEADER_END diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h index 60cc493e6..85dae1181 100644 --- a/lib/se-selinux.in.h +++ b/lib/se-selinux.in.h @@ -38,8 +38,6 @@ _GL_INLINE_HEADER_BEGIN # define SE_SELINUX_INLINE _GL_INLINE # endif =20 -/* The definition of _GL_UNUSED_PARAMETER is copied here. */ - # if !GNULIB_defined_security_types =20 typedef unsigned short security_class_t; @@ -47,67 +45,67 @@ struct selinux_opt; # define is_selinux_enabled() 0 =20 SE_SELINUX_INLINE int -getcon (char **con _GL_UNUSED_PARAMETER) +getcon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con) { errno =3D ENOTSUP; return -1; } SE_SELINUX_INLINE void -freecon (char *con _GL_UNUSED_PARAMETER) {} +freecon (_GL_ATTRIBUTE_MAYBE_UNUSED char *con) {} =20 SE_SELINUX_INLINE int -getfscreatecon (char **con _GL_UNUSED_PARAMETER) +getfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con) { errno =3D ENOTSUP; return -1; } SE_SELINUX_INLINE int -setfscreatecon (char const *con _GL_UNUSED_PARAMETER) +setfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) { errno =3D 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 =3D 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 =3D 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 =3D 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 =3D 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 =3D 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 =3D 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 =3D ENOTSUP; return -1; } =20 SE_SELINUX_INLINE int -security_check_context (char const *con _GL_UNUSED_PARAMETER) +security_check_context (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) { errno =3D 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 =3D ENOTSUP; return -1; } SE_SELINUX_INLINE int -setexeccon (char const *con _GL_UNUSED_PARAMETER) +setexeccon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con) { errno =3D 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 tcl= ass, + _GL_ATTRIBUTE_MAYBE_UNUSED char **newcon) { errno =3D ENOTSUP; return -1; } SE_SELINUX_INLINE security_class_t string_to_security_class (char const *name) { errno =3D 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 =3D ENOTSUP; return -1; } =20 # define GNULIB_defined_security_types 1 diff --git a/lib/unistr.in.h b/lib/unistr.in.h index 2441a72b8..ed657773c 100644 --- a/lib/unistr.in.h +++ b/lib/unistr.in.h @@ -19,9 +19,6 @@ =20 #include "unitypes.h" =20 -/* Get common macros for C. */ -#include "unused-parameter.h" - /* Get bool. */ #include =20 @@ -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 =3D *s; =20 @@ -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_PARAMETE= R) +u32_mbtouc (ucs4_t *puc, const uint32_t *s, + _GL_ATTRIBUTE_MAYBE_UNUSED size_t n) { uint32_t c =3D *s; =20 diff --git a/lib/unused-parameter.h b/lib/unused-parameter.h index 34f05d9ef..047a0d895 100644 --- a/lib/unused-parameter.h +++ b/lib/unused-parameter.h @@ -14,18 +14,15 @@ You should have received a copy of the GNU Lesser General Public Lice= nse along with this program. If not, see = . */ =20 -/* _GL_UNUSED_PARAMETER is a marker that can be appended to function par= ameter +/* _GL_UNUSED_PARAMETER is a marker that can be prepended to function pa= rameter declarations for parameters that are not used. This helps to reduce warnings, such as from GCC -Wunused-parameter. The syntax is as foll= ows: - 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 diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index bfa1645db..347462d1d 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -103,6 +103,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif =20 +#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 =20 -#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 =20 /* 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 =20 -#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 =20 #if _GL_HAS_ATTRIBUTE (malloc) @@ -212,7 +215,7 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_MALLOC #endif =20 -#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 =20 +#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 diff --git a/modules/fflush b/modules/fflush index 858a25aaf..bda975a2a 100644 --- a/modules/fflush +++ b/modules/fflush @@ -8,7 +8,6 @@ m4/fflush.m4 =20 Depends-on: stdio -snippet/unused-parameter [test $REPLACE_FFLUSH =3D 1] fpurge [test $REPLACE_FFLUSH =3D 1] ftello [test $REPLACE_FFLUSH =3D 1] freading [test $REPLACE_FFLUSH =3D 1] diff --git a/modules/selinux-h b/modules/selinux-h index 26face8a7..00328bf20 100644 --- a/modules/selinux-h +++ b/modules/selinux-h @@ -16,7 +16,6 @@ m4/selinux-selinux-h.m4 Depends-on: errno extern-inline -snippet/unused-parameter =20 configure.ac: gl_HEADERS_SELINUX_SELINUX_H @@ -31,7 +30,7 @@ lib_SOURCES +=3D se-context.in.h se-label.in.h se-selin= ux.in.h \ se-context.c se-label.c se-selinux.c =20 BUILT_SOURCES +=3D selinux/selinux.h -selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSE= D_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)/co= nfig.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 +=3D selinux/selinux.h selinux/selinux.h-t =20 BUILT_SOURCES +=3D $(SELINUX_CONTEXT_H) if GL_GENERATE_SELINUX_CONTEXT_H -selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSE= D_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 +=3D selinux/context.h selinux/conte= xt.h-t =20 BUILT_SOURCES +=3D $(SELINUX_LABEL_H) if GL_GENERATE_SELINUX_LABEL_H -selinux/label.h: se-label.in.h $(top_builddir)/config.status $(UNUSED_PA= RAMETER_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 diff --git a/modules/unistr/base b/modules/unistr/base index a85fdab4d..4f2fb3737 100644 --- a/modules/unistr/base +++ b/modules/unistr/base @@ -7,7 +7,6 @@ m4/libunistring-base.m4 =20 Depends-on: unitypes -snippet/unused-parameter stdbool inline =20 diff --git a/tests/test-asyncsafe-linked_list-weak.c b/tests/test-asyncsa= fe-linked_list-weak.c index f2b0d61c2..e0596017c 100644 --- a/tests/test-asyncsafe-linked_list-weak.c +++ b/tests/test-asyncsafe-linked_list-weak.c @@ -128,7 +128,7 @@ bag_from_list (gl_list_t list) } =20 /* 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) =20 /* 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) } =20 /* 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; diff --git a/tests/test-ignore-value.c b/tests/test-ignore-value.c index 3b8d0a691..6191d7dd3 100644 --- a/tests/test-ignore-value.c +++ b/tests/test-ignore-value.c @@ -26,11 +26,11 @@ #include "attribute.h" =20 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); =20 static char doChar (void) --=20 2.31.1