Re: inline -Werror=missing-declarations warnings

2012-12-18 Thread Z. Majeed
the check as it stands works only for gcc 4.6 and later because of #pragma GCC 
diagnostic push|pop

--- On Mon, 12/17/12, Pádraig Brady p...@draigbrady.com wrote:

On 12/17/2012 11:50 AM, Z. Majeed wrote:
 Building latest [coreutils] git source (= gnulib d245e6d)...

 ... I had to configure --disable-gcc-warnings to avoid the following errors
 because gcc 4.5.3 is the latest on cygwin and not covered by the ignore
 warnings pragma in extern-inline.m4 for gcc 4.6 and higher:
    CC       dtotimespec.o
 In file included from dtotimespec.c:25:0:
 timespec.h:58:1: error: no previous declaration for 'timespec_cmp'
 [-Werror=missing-declarations]
   timespec_cmp (struct timespec a, struct timespec b)

Should the check in extern-inline.m4 be expanded to all __GNUC_?
39cedf6f said the issue was only with gcc 4.8, but
GCC 4.5.3 (on cygwin at least), seems to have the issue too.

thanks,
Pádraig.




Re: C locale *printf functions ?

2012-12-18 Thread Jim Meyering
Ben Pfaff wrote:
 Here is a revised version.  It passes the included tests, so I'll
 wait 72 hours for comments and then commit it if no one objects.
...
  ChangeLog  |   43 
  lib/c-asprintf.c   |   35 +++
  lib/c-snprintf.c   |   75 +
  lib/c-snprintf.h   |   46 +
  lib/c-vasnprintf.c |   43 
  lib/c-vasnprintf.h |   76 +
  lib/c-vasprintf.c  |   46 +
  lib/c-vasprintf.h  |   51 
  lib/c-vsnprintf.c  |   74 
  lib/c-vsnprintf.h  |   49 +++
  lib/c-xasprintf.c  |   34 +++
  lib/c-xvasprintf.c |   40 ++
  lib/c-xvasprintf.h |   58 
  modules/c-snprintf |   23 +
  modules/c-snprintf-tests   |   17 ++
  modules/c-vasnprintf   |   55 ++
  modules/c-vasprintf|   24 +
  modules/c-vasprintf-tests  |   17 ++
  modules/c-vsnprintf|   24 +
  modules/c-vsnprintf-tests  |   17 ++
  modules/c-xvasprintf   |   24 +
  modules/c-xvasprintf-tests |   18 ++
  tests/test-c-snprintf.c|   58 
  tests/test-c-snprintf.sh   |   15 +
  tests/test-c-vasprintf.c   |   80 
 
  tests/test-c-vasprintf.sh  |   15 +
  tests/test-c-vsnprintf.c   |   73 
  tests/test-c-vsnprintf.sh  |   15 +
  tests/test-c-xvasprintf.c  |   78 ++
  tests/test-c-xvasprintf.sh |   15 +
  30 files changed, 1238 insertions(+)

That sounds great.
I haven't reviewed all of that, but really like the idea
and am glad to see so many tests.
Thanks!



[PATCH] argp: better 'inline'

2012-12-18 Thread Paul Eggert

Use extern-inline module to declare extern inline functions.
This avoids some bogus warning diagnostics.  Problem discovered
when modifying GNU tar to use the manywarnings module.
* lib/argp.h, lib/argp-xinl.c (ARGP_EI) [!_LIBC]:
* lib/argp-fmtstream.h, lib/argp-fs-xinl.c (ARGP_FS_EI) [!_LIBC]:
Define based on extern-inline.
* modules/argp (Depends-on): Add extern-inline.
---
 ChangeLog| 11 +++
 lib/argp-fmtstream.h |  5 +
 lib/argp-fs-xinl.c   |  6 +-
 lib/argp-xinl.c  |  6 +-
 lib/argp.h   |  5 +
 modules/argp |  1 +
 6 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a2d2b23..b9e213b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-12-18  Paul Eggert  egg...@cs.ucla.edu
+
+   argp: better 'inline'
+   Use extern-inline module to declare extern inline functions.
+   This avoids some bogus warning diagnostics.  Problem discovered
+   when modifying GNU tar to use the manywarnings module.
+   * lib/argp.h, lib/argp-xinl.c (ARGP_EI) [!_LIBC]:
+   * lib/argp-fmtstream.h, lib/argp-fs-xinl.c (ARGP_FS_EI) [!_LIBC]:
+   Define based on extern-inline.
+   * modules/argp (Depends-on): Add extern-inline.
+
 2012-12-17  Paul Eggert  egg...@cs.ucla.edu
 
 	filemode, sys_stat: Handle MPX files a la AIX.

diff --git a/lib/argp-fmtstream.h b/lib/argp-fmtstream.h
index a891c3d..3de0979 100644
--- a/lib/argp-fmtstream.h
+++ b/lib/argp-fmtstream.h
@@ -197,6 +197,10 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, 
size_t __amount);
 #define __argp_fmtstream_point argp_fmtstream_point
 #define __argp_fmtstream_update _argp_fmtstream_update
 #define __argp_fmtstream_ensure _argp_fmtstream_ensure
+_GL_INLINE_HEADER_BEGIN
+#ifndef ARGP_FS_EI
+# define ARGP_FS_EI _GL_INLINE
+#endif
 #endif
 
 #ifndef ARGP_FS_EI

@@ -345,6 +349,7 @@ __argp_fmtstream_point (argp_fmtstream_t __fs)
 #undef __argp_fmtstream_point
 #undef __argp_fmtstream_update
 #undef __argp_fmtstream_ensure
+_GL_INLINE_HEADER_END
 #endif
 
 #endif /* __OPTIMIZE__ */

diff --git a/lib/argp-fs-xinl.c b/lib/argp-fs-xinl.c
index b030e58..408e5d0 100644
--- a/lib/argp-fs-xinl.c
+++ b/lib/argp-fs-xinl.c
@@ -20,7 +20,11 @@
 # include config.h
 #endif
 
-#define ARGP_FS_EI

+#ifdef _LIBC
+# define ARGP_FS_EI
+#else
+# define ARGP_FS_EI _GL_EXTERN_INLINE
+#endif
 #undef __OPTIMIZE__
 #define __OPTIMIZE__ 1
 #include argp-fmtstream.h
diff --git a/lib/argp-xinl.c b/lib/argp-xinl.c
index 7d45fcb..731833d 100644
--- a/lib/argp-xinl.c
+++ b/lib/argp-xinl.c
@@ -27,7 +27,11 @@
 #ifndef __USE_EXTERN_INLINES
 # define __USE_EXTERN_INLINES   1
 #endif
-#define ARGP_EI
+#ifdef _LIBC
+# define ARGP_EI
+#else
+# define ARGP_EI _GL_EXTERN_INLINE
+#endif
 #undef __OPTIMIZE__
 #define __OPTIMIZE__ 1
 #include argp.h
diff --git a/lib/argp.h b/lib/argp.h
index c0c68a6..8a7654a 100644
--- a/lib/argp.h
+++ b/lib/argp.h
@@ -579,6 +579,10 @@ extern void *__argp_input (const struct argp *__restrict 
__argp,
 #  define __argp_state_help argp_state_help
 #  define __option_is_short _option_is_short
 #  define __option_is_end _option_is_end
+_GL_INLINE_HEADER_BEGIN
+#  ifndef ARGP_EI
+#   define ARGP_EI _GL_INLINE
+#  endif
 # endif
 
 # ifndef ARGP_EI

@@ -635,6 +639,7 @@ __NTH (__option_is_end (const struct argp_option *__opt))
 #  undef __argp_state_help
 #  undef __option_is_short
 #  undef __option_is_end
+_GL_INLINE_HEADER_END
 # endif
 #endif /* Use extern inlines.  */
 
diff --git a/modules/argp b/modules/argp

index 8d49681..125046a 100644
--- a/modules/argp
+++ b/modules/argp
@@ -25,6 +25,7 @@ m4/argp.m4
 Depends-on:
 alloca
 dirname-lgpl
+extern-inline
 getopt-gnu
 strchrnul
 sysexits
--
1.7.11.7




Re: C locale *printf functions ?

2012-12-18 Thread Ben Pfaff
On Tue, Dec 18, 2012 at 06:41:47PM +0100, Jim Meyering wrote:
 Ben Pfaff wrote:
  Here is a revised version.  It passes the included tests, so I'll
  wait 72 hours for comments and then commit it if no one objects.

 That sounds great.
 I haven't reviewed all of that, but really like the idea
 and am glad to see so many tests.

Thanks a lot for the review.  I pushed this to master.