summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-12-14 14:28:47 +0100
committerJim Meyering <meyering@redhat.com>2011-12-14 15:07:57 +0100
commitc88c3b6b2ae94bf5d72a04dd4fb797cb386fcb07 (patch)
tree29b738b64bc0de5ca79b5bd43d0be3c79fa03463
parent439286a937c2ae02374e0389ed2ccd91240a8bd8 (diff)
downloaddiffutils-c88c3b6b2ae94bf5d72a04dd4fb797cb386fcb07.tar.gz
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.
-rw-r--r--configure.ac1
m---------gnulib0
-rw-r--r--lib/cmpbuf.h2
-rw-r--r--src/cmp.c2
-rw-r--r--src/context.c2
-rw-r--r--src/diff.h2
-rw-r--r--src/diff3.c2
-rw-r--r--src/dir.c2
-rw-r--r--src/util.c6
-rwxr-xr-xtests/binary2
10 files changed, 11 insertions, 10 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
-Subproject 996ce97a8f8572ae9bade6c7df1aa364bd0e259
+Subproject 443bc5ffcf7429e557f4a371b0661abe98ddbc1
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