From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4166 invoked by alias); 14 May 2005 10:10:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4021 invoked from network); 14 May 2005 10:10:18 -0000 Received: from unknown (HELO legolas.inter.net.il) (192.114.186.24) by sourceware.org with SMTP; 14 May 2005 10:10:18 -0000 Received: from zaretski (IGLD-83-130-254-105.inter.net.il [83.130.254.105]) by legolas.inter.net.il (MOS 3.5.6-GR) with ESMTP id EJJ60632 (AUTH halo1); Sat, 14 May 2005 13:10:13 +0300 (IDT) Date: Sat, 14 May 2005 10:23:00 -0000 From: "Eli Zaretskii" To: gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com Message-ID: <01c5586c$Blat.v2.4$a7dfc720@zahav.net.il> Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=ISO-8859-1 In-reply-to: <20050512205103.GB13519@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 12 May 2005 16:51:03 -0400) Subject: Re: [RFA] Eliminate warnings about snprintf declaration Reply-to: Eli Zaretskii References: <01c4c990$Blat.v2.2.2$887ec720@zahav.net.il> <41994B9D.9080809@gnu.org> <01c55702$Blat.v2.4$d4764900@zahav.net.il> <20050512150804.GA1808@nevyn.them.org> <01c55708$Blat.v2.4$cfc9f040@zahav.net.il> <20050512154716.GA3513@nevyn.them.org> <01c5570e$Blat.v2.4$1c533160@zahav.net.il> <20050512162453.GA5180@nevyn.them.org> <01c55732$Blat.v2.4$e9bd3640@zahav.net.il> <20050512205103.GB13519@nevyn.them.org> X-SW-Source: 2005-05/txt/msg00337.txt.bz2 > Date: Thu, 12 May 2005 16:51:03 -0400 > From: Daniel Jacobowitz > Cc: gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com > > > 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 > 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 configure.ac files. Okay? 2005-05-14 Eli Zaretskii * libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if needed. (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 @@ ATTRIBUTE_PRINTF(2,0); #endif +#if !HAVE_DECL_SNPRINTF +/* Like sprintf but prints at most N characters. */ +extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3; +#endif + +#if !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,