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
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).
@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
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.
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);
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)
/* 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
/* 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
/* 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. */
/* 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);
}
/* 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;
/* 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;
/* 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);
}
/* 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. */
/* 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. */
size_t
-vbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
+vbitset_bytes (MAYBE_UNUSED bitset_bindex n_bits)
{
return sizeof (struct vbitset_struct);
}
#include "stdio-impl.h"
-#include "unused-parameter.h"
-
#undef fflush
# 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 */
} 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
}
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)
{
}
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)
{
}
}
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
}
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)
}
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)
}
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;
}
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;
}
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)
{
}
}
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)
{
}
}
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)
{
}
}
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)
{
}
}
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)
{
}
}
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)
{
}
}
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)
{
}
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. */
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.
/* 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.
/* 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. */
/* 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. */
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. */
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). */
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. */
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.
->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)
{
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);
->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
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
/* 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
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.
->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)
{
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;
/* 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
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.
->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)
{
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;
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. */
->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);
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. */
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);
/****************************/
/* 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. */
/* 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 */
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
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'. */
/* 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
}
#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 *);
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. */
# 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
# 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
# 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;
# 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
#include "unitypes.h"
-/* Get common macros for C. */
-#include "unused-parameter.h"
-
/* Get bool. */
#include <stdbool.h>
# 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;
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;
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
# 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)
# 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__))
#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__))
# 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)
# 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__))
# 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
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]
Depends-on:
errno
extern-inline
-snippet/unused-parameter
configure.ac:
gl_HEADERS_SELINUX_SELINUX_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! */' && \
-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
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
Depends-on:
unitypes
-snippet/unused-parameter
stdbool
inline
}
/* 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;
/* 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;
}
/* 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;
#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)