]> Savannah Git Hosting - gnulib.git/commitdiff
attribute: new module
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 May 2020 01:12:12 +0000 (18:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 May 2020 20:49:20 +0000 (13:49 -0700)
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.

55 files changed:
ChangeLog
MODULES.html.sh
doc/attribute.texi [new file with mode: 0644]
doc/gnulib.texi
lib/anytostr.c
lib/attribute.h [new file with mode: 0644]
lib/backupfile.c
lib/bitset/base.h
lib/c-stack.c
lib/dfa.c
lib/di-set.h
lib/fnmatch.c
lib/freopen-safer.c
lib/fts.c
lib/fts_.h
lib/gl_list.h
lib/gl_map.h
lib/gl_omap.h
lib/gl_oset.h
lib/gl_set.h
lib/hash.h
lib/ino-map.h
lib/inttostr.h
lib/mbrtoc32.c
lib/mbrtowc.c
lib/nstrftime.c
lib/quotearg.c
lib/safe-alloc.h
lib/savewd.c
lib/unistr/u8-uctomb-aux.c
lib/unistr/u8-uctomb.c
lib/unused-parameter.h
lib/vasnprintf.c
m4/gnulib-common.m4
modules/attribute [new file with mode: 0644]
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

index eeaa1af65c8d2aa748f12d4fcbda0ea97d1112fa..fa1e2bdb7c5eb7c6af5b4a52e66d6bb37d18c8a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,72 @@
+2020-05-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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-03  Bruno Haible  <bruno@clisp.org>
 
        bison: Fix today's commit.
index 240a9ee20e79b6171375798170c887b079c75c10..318a15a1de961c68bae432d237ff2084d3d60f40 100755 (executable)
@@ -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 (file)
index 0000000..86591f1
--- /dev/null
@@ -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 <https://www.gnu.org/licenses/fdl-1.3.en.html>.
+
+@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 <attribute.h>
+
+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.
index c9501ca237b9934035b1c1e180e0ae14b01ce4e3..3719978b6e701b7c1bb38dbb7a072ef347890f85 100644 (file)
@@ -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
index da602a7d7783cb0cd4f84cd3c8238441b22caa87..5dcd211b4282a0b3fd62d61863d4bd738dfa63de 100644 (file)
@@ -32,7 +32,7 @@
    INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
    printable string, which need not start at BUF.  */
 
-char * __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 (file)
index 0000000..ffd9bdf
--- /dev/null
@@ -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 <https://www.gnu.org/licenses/>.  */
+
+/* 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 */
index 319f084ef04d53120d0ca6f8ef958cf019607732..7edd9c3dbb59c46c3274687bf3fd9b5e31f25523 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "backup-internal.h"
 
+#include "attribute.h"
 #include "dirname.h"
 #include "opendirat.h"
 #include "renameatu.h"
 #include <string.h>
 #include <unistd.h>
 
-#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
index 46ec894eceb107151a51175e9cad14f11f7bbd5d..1020515a467ae18df669a4dd2c2eecabb545fbf4 100644 (file)
 
 #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).
index 50a0380c25b9bfa6b69f9f857ada55345546b25e..4050d08e1c2ac1814070e2e360cc1fea5a09b649 100644 (file)
 
 #include <config.h>
 
-#ifndef __attribute__
-# if __GNUC__ < 3
-#  define __attribute__(x)
-# endif
-#endif
-
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
index 9939d228a855dd5f0acbed15e9d2753e09d5c47a..dee7be86172db44683e345669caef9ab4160a51a 100644 (file)
--- 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__))
index abc3161fea4af11463ff75fbe3382e8d21824954..bec5b3f9e4560b29a3aed5d63797e9e28a0a93b0 100644 (file)
@@ -3,17 +3,10 @@
 
 # include <sys/types.h>
 
-# 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
index 79c1a3b2ecd23cae7d1afb07e1ef5015371e38ff..224512d8cebcbd09f4b7ed93cfa8255f998d99e9 100644 (file)
@@ -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))
index adaa978f14272ecf493012eb4cdc55832e508841..b69fd1a75ec80911fec04b0d0e5b6311ef69d197 100644 (file)
 
 #include "stdio-safer.h"
 
+#include "attribute.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <stdbool.h>
 #include <unistd.h>
 
-#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
index bf62dfa92625cffbcf1a3bf3cb28d6b5723cc1fc..3b2f693b4432117806d0dbf2d7324a7ab39be9d2 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -70,6 +70,7 @@ static char sccsid[] = "@(#)fts.c       8.6 (Berkeley) 8/14/94";
 #include <unistd.h>
 
 #if ! _LIBC
+# include "attribute.h"
 # include "fcntl--.h"
 # include "flexmember.h"
 # include "openat.h"
index 15c248cba884ca47498a078cdf9a25b700221217..e7a9ead77097cace514c7550e9efa234a195732f 100644 (file)
@@ -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
 
index dfec6d0b5ea736322b536056f59304fdbee905ac..53d6e5da617fa9ea10e56284aee78a82ac68fb6c 100644 (file)
@@ -197,10 +197,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.  */
@@ -231,10 +228,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;
 
 /* Replaces the element at the first position in the list.
    Returns its node.
@@ -243,10 +237,7 @@ extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position,
 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)
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-  __attribute__ ((__warn_unused_result__))
-#endif
-  ;
+  _GL_ATTRIBUTE_NODISCARD;
 
 /* Replaces the element at the last position in the list.
    Returns its node.
@@ -255,10 +246,7 @@ extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt)
 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)
-#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.  */
@@ -301,10 +289,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.  */
@@ -312,10 +297,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.  */
@@ -326,10 +308,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.  */
@@ -339,10 +318,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).  */
@@ -352,10 +328,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.  */
@@ -499,10 +472,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.
@@ -639,10 +609,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)
 {
@@ -683,29 +650,20 @@ gl_list_get_last (gl_list_t list)
   return gl_list_get_at (list, gl_list_size (list) - 1);
 }
 
-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
          ->nx_set_at (list, position, 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_set_first (gl_list_t list, const void *elt)
 {
   return gl_list_nx_set_at (list, 0, 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_set_last (gl_list_t list, const void *elt)
 {
   return gl_list_nx_set_at (list, gl_list_size (list) - 1, elt);
@@ -759,50 +717,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
@@ -913,10 +856,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
index 8a203b6270a972d39aa2dc2667a474746f30b57f..977457ce8dca84a704a51d44c5ffa98b962082b1 100644 (file)
@@ -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;
index c534db5826737b2eb636355818c4ad84be92f24d..e789ba3f0a992eeb263c9a65e030814e4716ab2c 100644 (file)
@@ -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;
index d6fb408c0ead9ce8303348f25ac264a25d5e8e0a..672527cd390a0c02bb4e09291665d91da55465b0 100644 (file)
@@ -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);
index 0c1f9a3c6981ad11cc7307305a3653c6a1119132..3d48f7e3bb246321bfecc2a82faaec4dadd08dd2 100644 (file)
@@ -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);
index 2ff4266a4fd936c75eb31cee9c4722820e13c784..ae08ce867855a3e11559e0bae39021a7b97f3ceb 100644 (file)
 # include <stdio.h>
 # include <stdbool.h>
 
-/* 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);
index b7422912f2b0b3e006daacf76ee45908dcbd7adb..1bdf886f46f0597b3b38301cbac87ca22e5c9b3f 100644 (file)
@@ -3,17 +3,10 @@
 
 # include <sys/types.h>
 
-# 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
index f1c20815e34469fc3e940073f3961b353118fcce..39b4376839b9e260e04838dee1b58b79d5deeed9 100644 (file)
 
 #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;
index facf28bc547b82024f5b5d2d500bf810d607f1ed..dc35ba2d4240d2ed9e186a8cafe12614cd35cbfd 100644 (file)
 /* Specification.  */
 #include <uchar.h>
 
+#include <attribute.h>
+
 #include <errno.h>
 #include <stdlib.h>
 
-#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.  */
index 6cb52675be41a9234e5415d709134f47d8140ffe..a71d3943034aac56a45f8de5768b50d6ec50067a 100644 (file)
 
 # 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];
 
index 8c520ce619f2ba49c571bd31c67446f7f1a2f40e..5326de60f70106e2759445ac9fa58710df031b2a 100644 (file)
@@ -68,16 +68,9 @@ extern char *tzname[];
 #include <string.h>
 #include <stdbool.h>
 
+#include <attribute.h>
 #include <intprops.h>
 
-#ifndef FALLTHROUGH
-# if __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
-#  define FALLTHROUGH __attribute__ ((__fallthrough__))
-# endif
-#endif
-
 #ifdef COMPILE_WIDE
 # include <endian.h>
 # define CHAR_T wchar_t
index c78fc1670f44bcd8fd79083faeb81c0e9df12bea..b13574d2fd5a770d2cd4fc1cf7be037ff8952755 100644 (file)
@@ -29,6 +29,7 @@
 #include "quotearg.h"
 #include "quote.h"
 
+#include "attribute.h"
 #include "minmax.h"
 #include "xalloc.h"
 #include "c-strcaseeq.h"
 
 #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.  */
index 3c9f20fa0a733e7e75e4c865b39e89f451ec865a..58970bd00ad92e8374da3e2fb9c88cdb91710f8a 100644 (file)
 # 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:
index 2b68e417b8fe737e03a8e8f53df5b507ae507d51..ecc70fbcc19a164ded447b8baddd503c6f3bf834 100644 (file)
 #include <unistd.h>
 
 #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.  */
index 976f8d39888bc9ce9e2f014cdb31a22299745b45..0b5ec906429bd097e56530b4859891d916d62d03 100644 (file)
 /* 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)
index d9980022c2bbbbd14f4ad5315d62cac1bfaeb500..7cf33896323ce3f0dca30f24726c2e8365c0e553 100644 (file)
 /* 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
 
index dd8be7c57ac3fc0ea3ccba91ee938cb62f320f68..baf80c03ac22ea75fea2960c47877fb755013e4d 100644 (file)
@@ -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
index b3b6e7b7867428ac479181956c35d1abf11fe0ea..0cdc6c095a44d0260c405bbc4bd46224038e5a09 100644 (file)
@@ -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
 # 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
index b4795c18aeb1beb4cf086e149920ddd349b4497d..1a817662c2795726c6d066296514d14304e1ad12 100644 (file)
@@ -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
+   <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. */
+#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 (file)
index 0000000..fcb0442
--- /dev/null
@@ -0,0 +1,19 @@
+Description:
+C/C++ attributes
+
+Files:
+lib/attribute.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index 0d6c34bd514cd37352a493fa456cee745ab3e6dd..1e29b73bedfff2f24c20f01b24cc41442e4a6bc8 100644 (file)
@@ -10,6 +10,7 @@ m4/backupfile.m4
 
 Depends-on:
 argmatch
+attribute
 closedir
 d-ino
 dirent-safer
index 7916d6adcb5c02c5077b754151f520f25af167e8..dc46d76872c7dff5aa5380686b545064766e7ed5 100644 (file)
@@ -10,6 +10,7 @@ m4/backupfile.m4
 
 Depends-on:
 argmatch
+attribute
 closedir
 d-ino
 dirent-safer
index 391d9647fff93856efc6da3bd56feb0694b4be8c..5fe1fa7d6e7e12f27ce7bc1b6bd1680d2bcde164 100644 (file)
@@ -22,6 +22,7 @@ m4/math_h.m4
 m4/exponentd.m4
 
 Depends-on:
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 50a2c71830cff6a41f2b196248c70820c399c1f3..c7977b4fb3dbdd529bbea12c1c6c8ba18f94e2f0 100644 (file)
@@ -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]
index bfeb0ce88f0d7ddbd76a4e31e560e21b081c8c6b..8b1e8655a2ff008daa880cd9e38c75cb534732b0 100644 (file)
@@ -7,6 +7,7 @@ lib/stdio-safer.h
 lib/freopen-safer.c
 
 Depends-on:
+attribute
 dup2
 freopen
 open
index 3e09bcc9104f56e8fc68946135326ce587d718f7..480700b1ca8a9be9e3434340e518058400f95bf2 100644 (file)
@@ -8,6 +8,7 @@ lib/fts-cycle.c
 m4/fts.m4
 
 Depends-on:
+attribute
 closedir
 cycle-check
 d-ino
index cf418464ebc60d4d2baf399460ddad2b793815b6..e99c0f0a0f6b5be70fd467a4a4330c87e4a06c41 100644 (file)
@@ -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]
index 294050f94bec4b0b7f191bc6ce6a5e69c33331e6..0b6478e90e1530eeb10cb0e84571886c1dcb9869 100644 (file)
@@ -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]
index a1ce1b33f647ce53f47ba6aef793430b96bff24d..7ff82896ba29d22c51c257524e7838d64981a997 100644 (file)
@@ -8,6 +8,7 @@ m4/tm_gmtoff.m4
 m4/nstrftime.m4
 
 Depends-on:
+attribute
 extensions
 intprops
 stdbool
index 9d9276ed1e781d1d446a6273d9e66416190a7484..6f5356dcc66095a3dde3f196ba4c83114beeebb2 100644 (file)
@@ -10,6 +10,7 @@ m4/mbrtowc.m4
 m4/quotearg.m4
 
 Depends-on:
+attribute
 c-strcaseeq
 extensions
 gettext-h
index 935540cbd9216d2d5188475e1ef938374d887b5d..198596ef678c6c90f9cc241a84b8496a39f78be4 100644 (file)
@@ -8,6 +8,7 @@ m4/savewd.m4
 
 Depends-on:
 assure
+attribute
 chdir
 errno
 extern-inline
index 6997f372f4dc83e64eedb20bf1e8ebbe4f62f041..cae63721b71df56e5881da16877da5168d3367e2 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 29c82a6b98405e2f901e6e30b009757fdc1145c7..940ff2eaee37a1b8f8242aa16d3c5a45b5fd2eb2 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 58f657997fb232b51cfae7614a8fb1a27fe67f64..358cb73e6be873990282ee7d27418d6964f1b3cc 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index be0c3cd11b35c80d9bbeb2410f4e82fdf683aa76..2167c4781de7343357f8301824cd4e7e93c27ec2 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 57ed3fe76dd6735d0c11000ce20493a98c2bfea3..6ac98b63b93ceacce3a4fa76a7816915ef23834e 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 884179032b3031e818efefe4c91da61863d2c8de..7a6654003c5db6b8dc9a3b8afc0c072719625e9b 100644 (file)
@@ -30,6 +30,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 isnand-nolibm
 isnanl-nolibm
 frexpl-nolibm
index 750602f8613febf2dc8b3ef6e3f145127bb041f3..9c8f48f408052f3494f9891057c028bc5a445f0b 100644 (file)
@@ -27,6 +27,7 @@ unistr/u16-strlen
 unistr/u16-strmblen
 unistr/u32-strlen
 unistr/u32-strmblen
+attribute
 mbsnlen
 isnand-nolibm
 isnanl-nolibm
index c32b2d6b032eb4c43028a7d6a821431e82a5984e..7cc94e0da7e434b2b138f9ae03cbb7bbaefa79f3 100644 (file)
@@ -7,6 +7,7 @@ lib/unistr/u8-uctomb-aux.c
 
 Depends-on:
 unistr/base
+attribute
 
 configure.ac:
 gl_MODULE_INDICATOR([unistr/u8-uctomb])
index de8537acb728e0f589d16c90f86da55947cca909..893ce974b62c09b727e1105a0de673c17e7cef95 100644 (file)
@@ -22,6 +22,7 @@ m4/exponentd.m4
 
 Depends-on:
 alloca-opt
+attribute
 float
 stdint
 xsize