>From 678e75be630f012a097092e781f9eac0eaa2c679 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 1 May 2020 18:12:12 -0700 Subject: [PATCH] attribute: new module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This simplifies use of GCC and C2X attributes like ‘deprecated’. * MODULES.html.sh: Add attribute. * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. * doc/gnulib.texi (Particular Modules): Add Attributes. * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: * lib/vasnprintf.c: Include attribute.h, and let it define FALLTHROUGH. * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. This is a copy since Gawk doesn’t use Gnulib. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that is incompatible with gl_COMMON_BODY’s. All uses changed. * lib/fts.c: Include attribte.h, for FALLTHROUGH. Keep the existing FALLTHROUGH definition since Glibc might use it, and it does no harm to Gnulib’s FALLTHROUGH. * lib/fts_.h, lib/inttostr.h: (__GNUC_PREREQ): Remove; no longer needed. (__attribute_warn_unused_result__): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed __attribute__ ((__warn_unused_result__)), for forward compatibility to C2X. * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses replaced by gl_COMMON_BODY’s implementation, which has a slightly different signature. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. No doubt all uses should be replaced, at some point. * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. (_Noreturn): Use it. (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) (_GL_ATTRIBUTE_COLD) (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) (_GL_ATTRIBUTE_MAYBE_UNUSED) (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) (_GL_ATTRIBUTE_SENTINEL): New macros. * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: * modules/fnmatch, modules/freopen-safer, modules/fts: * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: * modules/quotearg, modules/savewd: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf: * modules/unistdio/ulc-vasnprintf: * modules/unistr/u8-uctomb, modules/vasnprintf: (Depends-on:): Add attribute module. --- ChangeLog | 69 +++++++++ MODULES.html.sh | 1 + doc/attribute.texi | 43 ++++++ doc/gnulib.texi | 3 + lib/anytostr.c | 2 +- lib/attribute.h | 56 +++++++ lib/backupfile.c | 9 +- lib/bitset/base.h | 8 +- lib/c-stack.c | 6 - lib/dfa.c | 4 +- lib/di-set.h | 13 +- lib/fnmatch.c | 9 +- lib/freopen-safer.c | 10 +- lib/fts.c | 1 + lib/fts_.h | 25 +--- lib/gl_list.h | 80 ++-------- lib/gl_map.h | 20 +-- lib/gl_omap.h | 20 +-- lib/gl_oset.h | 10 +- lib/gl_set.h | 10 +- lib/hash.h | 26 +--- lib/ino-map.h | 11 +- lib/inttostr.h | 27 +--- lib/mbrtoc32.c | 10 +- lib/mbrtowc.c | 9 +- lib/nstrftime.c | 9 +- lib/quotearg.c | 9 +- lib/safe-alloc.h | 12 +- lib/savewd.c | 9 +- lib/unistr/u8-uctomb-aux.c | 8 +- lib/unistr/u8-uctomb.c | 8 +- lib/unused-parameter.h | 6 +- lib/vasnprintf.c | 9 +- m4/gnulib-common.m4 | 223 ++++++++++++++++++++++++---- modules/attribute | 19 +++ modules/backup-rename | 1 + modules/backupfile | 1 + modules/c-vasnprintf | 1 + modules/fnmatch | 1 + modules/freopen-safer | 1 + modules/fts | 1 + modules/mbrtoc32 | 1 + modules/mbrtowc | 1 + modules/nstrftime | 1 + modules/quotearg | 1 + modules/savewd | 1 + modules/unistdio/u16-u16-vasnprintf | 1 + modules/unistdio/u16-vasnprintf | 1 + modules/unistdio/u32-u32-vasnprintf | 1 + modules/unistdio/u32-vasnprintf | 1 + modules/unistdio/u8-u8-vasnprintf | 1 + modules/unistdio/u8-vasnprintf | 1 + modules/unistdio/ulc-vasnprintf | 1 + modules/unistr/u8-uctomb | 1 + modules/vasnprintf | 1 + 55 files changed, 471 insertions(+), 343 deletions(-) create mode 100644 doc/attribute.texi create mode 100644 lib/attribute.h create mode 100644 modules/attribute diff --git a/ChangeLog b/ChangeLog index 033f3be48..72c62be29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +2020-05-02 Paul Eggert + + attribute: new module + This simplifies use of GCC and C2X attributes like ‘deprecated’. + * MODULES.html.sh: Add attribute. + * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. + * doc/gnulib.texi (Particular Modules): Add Attributes. + * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: + * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: + * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: + * lib/vasnprintf.c: + Include attribute.h, and let it define FALLTHROUGH. + * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. + * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of + _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. + * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. + This is a copy since Gawk doesn’t use Gnulib. + * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that + is incompatible with gl_COMMON_BODY’s. All uses changed. + * lib/fts.c: Include attribte.h, for FALLTHROUGH. + Keep the existing FALLTHROUGH definition since Glibc might use it, + and it does no harm to Gnulib’s FALLTHROUGH. + * lib/fts_.h, lib/inttostr.h: + (__GNUC_PREREQ): Remove; no longer needed. + (__attribute_warn_unused_result__): Remove. All uses + replaced by _GL_ATTRIBUTE_NODISCARD. + * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: + * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed + __attribute__ ((__warn_unused_result__)), for forward + compatibility to C2X. + * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by + _GL_ATTRIBUTE_NODISCARD. + (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. + * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses + replaced by gl_COMMON_BODY’s implementation, which has a + slightly different signature. + * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): + Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. + * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): + Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. + No doubt all uses should be replaced, at some point. + * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. + (_Noreturn): Use it. + (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) + (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) + (_GL_ATTRIBUTE_COLD) + (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) + (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) + (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) + (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) + (_GL_ATTRIBUTE_MAYBE_UNUSED) + (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) + (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) + (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) + (_GL_ATTRIBUTE_SENTINEL): New macros. + * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: + * modules/fnmatch, modules/freopen-safer, modules/fts: + * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: + * modules/quotearg, modules/savewd: + * modules/unistdio/u16-u16-vasnprintf: + * modules/unistdio/u16-vasnprintf: + * modules/unistdio/u32-u32-vasnprintf: + * modules/unistdio/u32-vasnprintf: + * modules/unistdio/u8-u8-vasnprintf: + * modules/unistdio/u8-vasnprintf: + * modules/unistdio/ulc-vasnprintf: + * modules/unistr/u8-uctomb, modules/vasnprintf: + (Depends-on:): Add attribute module. + 2020-05-01 Bruno Haible list: Add remove_first and remove_last operations. diff --git a/MODULES.html.sh b/MODULES.html.sh index 240a9ee20..318a15a1d 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2364,6 +2364,7 @@ func_all_modules () func_echo "$element" func_begin_table + func_module attribute func_module builtin-expect func_module ieee754-h func_module limits-h diff --git a/doc/attribute.texi b/doc/attribute.texi new file mode 100644 index 000000000..86591f16c --- /dev/null +++ b/doc/attribute.texi @@ -0,0 +1,43 @@ +@c attribute module documentation + +@c Copyright 2020 Free Software Foundation, Inc. + +@c Permission is granted to copy, distribute and/or modify this document +@c under the terms of the GNU Free Documentation License, Version 1.3 or +@c any later version published by the Free Software Foundation; with no +@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A +@c copy of the license is at . + +@node Attributes +@section Attributes + +@cindex Attributes +@findex __attribute__ + +This module provides a header file @file{attribute.h} that defines +macros related to C and C++ attributes and the GCC +@code{__attribute__} keyword. + +Here is an example of its use: + +@example +#include + +extern char *crypt (char const *, char const *) + ATTRIBUTE_NOTHROW ATTRIBUTE_LEAF ATTRIBUTE_NONNULL ((1, 2)); +@end example + +@noindent +@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 +@code{ATTRIBUTE_LEAF}. @code{ATTRIBUTE_NONNULL ((1, 2))} expands to +@code{__attribute__ ((__nonnull__ (1, 2)))} if the compiler is +recent-enough GCC, and to nothing otherwise. + +Most of these attribute names begin with @code{ATTRIBUTE_}. +A few do not, because they are part of C2X and their +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. diff --git a/doc/gnulib.texi b/doc/gnulib.texi index c9501ca23..3719978b6 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -6654,6 +6654,7 @@ to POSIX that it can be treated like any other Unix-like platform. * alloca:: * alloca-opt:: * Safe Allocation Macros:: +* Attributes:: * Compile-time Assertions:: * Non-returning Functions:: * Integer Properties:: @@ -6685,6 +6686,8 @@ to POSIX that it can be treated like any other Unix-like platform. @include safe-alloc.texi +@include attribute.texi + @include verify.texi @include noreturn.texi diff --git a/lib/anytostr.c b/lib/anytostr.c index da602a7d7..5dcd211b4 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. */ -char * __attribute_warn_unused_result__ +char * _GL_ATTRIBUTE_NODISCARD anytostr (inttype i, char *buf) { char *p = buf + INT_STRLEN_BOUND (inttype); diff --git a/lib/attribute.h b/lib/attribute.h new file mode 100644 index 000000000..ffd9bdfa2 --- /dev/null +++ b/lib/attribute.h @@ -0,0 +1,56 @@ +/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers + + Copyright 2020 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert. */ + +/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* + macros used within Gnulib. */ + +#ifndef _GL_ATTRIBUTE_H +#define _GL_ATTRIBUTE_H + +/* C2X standard attributes have macro names that do not begin with + 'ATTRIBUTE_'. */ +#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED +#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH +#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +#define NODISCARD _GL_ATTRIBUTE_NODISCARD + +/* Attributes from GCC have macro names beginning with 'ATTRIBUTE_' to + avoid name clashes. */ +#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE(args) +#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE +#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL +#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST +#define ATTRIBUTE_DEPRECATED _GL_ATTRIBUTE_DEPRECATED +#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR(msg) +#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT(spec) +#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF +#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS +#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC +#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE +#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL(args) +#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING +#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW +#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED +#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE +#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL(pos) +#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING(msg) + +#endif /* _GL_ATTRIBUTE_H */ diff --git a/lib/backupfile.c b/lib/backupfile.c index 319f084ef..7edd9c3db 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -22,6 +22,7 @@ #include "backup-internal.h" +#include "attribute.h" #include "dirname.h" #include "opendirat.h" #include "renameatu.h" @@ -35,14 +36,6 @@ #include #include -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - #ifndef _D_EXACT_NAMLEN # define _D_EXACT_NAMLEN(dp) strlen ((dp)->d_name) #endif diff --git a/lib/bitset/base.h b/lib/bitset/base.h index 46ec894ec..1020515a4 100644 --- a/lib/bitset/base.h +++ b/lib/bitset/base.h @@ -27,13 +27,7 @@ #include "xalloc.h" -#ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(x) -# endif -#endif - -#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#define ATTRIBUTE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED /* Currently we support five flavours of bitsets: BITSET_ARRAY: Array of bits (fixed size, fast for dense bitsets). diff --git a/lib/c-stack.c b/lib/c-stack.c index 50a0380c2..4050d08e1 100644 --- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -35,12 +35,6 @@ #include -#ifndef __attribute__ -# if __GNUC__ < 3 -# define __attribute__(x) -# endif -#endif - #include "gettext.h" #define _(msgid) gettext (msgid) diff --git a/lib/dfa.c b/lib/dfa.c index 9939d228a..dee7be861 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -62,7 +62,9 @@ isasciidigit (char c) #include "localeinfo.h" #ifndef FALLTHROUGH -# if __GNUC__ < 7 +# if 201710L < __STDC_VERSION__ +# define FALLTHROUGH [[__fallthrough__]] +# elif __GNUC__ < 7 # define FALLTHROUGH ((void) 0) # else # define FALLTHROUGH __attribute__ ((__fallthrough__)) diff --git a/lib/di-set.h b/lib/di-set.h index abc3161fe..bec5b3f9e 100644 --- a/lib/di-set.h +++ b/lib/di-set.h @@ -3,17 +3,10 @@ # include -# undef _GL_ATTRIBUTE_NONNULL -# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__ -# define _GL_ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) -# else -# define _GL_ATTRIBUTE_NONNULL(m) -# endif - struct di_set *di_set_alloc (void); -int di_set_insert (struct di_set *, dev_t, ino_t) _GL_ATTRIBUTE_NONNULL (1); -void di_set_free (struct di_set *) _GL_ATTRIBUTE_NONNULL (1); +int di_set_insert (struct di_set *, dev_t, ino_t) _GL_ATTRIBUTE_NONNULL ((1)); +void di_set_free (struct di_set *) _GL_ATTRIBUTE_NONNULL ((1)); int di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino) - _GL_ATTRIBUTE_NONNULL (1); + _GL_ATTRIBUTE_NONNULL ((1)); #endif diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 79c1a3b2e..224512d8c 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -63,16 +63,9 @@ extern int fnmatch (const char *pattern, const char *string, int flags); # define SIZE_MAX ((size_t) -1) #endif +#include "attribute.h" #include "flexmember.h" -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */ #define NO_LEADING_PERIOD(flags) \ ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD)) diff --git a/lib/freopen-safer.c b/lib/freopen-safer.c index adaa978f1..b69fd1a75 100644 --- a/lib/freopen-safer.c +++ b/lib/freopen-safer.c @@ -21,19 +21,13 @@ #include "stdio-safer.h" +#include "attribute.h" + #include #include #include #include -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - /* Guarantee that FD is open; all smaller FDs must already be open. Return true if successful. */ static bool diff --git a/lib/fts.c b/lib/fts.c index bf62dfa92..3b2f693b4 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -70,6 +70,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #include #if ! _LIBC +# include "attribute.h" # include "fcntl--.h" # include "flexmember.h" # include "openat.h" diff --git a/lib/fts_.h b/lib/fts_.h index 15c248cba..e7a9ead77 100644 --- a/lib/fts_.h +++ b/lib/fts_.h @@ -249,30 +249,13 @@ typedef struct _ftsent { char fts_name[__FLEXIBLE_ARRAY_MEMBER]; /* file name */ } FTSENT; -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if __GNUC_PREREQ (3,4) -# undef __attribute_warn_unused_result__ -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif - __BEGIN_DECLS -FTSENT *fts_children (FTS *, int) __THROW __attribute_warn_unused_result__; -int fts_close (FTS *) __THROW __attribute_warn_unused_result__; +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 __attribute_warn_unused_result__; -FTSENT *fts_read (FTS *) __THROW __attribute_warn_unused_result__; + __THROW _GL_ATTRIBUTE_NODISCARD; +FTSENT *fts_read (FTS *) __THROW _GL_ATTRIBUTE_NODISCARD; int fts_set (FTS *, FTSENT *, int) __THROW; __END_DECLS diff --git a/lib/gl_list.h b/lib/gl_list.h index ea5018d34..7f164fac6 100644 --- a/lib/gl_list.h +++ b/lib/gl_list.h @@ -193,10 +193,7 @@ extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node, /* Likewise. Returns 0 upon success, -1 upon out-of-memory. */ extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* 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. */ @@ -219,10 +216,7 @@ extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position, /* Likewise. Returns NULL upon out-of-memory. */ extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Searches whether an element is already in the list. Returns its node if found, or NULL if not present in the list. */ @@ -265,10 +259,7 @@ extern size_t gl_list_indexof_from_to (gl_list_t list, 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Adds an element as the last element of the list. Returns its node. */ @@ -276,10 +267,7 @@ extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt) 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Adds an element before a given element node of the list. Returns its node. */ @@ -290,10 +278,7 @@ extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node, extern gl_list_node_t gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Adds an element after a given element node of the list. Returns its node. */ @@ -303,10 +288,7 @@ extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node, /* Likewise. Returns NULL upon out-of-memory. */ extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Adds an element at a given position in the list. POSITION must be >= 0 and <= gl_list_size (list). */ @@ -316,10 +298,7 @@ extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position, /* Likewise. Returns NULL upon out-of-memory. */ extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Removes an element from the list. Returns true. */ @@ -463,10 +442,7 @@ extern gl_list_node_t gl_sortedlist_add (gl_list_t list, extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Searches and removes an element from the list. The list is assumed to be sorted with COMPAR. @@ -605,10 +581,7 @@ gl_list_node_value (gl_list_t list, gl_list_node_t node) ->node_value (list, node); } -GL_LIST_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt) { @@ -637,10 +610,7 @@ gl_list_get_at (gl_list_t list, size_t position) ->get_at (list, position); } -GL_LIST_INLINE gl_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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 @@ -695,50 +665,35 @@ gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, ->indexof_from_to (list, start_index, end_index, elt); } -GL_LIST_INLINE gl_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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 @@ -843,10 +798,7 @@ gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, elt); } -GL_LIST_INLINE gl_list_node_t -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD 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 diff --git a/lib/gl_map.h b/lib/gl_map.h index 8a203b627..977457ce8 100644 --- a/lib/gl_map.h +++ b/lib/gl_map.h @@ -146,10 +146,7 @@ extern bool gl_map_search (gl_map_t map, const void *key, const void **valuep); 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* 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 @@ -162,10 +159,7 @@ extern bool gl_map_getput (gl_map_t map, const void *key, const void *value, /* Likewise. Returns -1 upon out-of-memory. */ extern int gl_map_nx_getput (gl_map_t map, const void *key, const void *value, const void **oldvaluep) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Removes a pair from a map. Returns true if the key was found and its pair removed. @@ -286,10 +280,7 @@ gl_map_search (gl_map_t map, const void *key, const void **valuep) ->search (map, key, valuep); } -GL_MAP_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_MAP_INLINE _GL_ATTRIBUTE_NODISCARD int gl_map_nx_getput (gl_map_t map, const void *key, const void *value, const void **oldvaluep) { @@ -340,10 +331,7 @@ gl_map_get (gl_map_t map, const void *key) return value; } -GL_MAP_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_MAP_INLINE _GL_ATTRIBUTE_NODISCARD 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 c534db582..e789ba3f0 100644 --- a/lib/gl_omap.h +++ b/lib/gl_omap.h @@ -156,10 +156,7 @@ extern bool gl_omap_search_atleast (gl_omap_t map, 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* 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 @@ -172,10 +169,7 @@ extern bool gl_omap_getput (gl_omap_t map, const void *key, const void *value, /* Likewise. Returns -1 upon out-of-memory. */ extern int gl_omap_nx_getput (gl_omap_t map, const void *key, const void *value, const void **oldvaluep) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Removes a pair from an ordered map. Returns true if the key was found and its pair removed. @@ -304,10 +298,7 @@ gl_omap_search_atleast (gl_omap_t map, ->search_atleast (map, threshold_fn, threshold, keyp, valuep); } -GL_OMAP_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_OMAP_INLINE _GL_ATTRIBUTE_NODISCARD int gl_omap_nx_getput (gl_omap_t map, const void *key, const void *value, const void **oldvaluep) { @@ -358,10 +349,7 @@ gl_omap_get (gl_omap_t map, const void *key) return value; } -GL_OMAP_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_OMAP_INLINE _GL_ATTRIBUTE_NODISCARD 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 d6fb408c0..672527cd3 100644 --- a/lib/gl_oset.h +++ b/lib/gl_oset.h @@ -134,10 +134,7 @@ extern bool gl_oset_search_atleast (gl_oset_t set, 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Removes an element from an ordered set. Returns true if it was found and removed. */ @@ -248,10 +245,7 @@ gl_oset_search_atleast (gl_oset_t set, ->search_atleast (set, threshold_fn, threshold, eltp); } -GL_OSET_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_OSET_INLINE _GL_ATTRIBUTE_NODISCARD 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 0c1f9a3c6..3d48f7e3b 100644 --- a/lib/gl_set.h +++ b/lib/gl_set.h @@ -126,10 +126,7 @@ extern bool gl_set_search (gl_set_t set, const void *elt); 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) -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif - ; + _GL_ATTRIBUTE_NODISCARD; /* Removes an element from a set. Returns true if it was found and removed. */ @@ -233,10 +230,7 @@ gl_set_search (gl_set_t set, const void *elt) return ((const struct gl_set_impl_base *) set)->vtable->search (set, elt); } -GL_SET_INLINE int -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - __attribute__ ((__warn_unused_result__)) -#endif +GL_SET_INLINE _GL_ATTRIBUTE_NODISCARD 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); diff --git a/lib/hash.h b/lib/hash.h index 2ff4266a4..ae08ce867 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -27,24 +27,6 @@ # include # include -/* The __attribute__ feature is available in gcc versions 2.5 and later. - The warn_unused_result attribute appeared first in gcc-3.4.0. */ -# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# define _GL_ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__)) -# else -# define _GL_ATTRIBUTE_WUR /* empty */ -# endif - -# ifndef _GL_ATTRIBUTE_DEPRECATED -/* The __attribute__((__deprecated__)) feature - is available in gcc versions 3.1 and newer. */ -# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) -# define _GL_ATTRIBUTE_DEPRECATED /* empty */ -# else -# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) -# endif -# endif - typedef size_t (*Hash_hasher) (const void *, size_t); typedef bool (*Hash_comparator) (const void *, const void *); typedef void (*Hash_data_freer) (void *); @@ -88,16 +70,16 @@ size_t hash_string (const char *, size_t) _GL_ATTRIBUTE_PURE; void hash_reset_tuning (Hash_tuning *); Hash_table *hash_initialize (size_t, const Hash_tuning *, Hash_hasher, Hash_comparator, - Hash_data_freer) _GL_ATTRIBUTE_WUR; + Hash_data_freer) _GL_ATTRIBUTE_NODISCARD; Hash_table *hash_xinitialize (size_t, const Hash_tuning *, Hash_hasher, Hash_comparator, - Hash_data_freer) _GL_ATTRIBUTE_WUR; + Hash_data_freer) _GL_ATTRIBUTE_NODISCARD; void hash_clear (Hash_table *); void hash_free (Hash_table *); /* Insertion and deletion. */ -bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_WUR; -void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_WUR; +bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_NODISCARD; +void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_NODISCARD; int hash_insert_if_absent (Hash_table *table, const void *entry, const void **matched_ent); diff --git a/lib/ino-map.h b/lib/ino-map.h index b7422912f..1bdf886f4 100644 --- a/lib/ino-map.h +++ b/lib/ino-map.h @@ -3,17 +3,10 @@ # include -# undef _GL_ATTRIBUTE_NONNULL -# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__ -# define _GL_ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) -# else -# define _GL_ATTRIBUTE_NONNULL(m) -# endif - # define INO_MAP_INSERT_FAILURE ((size_t) -1) struct ino_map *ino_map_alloc (size_t); -void ino_map_free (struct ino_map *) _GL_ATTRIBUTE_NONNULL (1); -size_t ino_map_insert (struct ino_map *, ino_t) _GL_ATTRIBUTE_NONNULL (1); +void ino_map_free (struct ino_map *) _GL_ATTRIBUTE_NONNULL ((1)); +size_t ino_map_insert (struct ino_map *, ino_t) _GL_ATTRIBUTE_NONNULL ((1)); #endif diff --git a/lib/inttostr.h b/lib/inttostr.h index f1c20815e..39b437683 100644 --- a/lib/inttostr.h +++ b/lib/inttostr.h @@ -22,25 +22,8 @@ #include "intprops.h" -#ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -#endif - -#if __GNUC_PREREQ (3,4) -# undef __attribute_warn_unused_result__ -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif - -char *imaxtostr (intmax_t, char *) __attribute_warn_unused_result__; -char *inttostr (int, char *) __attribute_warn_unused_result__; -char *offtostr (off_t, char *) __attribute_warn_unused_result__; -char *uinttostr (unsigned int, char *) __attribute_warn_unused_result__; -char *umaxtostr (uintmax_t, char *) __attribute_warn_unused_result__; +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; diff --git a/lib/mbrtoc32.c b/lib/mbrtoc32.c index facf28bc5..dc35ba2d4 100644 --- a/lib/mbrtoc32.c +++ b/lib/mbrtoc32.c @@ -21,17 +21,11 @@ /* Specification. */ #include +#include + #include #include -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - #if GNULIB_defined_mbstate_t /* AIX, IRIX */ /* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales and directly for the UTF-8 locales. */ diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index 6cb52675b..a71d39430 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -50,18 +50,11 @@ # endif +# include "attribute.h" # include "verify.h" # include "lc-charset-dispatch.h" # include "mbtowc-lock.h" -# ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -# endif - verify (sizeof (mbstate_t) >= 4); static char internal_state[4]; diff --git a/lib/nstrftime.c b/lib/nstrftime.c index 8c520ce61..5326de60f 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -68,16 +68,9 @@ extern char *tzname[]; #include #include +#include #include -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - #ifdef COMPILE_WIDE # include # define CHAR_T wchar_t diff --git a/lib/quotearg.c b/lib/quotearg.c index c78fc1670..b13574d2f 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -29,6 +29,7 @@ #include "quotearg.h" #include "quote.h" +#include "attribute.h" #include "minmax.h" #include "xalloc.h" #include "c-strcaseeq.h" @@ -54,14 +55,6 @@ #define INT_BITS (sizeof (int) * CHAR_BIT) -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - struct quoting_options { /* Basic quoting style. */ diff --git a/lib/safe-alloc.h b/lib/safe-alloc.h index 3c9f20fa0..58970bd00 100644 --- a/lib/safe-alloc.h +++ b/lib/safe-alloc.h @@ -31,22 +31,14 @@ # endif #endif -# ifndef _GL_ATTRIBUTE_RETURN_CHECK -# if __GNUC_PREREQ (3, 4) -# define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) -# else -# define _GL_ATTRIBUTE_RETURN_CHECK -# endif -# endif - /* Don't call these directly - use the macros below */ int safe_alloc_alloc_n (void *ptrptr, size_t size, size_t count, int zeroed) - _GL_ATTRIBUTE_RETURN_CHECK; + _GL_ATTRIBUTE_NODISCARD; int safe_alloc_realloc_n (void *ptrptr, size_t size, size_t count) - _GL_ATTRIBUTE_RETURN_CHECK; + _GL_ATTRIBUTE_NODISCARD; /** * ALLOC: diff --git a/lib/savewd.c b/lib/savewd.c index 2b68e417b..ecc70fbcc 100644 --- a/lib/savewd.c +++ b/lib/savewd.c @@ -33,17 +33,10 @@ #include #include "assure.h" +#include "attribute.h" #include "fcntl-safer.h" #include "filename.h" -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - /* Save the working directory into *WD, if it hasn't been saved already. Return true if a child has been forked to do the real work. */ diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c index 976f8d398..0b5ec9064 100644 --- a/lib/unistr/u8-uctomb-aux.c +++ b/lib/unistr/u8-uctomb-aux.c @@ -20,13 +20,7 @@ /* Specification. */ #include "unistr.h" -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif +#include "attribute.h" int u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n) diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c index d9980022c..7cf338963 100644 --- a/lib/unistr/u8-uctomb.c +++ b/lib/unistr/u8-uctomb.c @@ -25,13 +25,7 @@ /* Specification. */ #include "unistr.h" -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif +#include "attribute.h" #if !HAVE_INLINE diff --git a/lib/unused-parameter.h b/lib/unused-parameter.h index dd8be7c57..baf80c03a 100644 --- a/lib/unused-parameter.h +++ b/lib/unused-parameter.h @@ -28,9 +28,5 @@ _GL_UNUSED_PARAMETER int *(*param)(void) */ #ifndef _GL_UNUSED_PARAMETER -# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__)) -# else -# define _GL_UNUSED_PARAMETER -# endif +# define _GL_UNUSED_PARAMETER _GL_ATTRIBUTE_MAYBE_UNUSED #endif diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index b3b6e7b78..0cdc6c095 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -94,6 +94,7 @@ /* Checked size_t computations. */ #include "xsize.h" +#include "attribute.h" #include "verify.h" #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL @@ -125,14 +126,6 @@ # include "fpucw.h" #endif -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif - /* Default parameters. */ #ifndef VASNPRINTF # if WIDE_CHAR_VERSION diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index b4795c18a..1a817662c 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 48 +# gnulib-common.m4 serial 49 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,6 +15,15 @@ AC_DEFUN([gl_COMMON], [ AC_REQUIRE([gl_ZZGNULIB]) ]) AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([_GL_GNUC_PREREQ], +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _GL_GNUC_PREREQ(major, minor) 0 +#endif +]) AH_VERBATIM([_Noreturn], [/* The _Noreturn keyword of C11. */ #ifndef _Noreturn @@ -31,12 +40,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + || _GL_GNUC_PREREQ (4, 7) \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ : 3 < __clang_major__ + (5 <= __clang_minor__)))) /* _Noreturn works as-is. */ -# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# elif _GL_GNUC_PREREQ (2, 8) || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) @@ -55,48 +64,200 @@ AC_DEFUN([gl_COMMON_BODY], [ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif]) - AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) + AH_VERBATIM([attribute], +[/* Attributes. */ +#ifdef __has_attribute +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else -# define _GL_UNUSED +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result_GL_GNUC_PREREQ (3, 4) #endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED - -/* gcc supports the "unused" attribute on possibly unused labels, and - g++ has since version 4.5. Note to support C++ as well as C, - _GL_UNUSED_LABEL should be used with a trailing ; */ -#if !defined __cplusplus || __GNUC__ > 4 \ - || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -# define _GL_UNUSED_LABEL _GL_UNUSED + +]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. +[ +#if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else -# define _GL_UNUSED_LABEL +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) #endif -/* The __pure__ attribute was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) #else -# define _GL_ATTRIBUTE_PURE /* empty */ +# define _GL_ATTRIBUTE_ALWAYS_INLINE #endif -/* The __const__ attribute was added in gcc 2.95. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +#else +# define _GL_ATTRIBUTE_ARTIFICIAL +#endif + +/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at + . */ +#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +#else +# define _GL_ATTRIBUTE_COLD +#endif + +#if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else -# define _GL_ATTRIBUTE_CONST /* empty */ +# define _GL_ATTRIBUTE_CONST +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +#elif _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +#else +# define _GL_ATTRIBUTE_DEPRECATED +#endif + +#if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__((__warning__ (msg))) +#else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +#endif + +#if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +#else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#endif + +/* FALLTHROUGH is special, because it always expands to something. */ +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +#elif _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +#else +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +#endif + +#if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) +#endif + +#if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +#else +# define _GL_ATTRIBUTE_LEAF +#endif + +#if _GL_HAS_ATTRIBUTE (may_alias) +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +#else +# define _GL_ATTRIBUTE_MAY_ALIAS #endif -/* The __malloc__ attribute was added in gcc 3. */ -#if 3 <= __GNUC__ +#if 201710L < __STDC_VERSION__ +# 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 +#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 __attribute__ ((__malloc__)) #else -# define _GL_ATTRIBUTE_MALLOC /* empty */ +# define _GL_ATTRIBUTE_MALLOC +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +#elif _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +#else +# define _GL_ATTRIBUTE_NODISCARD +#endif + +#if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +#else +# define _GL_ATTRIBUTE_NOINLINE +#endif + +#if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +#else +# define _GL_ATTRIBUTE_NONNULL(args) +#endif + +#if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +#else +# define _GL_ATTRIBUTE_NONSTRING +#endif + +/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ + +#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +#else +# define _GL_ATTRIBUTE_NOTHROW +#endif + +#if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#else +# define _GL_ATTRIBUTE_PACKED +#endif + +#if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE +#endif + +#if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +#else +# define _GL_ATTRIBUTE_SENTINEL(pos) +#endif + +]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 +#else +# define _GL_UNUSED_LABEL #endif ]) AH_VERBATIM([async_safe], diff --git a/modules/attribute b/modules/attribute new file mode 100644 index 000000000..fcb0442c7 --- /dev/null +++ b/modules/attribute @@ -0,0 +1,19 @@ +Description: +C/C++ attributes + +Files: +lib/attribute.h + +Depends-on: + +configure.ac: + +Makefile.am: + +Include: + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/backup-rename b/modules/backup-rename index 0d6c34bd5..1e29b73be 100644 --- a/modules/backup-rename +++ b/modules/backup-rename @@ -10,6 +10,7 @@ m4/backupfile.m4 Depends-on: argmatch +attribute closedir d-ino dirent-safer diff --git a/modules/backupfile b/modules/backupfile index 7916d6adc..dc46d7687 100644 --- a/modules/backupfile +++ b/modules/backupfile @@ -10,6 +10,7 @@ m4/backupfile.m4 Depends-on: argmatch +attribute closedir d-ino dirent-safer diff --git a/modules/c-vasnprintf b/modules/c-vasnprintf index 391d9647f..5fe1fa7d6 100644 --- a/modules/c-vasnprintf +++ b/modules/c-vasnprintf @@ -22,6 +22,7 @@ m4/math_h.m4 m4/exponentd.m4 Depends-on: +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/fnmatch b/modules/fnmatch index 50a2c7183..c7977b4fb 100644 --- a/modules/fnmatch +++ b/modules/fnmatch @@ -10,6 +10,7 @@ m4/fnmatch.m4 Depends-on: fnmatch-h alloca [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1] +attribute [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1] builtin-expect [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1] flexmember [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1] stdbool [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1] diff --git a/modules/freopen-safer b/modules/freopen-safer index bfeb0ce88..8b1e8655a 100644 --- a/modules/freopen-safer +++ b/modules/freopen-safer @@ -7,6 +7,7 @@ lib/stdio-safer.h lib/freopen-safer.c Depends-on: +attribute dup2 freopen open diff --git a/modules/fts b/modules/fts index 3e09bcc91..480700b1c 100644 --- a/modules/fts +++ b/modules/fts @@ -8,6 +8,7 @@ lib/fts-cycle.c m4/fts.m4 Depends-on: +attribute closedir cycle-check d-ino diff --git a/modules/mbrtoc32 b/modules/mbrtoc32 index cf418464e..e99c0f0a0 100644 --- a/modules/mbrtoc32 +++ b/modules/mbrtoc32 @@ -18,6 +18,7 @@ m4/visibility.m4 Depends-on: uchar +attribute [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1] hard-locale [{ test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1; } && test $REPLACE_MBSTATE_T = 0] mbrtowc [{ test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1; } && test $REPLACE_MBSTATE_T = 0] localcharset [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1] diff --git a/modules/mbrtowc b/modules/mbrtowc index 294050f94..0b6478e90 100644 --- a/modules/mbrtowc +++ b/modules/mbrtowc @@ -22,6 +22,7 @@ m4/visibility.m4 Depends-on: wchar extensions +attribute [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] stdint [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] hard-locale [{ test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; } && test $REPLACE_MBSTATE_T = 0] mbsinit [{ test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; } && test $REPLACE_MBSTATE_T = 0] diff --git a/modules/nstrftime b/modules/nstrftime index a1ce1b33f..7ff82896b 100644 --- a/modules/nstrftime +++ b/modules/nstrftime @@ -8,6 +8,7 @@ m4/tm_gmtoff.m4 m4/nstrftime.m4 Depends-on: +attribute extensions intprops stdbool diff --git a/modules/quotearg b/modules/quotearg index 9d9276ed1..6f5356dcc 100644 --- a/modules/quotearg +++ b/modules/quotearg @@ -10,6 +10,7 @@ m4/mbrtowc.m4 m4/quotearg.m4 Depends-on: +attribute c-strcaseeq extensions gettext-h diff --git a/modules/savewd b/modules/savewd index 935540cbd..198596ef6 100644 --- a/modules/savewd +++ b/modules/savewd @@ -8,6 +8,7 @@ m4/savewd.m4 Depends-on: assure +attribute chdir errno extern-inline diff --git a/modules/unistdio/u16-u16-vasnprintf b/modules/unistdio/u16-u16-vasnprintf index 6997f372f..cae63721b 100644 --- a/modules/unistdio/u16-u16-vasnprintf +++ b/modules/unistdio/u16-u16-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/u16-vasnprintf b/modules/unistdio/u16-vasnprintf index 29c82a6b9..940ff2eae 100644 --- a/modules/unistdio/u16-vasnprintf +++ b/modules/unistdio/u16-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/u32-u32-vasnprintf b/modules/unistdio/u32-u32-vasnprintf index 58f657997..358cb73e6 100644 --- a/modules/unistdio/u32-u32-vasnprintf +++ b/modules/unistdio/u32-u32-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/u32-vasnprintf b/modules/unistdio/u32-vasnprintf index be0c3cd11..2167c4781 100644 --- a/modules/unistdio/u32-vasnprintf +++ b/modules/unistdio/u32-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/u8-u8-vasnprintf b/modules/unistdio/u8-u8-vasnprintf index 57ed3fe76..6ac98b63b 100644 --- a/modules/unistdio/u8-u8-vasnprintf +++ b/modules/unistdio/u8-u8-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/u8-vasnprintf b/modules/unistdio/u8-vasnprintf index 884179032..7a6654003 100644 --- a/modules/unistdio/u8-vasnprintf +++ b/modules/unistdio/u8-vasnprintf @@ -30,6 +30,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute isnand-nolibm isnanl-nolibm frexpl-nolibm diff --git a/modules/unistdio/ulc-vasnprintf b/modules/unistdio/ulc-vasnprintf index 750602f86..9c8f48f40 100644 --- a/modules/unistdio/ulc-vasnprintf +++ b/modules/unistdio/ulc-vasnprintf @@ -27,6 +27,7 @@ unistr/u16-strlen unistr/u16-strmblen unistr/u32-strlen unistr/u32-strmblen +attribute mbsnlen isnand-nolibm isnanl-nolibm diff --git a/modules/unistr/u8-uctomb b/modules/unistr/u8-uctomb index c32b2d6b0..7cc94e0da 100644 --- a/modules/unistr/u8-uctomb +++ b/modules/unistr/u8-uctomb @@ -7,6 +7,7 @@ lib/unistr/u8-uctomb-aux.c Depends-on: unistr/base +attribute configure.ac: gl_MODULE_INDICATOR([unistr/u8-uctomb]) diff --git a/modules/vasnprintf b/modules/vasnprintf index de8537acb..893ce974b 100644 --- a/modules/vasnprintf +++ b/modules/vasnprintf @@ -22,6 +22,7 @@ m4/exponentd.m4 Depends-on: alloca-opt +attribute float stdint xsize -- 2.17.1