[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib: update, and use the attribute module
From: |
Akim Demaille |
Subject: |
gnulib: update, and use the attribute module |
Date: |
Sat, 9 May 2020 09:04:30 +0200 |
commit fb49a10e2cda3e7d9069b0cd8ef0ca0bc44bef9a
Author: Akim Demaille <address@hidden>
Date: Fri May 8 17:35:23 2020 +0200
gnulib: update, and use the attribute module
* gnulib: Update.
* bootstrap.conf: Use attribute.
* src/system.h: Remove macros for attributes.
Adjust dependencies.
* src/scan-gram.l (DEPRECATED): Rename as...
(DEPRECATED_DIRECTIVE): this, to avoid the clash with the DEPRECATED macro.
diff --git a/bootstrap.conf b/bootstrap.conf
index a8cb0291..f0207de8 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -17,7 +17,7 @@
# gnulib modules used by this package.
gnulib_modules='
- argmatch array-list assert assure
+ argmatch array-list assert assure attribute
bitsetv
calloc-posix close closeout config-h c-strcase
configmake
diff --git a/gnulib b/gnulib
index 2ac33b29..2e3f0c91 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 2ac33b29fc09f72a18eb08829eb142eb86428747
+Subproject commit 2e3f0c910896a52ce0944bd04d4da3413682cf1f
diff --git a/lib/.gitignore b/lib/.gitignore
index 84f80d99..a34e66ae 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -18,6 +18,7 @@
/asnprintf.c
/asprintf.c
/assure.h
+/attribute.h
/basename-lgpl.c
/basename.c
/binary-io.c
diff --git a/src/complain.h b/src/complain.h
index 65204ce0..84b2381f 100644
--- a/src/complain.h
+++ b/src/complain.h
@@ -132,7 +132,7 @@ bool warning_is_enabled (warnings flags);
/** Make a complaint, with maybe a location. */
void complain (location const *loc, warnings flags, char const *message, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
+ ATTRIBUTE_FORMAT ((__printf__, 3, 4));
/** Likewise, but with an \a argc/argv interface. */
void complain_args (location const *loc, warnings w,
@@ -141,7 +141,7 @@ void complain_args (location const *loc, warnings w,
/** Make a subcomplain with location and note. */
void subcomplain (location const *loc, warnings flags,
char const *message, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
+ ATTRIBUTE_FORMAT ((__printf__, 3, 4));
/** GNU Bison extension not valid with POSIX Yacc. */
diff --git a/src/getargs.c b/src/getargs.c
index 6f19a4ea..74474704 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -30,6 +30,7 @@
#include <getopt.h>
#include <progname.h>
#include <quote.h>
+#include <stdnoreturn.h>
#include <textstyle.h>
#include "complain.h"
@@ -151,8 +152,8 @@ flags_argmatch (const char *opt,
*/
#define FLAGS_ARGMATCH(FlagName, Args, All) \
flags_argmatch ("--" #FlagName, \
- (xargmatch_fn*) argmatch_## FlagName ## _value, \
- argmatch_## FlagName ## _usage, \
+ (xargmatch_fn*) argmatch_## FlagName ## _value, \
+ argmatch_ ## FlagName ## _usage, \
All, &FlagName ## _flag, Args)
/*---------------------.
@@ -337,7 +338,8 @@ const argmatch_feature_group_type argmatch_feature_group =
| Display the help message and exit STATUS. |
`-------------------------------------------*/
-static void usage (int) ATTRIBUTE_NORETURN;
+ _Noreturn
+static void usage (int);
static void
usage (int status)
@@ -860,7 +862,7 @@ getargs (int argc, char *argv[])
void
tr (char *s, char from, char to)
{
- for (; *s; s++)
+ for (; *s; ++s)
if (*s == from)
*s = to;
}
diff --git a/src/scan-gram.l b/src/scan-gram.l
index 80a46134..763432d8 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -74,7 +74,7 @@ static boundary scanner_cursor;
yyless (0); \
} while (0)
-#define DEPRECATED(Msg) \
+#define DEPRECATED_DIRECTIVE(Msg) \
do { \
deprecated_directive (loc, yytext, Msg); \
scanner_cursor.column -= mbsnwidth (Msg, strlen (Msg), 0); \
@@ -295,15 +295,15 @@ eqopt ({sp}=)?
"%name"[-_]"prefix"{eqopt}{sp} RETURN_VALUE (PERCENT_NAME_PREFIX,
uniqstr_new (yytext));
/* Deprecated since Bison 2.7.90, 2012. */
- "%default"[-_]"prec" DEPRECATED ("%default-prec");
+ "%default"[-_]"prec" DEPRECATED_DIRECTIVE ("%default-prec");
"%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE,
uniqstr_new (yytext));
- "%expect"[-_]"rr" DEPRECATED ("%expect-rr");
+ "%expect"[-_]"rr" DEPRECATED_DIRECTIVE ("%expect-rr");
"%file-prefix"{eqopt} RETURN_VALUE (PERCENT_FILE_PREFIX,
uniqstr_new (yytext));
- "%fixed"[-_]"output"[-_]"files" DEPRECATED ("%output \"y.tab.c\"");
- "%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
- "%no"[-_]"lines" DEPRECATED ("%no-lines");
- "%output"{eqopt} DEPRECATED ("%output");
- "%token"[-_]"table" DEPRECATED ("%token-table");
+ "%fixed"[-_]"output"[-_]"files" DEPRECATED_DIRECTIVE ("%output
\"y.tab.c\"");
+ "%no"[-_]"default"[-_]"prec" DEPRECATED_DIRECTIVE ("%no-default-prec");
+ "%no"[-_]"lines" DEPRECATED_DIRECTIVE ("%no-lines");
+ "%output"{eqopt} DEPRECATED_DIRECTIVE ("%output");
+ "%token"[-_]"table" DEPRECATED_DIRECTIVE ("%token-table");
"%"{id} {
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
diff --git a/src/system.h b/src/system.h
index 606d3c46..33986069 100644
--- a/src/system.h
+++ b/src/system.h
@@ -110,28 +110,7 @@ typedef size_t uintptr_t;
Bison's performance anyway. */
# define PACIFY_CC(Code) Code
-# ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if (! defined __GNUC__ || __GNUC__ < 2 \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
-# define __attribute__(Spec) /* empty */
-# endif
-# endif
-
-/* The __-protected variants of 'format' and 'printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __format__ format
-# define __printf__ printf
-# endif
-
-# ifndef ATTRIBUTE_NORETURN
-# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-# endif
-
-# ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-# endif
+# include <attribute.h>
/*------.
diff --git a/src/uniqstr.c b/src/uniqstr.c
index d16e254a..6dba20a6 100644
--- a/src/uniqstr.c
+++ b/src/uniqstr.c
@@ -21,6 +21,7 @@
#include <config.h>
#include "system.h"
+#include <attribute.h>
#include <error.h>
#include <hash.h>
#include <quotearg.h>
@@ -117,12 +118,11 @@ uniqstr_print (uniqstr ustr)
}
static bool
-uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
+uniqstr_print_processor (void *ustr, void *null MAYBE_UNUSED)
{
return uniqstr_print (ustr);
}
-
int
uniqstr_cmp (uniqstr l, uniqstr r)
{
- gnulib: update, and use the attribute module,
Akim Demaille <=