bug-bison
[Top][All Lists]
Advanced

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

Re: [PATCH] build: avoid printf format mismatch warnings


From: Joel E. Denny
Subject: Re: [PATCH] build: avoid printf format mismatch warnings
Date: Sun, 11 Oct 2009 19:49:55 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 29 Sep 2009, Joel E. Denny wrote:

> On Tue, 29 Sep 2009, Eric Blake wrote:
> 
> > For this to work on all platforms, you need the gnulib module fprintf-posix 
> > (sadly, %zu is not completely portable yet).
> 
> Thanks for pointing that out.

> Also, is there any single module that ensures portability of all *printf 
> functions, or should I include every *printf-posix module individually in 
> order to ensure consistent behavior?

I wrote bug-gnulib:

  http://lists.gnu.org/archive/html/bug-gnulib/2009-10/msg00108.html

Based on that discussion, I'm thinking of pushing the following.  I'm 
hesitating for a few reasons:

1. I'm not sure why bootstrap.conf was careful to exclude 
m4/printf-posix.m4.  Maybe to avoid bloat?

2. -DGNULIB_POSIXCHECK suggests realloc-posix for the sake of 
vasnprintf.c, so it seems realloc-posix ought to be a dependency of 
vasnprintf-posix.  I'll explore further later and maybe take it to the 
gnulib maintainers.

3. -DGNULIB_POSIXCHECK is suggesting a lot of other modules.  We need to 
explore those at some point.

4. I'm trying to decide whether to apply the patch to branch-2.4.2.

>From dc96d0cbdb17dee59920ad8eb9732213ccb99a84 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 11 Oct 2009 19:44:14 -0400
Subject: [PATCH] portability: use -DGNULIB_POSIXCHECK.

Reported by Eric Blake.  See discussions at
<http://lists.gnu.org/archive/html/bug-bison/2009-09/msg00008.html>
and
<http://lists.gnu.org/archive/html/bug-gnulib/2009-10/msg00108.html>.
* HACKING (Release checks): Suggest -DGNULIB_POSIXCHECK.
* bootstrap.conf (gnulib_modules): Add all the printf modules
suggested by -DGNULIB_POSIXCHECK.  Add realloc-posix as
suggested by -DGNULIB_POSIXCHECK for gnulib's own vasnprintf.c.
(excluded_files): Remove m4/printf-posix.m4.
---
 ChangeLog      |   13 +++++++++++++
 HACKING        |    3 +++
 bootstrap.conf |   10 ++++++----
 lib/.cvsignore |   44 ++++++++++++++++++++++++++++++++++++++++++++
 lib/.gitignore |   44 ++++++++++++++++++++++++++++++++++++++++++++
 m4/.cvsignore  |   34 ++++++++++++++++++++++++++++++++++
 m4/.gitignore  |   34 ++++++++++++++++++++++++++++++++++
 7 files changed, 178 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0e138d..c486a3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2009-10-11  Joel E. Denny  <address@hidden>
 
+       portability: use -DGNULIB_POSIXCHECK.
+       Reported by Eric Blake.  See discussions at
+       <http://lists.gnu.org/archive/html/bug-bison/2009-09/msg00008.html>
+       and
+       <http://lists.gnu.org/archive/html/bug-gnulib/2009-10/msg00108.html>.
+       * HACKING (Release checks): Suggest -DGNULIB_POSIXCHECK.
+       * bootstrap.conf (gnulib_modules): Add all the printf modules
+       suggested by -DGNULIB_POSIXCHECK.  Add realloc-posix as
+       suggested by -DGNULIB_POSIXCHECK for gnulib's own vasnprintf.c.
+       (excluded_files): Remove m4/printf-posix.m4.
+
+2009-10-11  Joel E. Denny  <address@hidden>
+
        portability: use va_start and va_end in the same function.
        * src/complain.c (error_message): Move va_end from here...
        (ERROR_MESSAGE): ... to here.
diff --git a/HACKING b/HACKING
index 82f07bb..4edb98b 100644
--- a/HACKING
+++ b/HACKING
@@ -172,6 +172,9 @@ release:
   that 1. Bison compiles cleanly, 2. the parsers it produces compile
   cleanly too.
 
+- Build with -DGNULIB_POSIXCHECK.  It suggests gnulib modules that can
+  fix portability issues.
+
 - run `make maintainer-check' which:
   - runs `valgrind -q bison' to run Bison under Valgrind.
   - runs the parsers under Valgrind.
diff --git a/bootstrap.conf b/bootstrap.conf
index 1cef2f0..a1a4518 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -20,9 +20,12 @@ gnulib_modules='
   announce-gen argmatch config-h c-strcase configmake dirname error
   extensions fopen-safer gendocs getopt-gnu gettext git-version-gen hash
   inttypes javacomp-script javaexec-script maintainer-makefile malloc
-  mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
-  strverscmp unistd unistd-safer unlocked-io update-copyright unsetenv
-  verify warnings xalloc xalloc-die xstrndup
+  mbswidth obstack quote quotearg realloc-posix stdbool stpcpy strerror
+  strtoul strverscmp unistd unistd-safer unlocked-io update-copyright
+  unsetenv verify warnings xalloc xalloc-die xstrndup
+
+  fprintf-posix printf-posix snprintf-posix sprintf-posix
+  vsnprintf-posix vsprintf-posix
 '
 
 # Additional xgettext options to use.  Use "\\\newline" to break lines.
@@ -52,7 +55,6 @@ excluded_files='
     m4/lcmessage.m4
     m4/lock.m4
     m4/longdouble.m4
-    m4/printf-posix.m4
     m4/signed.m4
     m4/size_max.m4
     m4/uintmax_t.m4




reply via email to

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