From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24404 invoked by alias); 12 May 2005 16:25:04 -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 24263 invoked from network); 12 May 2005 16:24:54 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 12 May 2005 16:24:54 -0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1DWGUX-0001NJ-Rg; Thu, 12 May 2005 12:24:53 -0400 Date: Thu, 12 May 2005 18:07:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com Subject: Re: [RFA] Eliminate warnings about snprintf declaration Message-ID: <20050512162453.GA5180@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01c5570e$Blat.v2.4$1c533160@zahav.net.il> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-05/txt/msg00298.txt.bz2 On Thu, May 12, 2005 at 07:16:34PM +0300, Eli Zaretskii wrote: > I guess I'm missing something obvious, since I still don't get it. > > Here's the process of getting these declarations as I understand it: > > . the configure script checks whether asprintf, basename, ffs, > etc. are declared on standard headers > > . it then edits config.in into config.h and adds the appropriate > definitions for HAVE_DECL_ASPRINTF, HAVE_DECL_BASENAME, etc. > > . include/libiberty.h then enables its own declarations for those > platforms for which HAVE_DECL_ASPRINTF etc. say there's a need for > a declaration > > Is the above correct? If so, I need to cause two changes, in addition The above is correct. > to modifying include/libiberty.h: > > 1) cause the configure script check for declarations of 2 additional > functions--snprintf and vsnprintf > > 2) add #undef's for HAVE_DECL_SNPRINTF and HAVE_DECL_VSNPRINTF which > will be edited by the configure script > > How do I make these two changes, if not by modifications to > libiberty/configure.ac followed by running Autoconf? Are you saying > that I should change gdb/configure.ac (or some other configure) > instead? That is also correct. The principle is that any project which uses libiberty, which wants these definitions, must request them. Libiberty's config.h is included by libiberty source files, before they include libiberty.h. GDB's config.h is included by GDB source fles before they include libiberty.h. So, if GDB needs the prototype, it is GDB's responsibility to request it. Basename is an unfortunate example; you can find some discussion of why on binutils@ over the last few weeks. That's because it returns a pointer, so a prototype _must_ be available in order to safely use it. This problem doesn't apply to *printf. -- Daniel Jacobowitz CodeSourcery, LLC