This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Eliminate warnings about snprintf declaration

> Date: Thu, 12 May 2005 16:51:03 -0400
> From: Daniel Jacobowitz <>
> Cc:,
> > So I need to add these functions to gdb/ _and_ to
> > libiberty/; got it.  I will post a revised patch soon.
> > 
> > Thanks for your patience.
> Almost - you don't actually need them in libiberty/, unless
> you see warnings about them during the build of libiberty.  To make GDB
> -Werror happy, all you need is gdb/ and
> include/libiberty.h.

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 files.


2005-05-14  Eli Zaretskii  <>

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

Index: include/libiberty.h
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)[0]))
 /* Drastically simplified alloca configurator.  If we're using GCC,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]