obstack-printf-posix: ensure declaration
authorEric Blake <ebb9@byu.net>
Mon, 8 Feb 2010 22:07:14 +0000 (15:07 -0700)
committerEric Blake <ebb9@byu.net>
Tue, 9 Feb 2010 13:36:46 +0000 (06:36 -0700)
The replacement <stdio.h> was failing to declare obstack_printf
if obstack-printf-posix was used in isolation without unit tests.

* m4/obstack-printf.m4 (gl_DECL_OBSTACK_PRINTF): New macro,
extracted from gl_FUNC_OBSTACK_PRINTF.
(gl_FUNC_OBSTACK_PRINTF): Invoke it.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX):
Likewise.
* lib/stdio.in.h (obstack_printf, obstack_vprintf): Declare also
if GNULIB_OBSTACK_PRINTF_POSIX is 1 and GNULIB_OBSTACK_PRINTF is
0.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/stdio.in.h
m4/obstack-printf-posix.m4
m4/obstack-printf.m4

index bfa1dbd..928d846 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-09  Eric Blake  <ebb9@byu.net>
+       and Bruno Haible  <bruno@clisp.org>
+
+       obstack-printf-posix: ensure declaration
+       * m4/obstack-printf.m4 (gl_DECL_OBSTACK_PRINTF): New macro,
+       extracted from gl_FUNC_OBSTACK_PRINTF.
+       (gl_FUNC_OBSTACK_PRINTF): Invoke it.
+       * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX):
+       Likewise.
+       * lib/stdio.in.h (obstack_printf, obstack_vprintf): Declare also
+       if GNULIB_OBSTACK_PRINTF_POSIX is 1 and GNULIB_OBSTACK_PRINTF is
+       0.
+
 2010-02-08  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Fix typo in 2010-02-07 commit.
index 3ac4b69..44b7cd1 100644 (file)
@@ -386,7 +386,7 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 # endif
 #endif
 
-#if @GNULIB_OBSTACK_PRINTF@
+#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 # if @REPLACE_OBSTACK_PRINTF@
 #  define obstack_printf rpl_osbtack_printf
 #  define obstack_vprintf rpl_obstack_vprintf
index 578812a..606aca1 100644 (file)
@@ -1,4 +1,4 @@
-# obstack-printf-posix.m4 serial 3
+# obstack-printf-posix.m4 serial 4
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,4 +101,5 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX],
     gl_REPLACE_VASNPRINTF
     gl_REPLACE_OBSTACK_PRINTF
   fi
+  gl_DECL_OBSTACK_PRINTF
 ])
index ae2e5d9..b74a46b 100644 (file)
@@ -1,4 +1,4 @@
-# obstack-printf.m4 serial 2
+# obstack-printf.m4 serial 3
 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,7 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF],
     gl_REPLACE_OBSTACK_PRINTF
   fi
 
-  AC_CHECK_DECLS_ONCE([obstack_printf])
-  if test $ac_cv_have_decl_obstack_printf = no; then
-    HAVE_DECL_OBSTACK_PRINTF=0
-  fi
+  gl_DECL_OBSTACK_PRINTF
 ])
 
 AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
@@ -33,3 +30,13 @@ AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
     REPLACE_OBSTACK_PRINTF=1
   fi
 ])
+
+dnl Ensure obstack_printf() and obstack_vprintf() are declared
+dnl (whether or not they are being replaced).
+AC_DEFUN([gl_DECL_OBSTACK_PRINTF],
+[
+  AC_CHECK_DECLS_ONCE([obstack_printf])
+  if test $ac_cv_have_decl_obstack_printf = no; then
+    HAVE_DECL_OBSTACK_PRINTF=0
+  fi
+])