Commit ddcf783b by Eli Zaretskii Committed by Andreas Jaeger

libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if needed.

include:
2005-05-28  Eli Zaretskii  <eliz@gnu.org>

	* libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if
	needed.
	(vsnprintf) [!HAVE_DECL_VSNPRINTF]: Declare if needed.

libiberty:
2005-05-28  Eli Zaretskii  <eliz@gnu.org>

	* configure.ac: Add snprintf and vsnprintf to AC_CHEK_DECLS.
	* config.in, configure: Regenerate.

From-SVN: r100292
parent 81ae598b
2005-05-28 Eli Zaretskii <eliz@gnu.org>
* libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if
needed.
(vsnprintf) [!HAVE_DECL_VSNPRINTF]: Declare if needed.
2005-05-25 Richard Henderson <rth@redhat.com> 2005-05-25 Richard Henderson <rth@redhat.com>
* demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New. * demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New.
...@@ -7,7 +13,7 @@ ...@@ -7,7 +13,7 @@
* libiberty.h (ACONCAT): Properly cast value of alloca(). * libiberty.h (ACONCAT): Properly cast value of alloca().
* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if * ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
__cplusplus. __cplusplus.
2005-05-12 Steve Ellcey <sje@cup.hp.com> 2005-05-12 Steve Ellcey <sje@cup.hp.com>
...@@ -67,7 +73,7 @@ ...@@ -67,7 +73,7 @@
2005-03-28 Mark Mitchell <mark@codesourcery.com> 2005-03-28 Mark Mitchell <mark@codesourcery.com>
* libiberty.h (ffs): Declare, if necessary. * libiberty.h (ffs): Declare, if necessary.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> 2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* xregex2.h (_RE_ARGS): Remove definition and uses. * xregex2.h (_RE_ARGS): Remove definition and uses.
...@@ -177,9 +183,9 @@ ...@@ -177,9 +183,9 @@
* hashtab.h (struct htab): Add size_prime_index. * hashtab.h (struct htab): Add size_prime_index.
2004-04-13 Jeff Law <law@redhat.com> 2004-04-13 Jeff Law <law@redhat.com>
* hashtab.h (htab_remove_elt_with_hash): Prototype new function. * hashtab.h (htab_remove_elt_with_hash): Prototype new function.
2004-03-30 Zack Weinberg <zack@codesourcery.com> 2004-03-30 Zack Weinberg <zack@codesourcery.com>
* hashtab.h, splay-tree.h: Use new shorter form of GTY markers. * hashtab.h, splay-tree.h: Use new shorter form of GTY markers.
......
...@@ -531,6 +531,16 @@ extern int vasprintf (char **, const char *, va_list) ...@@ -531,6 +531,16 @@ extern int vasprintf (char **, const char *, va_list)
ATTRIBUTE_PRINTF(2,0); ATTRIBUTE_PRINTF(2,0);
#endif #endif
#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
/* Like sprintf but prints at most N characters. */
extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
#endif
#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
/* Like vsprintf but prints at most N characters. */
extern int vsnprintf (char *, size_t, const char *, va_list);
#endif
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
/* Drastically simplified alloca configurator. If we're using GCC, /* Drastically simplified alloca configurator. If we're using GCC,
......
2005-05-28 Eli Zaretskii <eliz@gnu.org>
* configure.ac: Add snprintf and vsnprintf to AC_CHEK_DECLS.
* config.in, configure: Regenerate.
2005-05-25 Richard Henderson <rth@redhat.com> 2005-05-25 Richard Henderson <rth@redhat.com>
* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_HIDDEN_ALIAS. * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_HIDDEN_ALIAS.
...@@ -8,7 +13,7 @@ ...@@ -8,7 +13,7 @@
2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net> 2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
* configure.ac: Check declarations for calloc(), getenv(), * configure.ac: Check declarations for calloc(), getenv(),
malloc(), realloc() and sbrk(). malloc(), realloc() and sbrk().
* config.in: Regenerate. * config.in: Regenerate.
* configure: Likewise. * configure: Likewise.
...@@ -20,7 +25,7 @@ ...@@ -20,7 +25,7 @@
(concat): Use XNEWVEC instead of xmalloc. (concat): Use XNEWVEC instead of xmalloc.
(reconcat): Likewise. (reconcat): Likewise.
* cp-demangle.c (struct d_print_template): Rename member * cp-demangle.c (struct d_print_template): Rename member
"template" to "template_decl". Adjust use throughout the file. "template" to "template_decl". Adjust use throughout the file.
(d_print_resize): Properly cast return value of realloc(). (d_print_resize): Properly cast return value of realloc().
(cplus_demangle_print): Same for malloc(). (cplus_demangle_print): Same for malloc().
(d_demangle): Likewise. (d_demangle): Likewise.
...@@ -50,7 +55,7 @@ ...@@ -50,7 +55,7 @@
* getpwd.c (getpwd): Use XNEWVEC. * getpwd.c (getpwd): Use XNEWVEC.
(htab_create_alloc_ex): Use C90 prototype-style. (htab_create_alloc_ex): Use C90 prototype-style.
* lrealpath.c (lrealpath): Appropriately cast return value of * lrealpath.c (lrealpath): Appropriately cast return value of
malloc(). malloc().
* make-relative-prefix.c (save_string): Likewise. * make-relative-prefix.c (save_string): Likewise.
* make-temp-file.c (try_dir): Rename from "try". Adjust use in * make-temp-file.c (try_dir): Rename from "try". Adjust use in
the file. the file.
......
...@@ -68,10 +68,18 @@ ...@@ -68,10 +68,18 @@
*/ */
#undef HAVE_DECL_SBRK #undef HAVE_DECL_SBRK
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you /* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
don't. */ don't. */
#undef HAVE_DECL_VASPRINTF #undef HAVE_DECL_VASPRINTF
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VSNPRINTF
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
......
...@@ -5300,6 +5300,146 @@ _ACEOF ...@@ -5300,6 +5300,146 @@ _ACEOF
fi fi
echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6
if test "${ac_cv_have_decl_snprintf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef snprintf
char *p = (char *) snprintf;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_decl_snprintf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_snprintf=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6
if test $ac_cv_have_decl_snprintf = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SNPRINTF 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SNPRINTF 0
_ACEOF
fi
echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5
echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6
if test "${ac_cv_have_decl_vsnprintf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef vsnprintf
char *p = (char *) vsnprintf;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_decl_vsnprintf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_vsnprintf=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5
echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6
if test $ac_cv_have_decl_vsnprintf = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VSNPRINTF 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VSNPRINTF 0
_ACEOF
fi
...@@ -7215,6 +7355,146 @@ _ACEOF ...@@ -7215,6 +7355,146 @@ _ACEOF
fi fi
echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6
if test "${ac_cv_have_decl_snprintf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef snprintf
char *p = (char *) snprintf;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_decl_snprintf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_snprintf=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6
if test $ac_cv_have_decl_snprintf = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SNPRINTF 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SNPRINTF 0
_ACEOF
fi
echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5
echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6
if test "${ac_cv_have_decl_vsnprintf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
#ifndef vsnprintf
char *p = (char *) vsnprintf;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_decl_vsnprintf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_vsnprintf=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5
echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6
if test $ac_cv_have_decl_vsnprintf = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VSNPRINTF 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VSNPRINTF 0
_ACEOF
fi
echo "$as_me:$LINENO: checking whether calloc is declared" >&5 echo "$as_me:$LINENO: checking whether calloc is declared" >&5
......
...@@ -282,7 +282,7 @@ if test "x" = "y"; then ...@@ -282,7 +282,7 @@ if test "x" = "y"; then
sysconf times sbrk gettimeofday ffs snprintf vsnprintf \ sysconf times sbrk gettimeofday ffs snprintf vsnprintf \
pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl wait3 wait4 \ pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl wait3 wait4 \
realpath canonicalize_file_name __fsetlocking) realpath canonicalize_file_name __fsetlocking)
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf]) AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf])
AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
...@@ -518,7 +518,7 @@ if test -z "${setobjs}"; then ...@@ -518,7 +518,7 @@ if test -z "${setobjs}"; then
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
AC_CHECK_FUNCS($checkfuncs) AC_CHECK_FUNCS($checkfuncs)
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf]) AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf])
AC_CHECK_DECLS([calloc, getenv, malloc, realloc, sbrk]) AC_CHECK_DECLS([calloc, getenv, malloc, realloc, sbrk])
libiberty_NEED_DECLARATION(canonicalize_file_name) libiberty_NEED_DECLARATION(canonicalize_file_name)
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment