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
This commit is contained in:
Eli Zaretskii 2005-05-28 13:40:59 +02:00 committed by Andreas Jaeger
parent 81ae598bbd
commit ddcf783b59
6 changed files with 318 additions and 9 deletions

View File

@ -1,3 +1,9 @@
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>
* demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New.
@ -7,7 +13,7 @@
* libiberty.h (ACONCAT): Properly cast value of alloca().
* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
__cplusplus.
__cplusplus.
2005-05-12 Steve Ellcey <sje@cup.hp.com>
@ -67,7 +73,7 @@
2005-03-28 Mark Mitchell <mark@codesourcery.com>
* libiberty.h (ffs): Declare, if necessary.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* xregex2.h (_RE_ARGS): Remove definition and uses.
@ -177,9 +183,9 @@
* hashtab.h (struct htab): Add size_prime_index.
2004-04-13 Jeff Law <law@redhat.com>
* hashtab.h (htab_remove_elt_with_hash): Prototype new function.
2004-03-30 Zack Weinberg <zack@codesourcery.com>
* hashtab.h, splay-tree.h: Use new shorter form of GTY markers.

View File

@ -531,6 +531,16 @@ extern int vasprintf (char **, const char *, va_list)
ATTRIBUTE_PRINTF(2,0);
#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]))
/* Drastically simplified alloca configurator. If we're using GCC,

View File

@ -1,3 +1,8 @@
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>
* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_HIDDEN_ALIAS.
@ -8,7 +13,7 @@
2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
* configure.ac: Check declarations for calloc(), getenv(),
malloc(), realloc() and sbrk().
malloc(), realloc() and sbrk().
* config.in: Regenerate.
* configure: Likewise.
@ -20,7 +25,7 @@
(concat): Use XNEWVEC instead of xmalloc.
(reconcat): Likewise.
* 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().
(cplus_demangle_print): Same for malloc().
(d_demangle): Likewise.
@ -50,7 +55,7 @@
* getpwd.c (getpwd): Use XNEWVEC.
(htab_create_alloc_ex): Use C90 prototype-style.
* lrealpath.c (lrealpath): Appropriately cast return value of
malloc().
malloc().
* make-relative-prefix.c (save_string): Likewise.
* make-temp-file.c (try_dir): Rename from "try". Adjust use in
the file.

View File

@ -68,10 +68,18 @@
*/
#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
don't. */
#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. */
#undef HAVE_FCNTL_H

280
libiberty/configure vendored
View File

@ -5299,6 +5299,146 @@ else
_ACEOF
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
@ -7214,6 +7354,146 @@ else
_ACEOF
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

View File

@ -282,7 +282,7 @@ if test "x" = "y"; then
sysconf times sbrk gettimeofday ffs snprintf vsnprintf \
pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl wait3 wait4 \
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_NERR, 1, [Define if you have the sys_nerr variable.])
AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
@ -518,7 +518,7 @@ if test -z "${setobjs}"; then
[AC_MSG_RESULT([no])])
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])
libiberty_NEED_DECLARATION(canonicalize_file_name)
fi