This is the mail archive of the
mailing list for the GCC project.
Re: [RFA] Eliminate warnings about snprintf declaration
> Date: Thu, 12 May 2005 16:51:03 -0400
> From: Daniel Jacobowitz <firstname.lastname@example.org>
> Cc: email@example.com, firstname.lastname@example.org
> > So I need to add these functions to gdb/configure.ac _and_ to
> > libiberty/configure.ac; got it. I will post a revised patch soon.
> > Thanks for your patience.
> Almost - you don't actually need them in libiberty/configure.ac, unless
> you see warnings about them during the build of libiberty. To make GDB
> -Werror happy, all you need is gdb/configure.ac and
Actually, I found that a simpler patch to include/libiberty.h (below)
is all that is needed to fix all the warnings about snprintf and
vsnprintf. libiberty.h already does that for asprintf and vasprintf,
so I think we can use the same method for snprintf and vsnprintf; no
need to change any configure.ac files.
2005-05-14 Eli Zaretskii <email@example.com>
* libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if
(vsnprintf) [!HAVE_DECL_VSNPRINTF]: Declare if needed.
RCS file: /cvs/src/src/include/libiberty.h,v
retrieving revision 1.44
diff -u -r1.44 libiberty.h
--- include/libiberty.h 12 May 2005 20:00:35 -0000 1.44
+++ include/libiberty.h 14 May 2005 10:08:37 -0000
@@ -531,6 +531,16 @@
+/* Like sprintf but prints at most N characters. */
+extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
+/* Like vsprintf but prints at most N characters. */
+extern int vsnprintf (char *, size_t, const char *, va_list);
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)))
/* Drastically simplified alloca configurator. If we're using GCC,