From 1d27f2ae7983295480d2313d3b2a631f9962840a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 8 Feb 2010 15:07:14 -0700 Subject: [PATCH] obstack-printf-posix: ensure declaration The replacement 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 --- ChangeLog | 13 +++++++++++++ lib/stdio.in.h | 2 +- m4/obstack-printf-posix.m4 | 3 ++- m4/obstack-printf.m4 | 17 ++++++++++++----- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfa1dbd7d..928d8466b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-02-09 Eric Blake + and Bruno Haible + + 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 gnulib-tool: Fix typo in 2010-02-07 commit. diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 3ac4b69ad..44b7cd155 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -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 diff --git a/m4/obstack-printf-posix.m4 b/m4/obstack-printf-posix.m4 index 578812a13..606aca137 100644 --- a/m4/obstack-printf-posix.m4 +++ b/m4/obstack-printf-posix.m4 @@ -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 ]) diff --git a/m4/obstack-printf.m4 b/m4/obstack-printf.m4 index ae2e5d9d7..b74a46bf4 100644 --- a/m4/obstack-printf.m4 +++ b/m4/obstack-printf.m4 @@ -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 +]) -- 2.11.0