bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-patch] [PATCH] build: update to latest gnulib and adapt


From: Jim Meyering
Subject: [bug-patch] [PATCH] build: update to latest gnulib and adapt
Date: Wed, 14 Dec 2011 16:40:39 +0100

There have been a lot of changes in gnulib (over 650 change sets),
so I updated.  That pulled in a few new gcc warning options that
suggest additions of the const and pure attributes.  I've added those.
It also enabled the -Wformat-nonliteral option, which gets too many
false positives, so I've disabled that one.

There were also a couple of false-positives to new syntax-check
rules, which I've exempted.

Ok to push?

>From 5cb38ce3903b5c33750cd52f983a8f68f945c7dd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 9 Oct 2011 11:40:42 +0200
Subject: [PATCH] build: update to latest gnulib and adapt

Mark functions as pure of const, per recommendations enabled by
new gcc -W options.  Apply _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST.
* src/common.h: Apply new function attributes.
* src/pch.c: Likewise.
* src/pch.h: Likewise.
* src/util.c: Likewise.
* src/util.h: Likewise.
* configure.ac: Use -Wno-format-nonliteral.
* m4/.gitignore: Update.
* gnulib: Update to latest.
* cfg.mk: Exempt src/util.c from two tests, to avoid new
"make syntax-check" failures.
---
 cfg.mk        |    3 +++
 configure.ac  |    1 +
 gnulib        |    2 +-
 m4/.gitignore |    9 +++++++++
 src/common.h  |    2 +-
 src/pch.c     |    6 +++---
 src/pch.h     |   36 ++++++++++++++++++------------------
 src/util.c    |    2 +-
 src/util.h    |    2 +-
 9 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 11f335b..c908a8d 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -33,3 +33,6 @@ local-checks-to-skip = \
   sc_require_test_exit_idiom \
   sc_space_tab \
   sc_useless_cpp_parens
+
+exclude_file_name_regexp--sc_prohibit_doubled_word = ^src/util\.c$$
+exclude_file_name_regexp--sc_unmarked_diagnostics = ^src/util\.c$$
diff --git a/configure.ac b/configure.ac
index 08aa9ed..20fe5b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,6 +108,7 @@ if test "$gl_gcc_warnings" = yes; then

   gl_WARN_ADD([-fdiagnostics-show-option])
   gl_WARN_ADD([-funit-at-a-time])
+  gl_WARN_ADD([-Wno-format-nonliteral])

   AC_SUBST([WARN_CFLAGS])

diff --git a/gnulib b/gnulib
index 17857d4..443bc5f 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 17857d41b41e7b22ba58e4e0d98693ee14f022d4
+Subproject commit 443bc5ffcf7429e557f4a371b0661abe98ddbc13
diff --git a/m4/.gitignore b/m4/.gitignore
index a9814e0..dad1f7a 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -5,6 +5,7 @@
 /bison.m4
 /canonicalize.m4
 /clock_time.m4
+/closedir.m4
 /codeset.m4
 /configmake.m4
 /d-ino.m4
@@ -18,11 +19,13 @@
 /environ.m4
 /errno_h.m4
 /error.m4
+/exponentd.m4
 /extensions.m4
 /fcntl-o.m4
 /fcntl.m4
 /fcntl_h.m4
 /float_h.m4
+/fstat.m4
 /getdtablesize.m4
 /getopt.m4
 /gettime.m4
@@ -48,6 +51,7 @@
 /malloc.m4
 /malloca.m4
 /manywarnings.m4
+/math_h.m4
 /mbrtowc.m4
 /mbsinit.m4
 /mbstate_t.m4
@@ -56,13 +60,18 @@
 /mkdir.m4
 /mktime.m4
 /mmap-anon.m4
+/msvc-inval.m4
+/msvc-nothrow.m4
 /multiarch.m4
 /nocrash.m4
+/opendir.m4
 /parse-datetime.m4
 /pathmax.m4
 /printf.m4
 /quote.m4
 /quotearg.m4
+/raise.m4
+/readdir.m4
 /readlink.m4
 /realloc.m4
 /rename.m4
diff --git a/src/common.h b/src/common.h
index 43919b8..38ecc99 100644
--- a/src/common.h
+++ b/src/common.h
@@ -202,7 +202,7 @@ XTERN lin out_offset;
 XTERN lin last_frozen_line;

 bool copy_till (struct outstate *, lin);
-bool similar (char const *, size_t, char const *, size_t);
+bool similar (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;

 #ifdef ENABLE_MERGE
 enum conflict_style { MERGE_MERGE, MERGE_DIFF3 };
diff --git a/src/pch.c b/src/pch.c
index 6909850..0d0c4b9 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -315,7 +315,7 @@ there_is_another_patch (bool need_header, mode_t *file_type)
     return true;
 }

-static mode_t
+static mode_t _GL_ATTRIBUTE_PURE
 fetchmode (char const *str)
 {
    const char *s;
@@ -366,7 +366,7 @@ sha1_says_nonexistent(char const *sha1, char const *end)
   return s == end;
 }

-static char const *
+static char const * _GL_ATTRIBUTE_PURE
 skip_hex_digits (char const *str)
 {
   char const *s;
@@ -2248,7 +2248,7 @@ pch_mode (bool which)
    This accepts just a subset of the valid commands, but it's
    good enough in practice.  */

-static char
+static char _GL_ATTRIBUTE_PURE
 get_ed_command_letter (char const *line)
 {
   char const *p = line;
diff --git a/src/pch.h b/src/pch.h
index 6383d85..5e2498b 100644
--- a/src/pch.h
+++ b/src/pch.h
@@ -19,28 +19,28 @@

 enum nametype { OLD, NEW, INDEX, NONE };

-lin pch_end (void);
-lin pch_first (void);
-lin pch_hunk_beg (void);
-char const *pch_c_function (void);
-char const * pch_timestr (bool which);
-mode_t pch_mode (bool which);
-lin pch_newfirst (void);
-lin pch_prefix_context (void);
-lin pch_ptrn_lines (void);
-lin pch_repl_lines (void);
-lin pch_suffix_context (void);
+lin pch_end (void) _GL_ATTRIBUTE_PURE;
+lin pch_first (void) _GL_ATTRIBUTE_PURE;
+lin pch_hunk_beg (void) _GL_ATTRIBUTE_PURE;
+char const *pch_c_function (void) _GL_ATTRIBUTE_PURE;
+char const * pch_timestr (bool which) _GL_ATTRIBUTE_PURE;
+mode_t pch_mode (bool which) _GL_ATTRIBUTE_PURE;
+lin pch_newfirst (void) _GL_ATTRIBUTE_PURE;
+lin pch_prefix_context (void) _GL_ATTRIBUTE_PURE;
+lin pch_ptrn_lines (void) _GL_ATTRIBUTE_PURE;
+lin pch_repl_lines (void) _GL_ATTRIBUTE_PURE;
+lin pch_suffix_context (void) _GL_ATTRIBUTE_PURE;
 bool pch_swap (void);
 bool pch_write_line (lin, FILE *);
 bool there_is_another_patch (bool, mode_t *);
-char *pfetch (lin);
-char pch_char (lin);
+char *pfetch (lin) _GL_ATTRIBUTE_PURE;
+char pch_char (lin) _GL_ATTRIBUTE_PURE;
 int another_hunk (enum diff, bool);
-int pch_says_nonexistent (bool);
-size_t pch_line_len (lin);
-const char *pch_name(enum nametype);
-bool pch_copy (void);
-bool pch_rename (void);
+int pch_says_nonexistent (bool) _GL_ATTRIBUTE_PURE;
+size_t pch_line_len (lin) _GL_ATTRIBUTE_PURE;
+const char *pch_name(enum nametype) _GL_ATTRIBUTE_PURE;
+bool pch_copy (void) _GL_ATTRIBUTE_PURE;
+bool pch_rename (void) _GL_ATTRIBUTE_PURE;
 void do_ed_script (char const *, char const *, int *, FILE *);
 void open_patch_file (char const *);
 void re_patch (void);
diff --git a/src/util.c b/src/util.c
index 6ffc6cc..71dd004 100644
--- a/src/util.c
+++ b/src/util.c
@@ -123,7 +123,7 @@ file_already_seen (struct stat const *st)
   return hash_lookup (file_id_table, &f) != 0;
 }

-static bool
+static bool _GL_ATTRIBUTE_PURE
 contains_slash (const char *s)
 {
   for (; *s; s++)
diff --git a/src/util.h b/src/util.h
index 26a9a21..67f5e4d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -74,7 +74,7 @@ enum file_attributes {
 void set_file_attributes (char const *, enum file_attributes, char const *,
                          struct stat *, mode_t, struct timespec *);

-static inline char const *
+static inline char const * _GL_ATTRIBUTE_PURE
 skip_spaces (char const *str)
 {
   while (ISSPACE ((unsigned char) *str))
--
1.7.8.163.g9859a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]