[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] build: accommodate -Wshadow and -Werror=suggest-attribute=pure
From: |
Jim Meyering |
Subject: |
[PATCH] build: accommodate -Wshadow and -Werror=suggest-attribute=pure |
Date: |
Sun, 05 Feb 2012 18:01:30 +0100 |
Hi Paolo,
Your just-pushed changes provoked these new warnings:
dfa.c: In function 'state_separate_contexts.isra.1':
dfa.c:2131:1: error: function might be candidate for attribute 'pure' if it
is kn
own to return normally [-Werror=suggest-attribute=pure]
cc1: all warnings being treated as errors
dfa.c: In function 'dfaexec':
dfa.c:3276:14: error: declaration of 'newline' shadows a global declaration
[-Werror=shadow]
dfa.c:573:18: error: shadowed declaration is here [-Werror=shadow]
Please configure with --enable-gcc-warnings.
That would have caught at least the shadowing warning.
For the other, you might have to build on rawhide or with gcc-4.7
>From 3ade04b83128c0b0edbb17a83e98cadaf03b4fa4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 5 Feb 2012 17:58:25 +0100
Subject: [PATCH] build: accommodate -Wshadow and
-Werror=suggest-attribute=pure
* src/dfa.c (state_separate_contexts): Add _GL_ATTRIBUTE_PURE.
(dfaexec): Rename parameter, s/newline/allow_nl/, to avoid
shadowing the global.
---
src/dfa.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index b46cd35..01f3645 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2127,8 +2127,8 @@ charclass_context(charclass c)
also different from the follow set of the complement set. However,
all contexts in the complement set will have the same follow set. */
-static int
-state_separate_contexts(position_set *s, int possible_contexts)
+static int _GL_ATTRIBUTE_PURE
+state_separate_contexts (position_set *s, int possible_contexts)
{
int separate_context = 0;
unsigned int j;
@@ -3266,14 +3266,14 @@ prepare_wc_buf (const char *begin, const char *end)
points to the beginning of the buffer, and END points to the first byte
after its end. Note however that we store a sentinel byte (usually
newline) in *END, so the actual buffer must be one byte longer.
- When NEWLINE is nonzero, newlines may appear in the matching string.
+ When ALLOW_NL is nonzero, newlines may appear in the matching string.
If COUNT is non-NULL, increment *COUNT once for each newline processed.
Finally, if BACKREF is non-NULL set *BACKREF to indicate whether we
encountered a back-reference (1) or not (0). The caller may use this
to decide whether to fall back on a backtracking matcher. */
char *
dfaexec (struct dfa *d, char const *begin, char *end,
- int newline, int *count, int *backref)
+ int allow_nl, int *count, int *backref)
{
int s, s1; /* Current state. */
unsigned char const *p; /* Current input character. */
@@ -3404,7 +3404,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
continue;
}
- if (p[-1] == eol && newline)
+ if (p[-1] == eol && allow_nl)
{
s = d->newlines[s1];
continue;
--
1.7.9.112.gb85f2
- [PATCH] build: accommodate -Wshadow and -Werror=suggest-attribute=pure,
Jim Meyering <=