[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] [PATCH] build: update to latest gnulib and adapt
From: |
Jim Meyering |
Subject: |
[bug-diffutils] [PATCH] build: update to latest gnulib and adapt |
Date: |
Wed, 14 Dec 2011 15:57:01 +0100 |
I've updated to the latest gnulib and adapted to
the resulting increase in gcc warnings that are enabled
as well as to the addition of a syntax-check rule that
caught a reversed use of compare in one of the test scripts:
>From c88c3b6b2ae94bf5d72a04dd4fb797cb386fcb07 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 14 Dec 2011 14:28:47 +0100
Subject: [PATCH] build: update to latest gnulib and adapt
* tests/binary: Reverse arguments to compare to avoid failure of
new syntax-check rule.
* configure.ac: Use -Wno-format-nonliteral.
Mark functions as pure of const, per recommendations enabled by
new gcc -W options. Use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST.
* lib/cmpbuf.h (buffer_lcm, block_compare):
Apply pure and/or const attributes.
* src/cmp.c (block_compare): Likewise.
* src/context.c (find_hunk): Likewise.
* src/diff.h (lines_differ): Likewise.
* src/diff3.c (skipwhite): Likewise.
* src/dir.c (dir_loop): Likewise.
* src/util.c (find_change, find_reverse_change): Likewise.
(translate_line_number): Likewise.
---
configure.ac | 1 +
gnulib | 2 +-
lib/cmpbuf.h | 2 +-
src/cmp.c | 2 +-
src/context.c | 2 +-
src/diff.h | 2 +-
src/diff3.c | 2 +-
src/dir.c | 2 +-
src/util.c | 6 +++---
tests/binary | 2 +-
10 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 93aa791..37fa430 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,7 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
+ gl_WARN_ADD([-Wno-format-nonliteral])
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
diff --git a/gnulib b/gnulib
index 996ce97..443bc5f 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 996ce97a8f8572ae9bade6c7df1aa364bd0e259f
+Subproject commit 443bc5ffcf7429e557f4a371b0661abe98ddbc13
diff --git a/lib/cmpbuf.h b/lib/cmpbuf.h
index 2296766..c19c2bb 100644
--- a/lib/cmpbuf.h
+++ b/lib/cmpbuf.h
@@ -16,4 +16,4 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
size_t block_read (int, char *, size_t);
-size_t buffer_lcm (size_t, size_t, size_t);
+size_t buffer_lcm (size_t, size_t, size_t) _GL_ATTRIBUTE_CONST;
diff --git a/src/cmp.c b/src/cmp.c
index 2620b0f..2aba127 100644
--- a/src/cmp.c
+++ b/src/cmp.c
@@ -51,7 +51,7 @@
static int cmp (void);
static off_t file_position (int);
-static size_t block_compare (word const *, word const *);
+static size_t block_compare (word const *, word const *) _GL_ATTRIBUTE_PURE;
static size_t block_compare_and_count (word const *, word const *, off_t *);
static void sprintc (char *, unsigned char);
diff --git a/src/context.c b/src/context.c
index 690506b..812e373 100644
--- a/src/context.c
+++ b/src/context.c
@@ -394,7 +394,7 @@ pr_unidiff_hunk (struct change *hunk)
2*CONTEXT unchanged lines appear, and return a pointer
to the `struct change' for the last change before those lines. */
-static struct change *
+static struct change * _GL_ATTRIBUTE_PURE
find_hunk (struct change *start)
{
struct change *prev;
diff --git a/src/diff.h b/src/diff.h
index 578c4ea..a64f0d3 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -361,7 +361,7 @@ extern void print_sdiff_script (struct change *);
extern char const change_letter[4];
extern char const pr_program[];
extern char *concat (char const *, char const *, char const *);
-extern bool lines_differ (char const *, char const *);
+extern bool lines_differ (char const *, char const *) _GL_ATTRIBUTE_PURE;
extern lin translate_line_number (struct file_data const *, lin);
extern struct change *find_change (struct change *);
extern struct change *find_reverse_change (struct change *);
diff --git a/src/diff3.c b/src/diff3.c
index 343c055..3f51fb9 100644
--- a/src/diff3.c
+++ b/src/diff3.c
@@ -1045,7 +1045,7 @@ process_diff (char const *filea,
/* Skip tabs and spaces, and return the first character after them. */
-static char *
+static char * _GL_ATTRIBUTE_PURE
skipwhite (char *s)
{
while (*s == ' ' || *s == '\t')
diff --git a/src/dir.c b/src/dir.c
index 20626d1..45f2992 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -308,7 +308,7 @@ diff_dirs (struct comparison const *cmp,
/* Return nonzero if CMP is looping recursively in argument I. */
-static bool
+static bool _GL_ATTRIBUTE_PURE
dir_loop (struct comparison const *cmp, int i)
{
struct comparison const *p = cmp;
diff --git a/src/util.c b/src/util.c
index 5808434..2e15cdb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -477,13 +477,13 @@ lines_differ (char const *s1, char const *s2)
/* Find the consecutive changes at the start of the script START.
Return the last link before the first gap. */
-struct change *
+struct change * _GL_ATTRIBUTE_CONST
find_change (struct change *start)
{
return start;
}
-struct change *
+struct change * _GL_ATTRIBUTE_CONST
find_reverse_change (struct change *start)
{
return start;
@@ -635,7 +635,7 @@ char const change_letter[] = { 0, 'd', 'a', 'c' };
Internal line numbers count from 0 starting after the prefix.
Actual line numbers count from 1 within the entire file. */
-lin
+lin _GL_ATTRIBUTE_PURE
translate_line_number (struct file_data const *file, lin i)
{
return i + file->prefix_lines + 1;
diff --git a/tests/binary b/tests/binary
index 02c71a3..d7b3943 100755
--- a/tests/binary
+++ b/tests/binary
@@ -11,7 +11,7 @@ printf '\0'|diff - /dev/null > out 2> err
# diff must exit with status 2, stdout as above, and no stderr.
test $? = 2 || fail=1
-compare out out-exp || fail=1
+compare out-exp out || fail=1
compare /dev/null err || fail=1
Exit $fail
--
1.7.8.163.g9859a
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-diffutils] [PATCH] build: update to latest gnulib and adapt,
Jim Meyering <=