I've just updated to the latest from gnulib, and that brought in some new gcc warning options. To accommodate them, I've added the _GL_ATTRIBUTE_PURE attribute to several functions.
>From bbd6d2ec9eb72193b7720dfb568cec751df13509 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Mon, 28 Nov 2011 22:50:34 +0100 Subject: [PATCH 1/2] build: accommodate -Werror=suggest-attribute=pure Now that we're using the latest manywarnings module from gnulib, accommodate gcc's -Werror=suggest-attribute=pure option by marking suggested functions with gnulib-defined _GL_ATTRIBUTE_PURE. * src/kwset.c (hasevery): Mark function with pure attribute. (bmexec): Likewise. * src/dfa.c (nsubtoks, istrstr, find_pred, dfamusts): Likewise. * configure.ac: Disable (for lib/) options that seem not to be worth the trouble: -Wunsuffixed-float-constants and -Wformat-nonliteral. --- configure.ac | 2 ++ src/dfa.c | 8 ++++---- src/kwset.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 0478d52..6c0f29d 100644 --- a/configure.ac +++ b/configure.ac @@ -164,6 +164,8 @@ if test "$gl_gcc_warnings" = yes; then #nw="$nw -Wmissing-prototypes" nw="$nw -Wold-style-definition" nw="$nw -Wcast-align" + nw="$nw -Wunsuffixed-float-constants" + gl_WARN_ADD([-Wno-format-nonliteral]) gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) fi diff --git a/src/dfa.c b/src/dfa.c index 9e7c136..3214f29 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -755,7 +755,7 @@ static const struct dfa_ctype prednames[] = { { NULL, NULL, false } }; -static const struct dfa_ctype * +static const struct dfa_ctype * _GL_ATTRIBUTE_PURE find_pred (const char *str) { unsigned int i; @@ -1679,7 +1679,7 @@ atom (void) } /* Return the number of tokens in the given subexpression. */ -static int +static int _GL_ATTRIBUTE_PURE nsubtoks (int tindex) { int ntoks1; @@ -3605,7 +3605,7 @@ icpyalloc (char const *string) return icatalloc (NULL, string); } -static char * +static char * _GL_ATTRIBUTE_PURE istrstr (char const *lookin, char const *lookfor) { char const *cp; @@ -4017,7 +4017,7 @@ dfaalloc (void) return xmalloc (sizeof (struct dfa)); } -struct dfamust * +struct dfamust * _GL_ATTRIBUTE_PURE dfamusts (struct dfa const *d) { return d->musts; diff --git a/src/kwset.c b/src/kwset.c index ba556bb..124096c 100644 --- a/src/kwset.c +++ b/src/kwset.c @@ -350,7 +350,7 @@ treedelta (struct tree const *tree, } /* Return true if A has every label in B. */ -static int +static int _GL_ATTRIBUTE_PURE hasevery (struct tree const *a, struct tree const *b) { if (!b) @@ -497,7 +497,7 @@ kwsprep (kwset_t kws) } /* Fast boyer-moore search. */ -static size_t +static size_t _GL_ATTRIBUTE_PURE bmexec (kwset_t kws, char const *text, size_t size) { struct kwset const *kwset; -- 1.7.8.rc3.31.g017d1 >From 8798244b1f23c7df8db079747308c1417254a0ca Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Mon, 28 Nov 2011 22:21:15 +0100 Subject: [PATCH 2/2] build: update gnulib submodule to latest --- gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gnulib b/gnulib index 4f6a7ef..908690c 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 4f6a7ef5f2097b501ddeac9db94d02306e4546d0 +Subproject commit 908690cb743e69c73b42ae310807b29800c8764b -- 1.7.8.rc3.31.g017d1
