From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16458 invoked by alias); 5 Oct 2004 10:37:31 -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 16434 invoked from network); 5 Oct 2004 10:37:28 -0000 Received: from unknown (HELO nile.gnat.com) (205.232.38.5) by sourceware.org with SMTP; 5 Oct 2004 10:37:28 -0000 Received: from localhost (localhost [127.0.0.1]) by nile.gnat.com (Postfix) with ESMTP id 1BB52F2BA6 for ; Tue, 5 Oct 2004 06:37:28 -0400 (EDT) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03544-01 for ; Tue, 5 Oct 2004 06:37:27 -0400 (EDT) Received: by nile.gnat.com (Postfix, from userid 1345) id 938AEF2BD3; Tue, 5 Oct 2004 06:37:27 -0400 (EDT) From: Paul Hilfinger To: gdb-patches@sources.redhat.com Subject: [RFA]: Remove warnings from ada-exp.tab.c compilation Message-Id: <20041005103727.938AEF2BD3@nile.gnat.com> Date: Tue, 05 Oct 2004 10:37:00 -0000 X-Virus-Scanned: by amavisd-new at nile.gnat.com X-SW-Source: 2004-10/txt/msg00079.txt.bz2 I propose to commit the following tonight if there is no objection, but post it here first because it involves a change to Makefile.in (granted, to a part of Makefile.in only Ada uses at the moment). The patch is more involved than I anticipated in order to deal with the several different versions of Flex that are still at large; it also fixes some misprints in the .l.c rule. Paul Hilfinger 2004-10-05 Paul N. Hilfinger * Makefile.in (.l.c): Do conversions of names of alloc and free functions that are done for .y.c files, plus special one for yy_flex_realloc. Also, correct missing-file tests here. * ada-lex.l (malloc, free): Remove macros. (resize_tempbuf): Use "realloc"; rely on sed changes to convert to xrealloc. (ada_flex_use): Dummy definition to remove warnings about unused functions. * ada-exp.y (dummy_string_to_ada_operator): Temporary definition to suppress warning. Index: gdb/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.637 diff -u -p -r1.637 Makefile.in --- gdb/Makefile.in 3 Oct 2004 08:35:57 -0000 1.637 +++ gdb/Makefile.in 5 Oct 2004 10:26:07 -0000 @@ -1582,14 +1582,24 @@ po/$(PACKAGE).pot: force -rm $@.tmp mv $@.new ./$*.c .l.c: - @if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \ - echo $(FLEX) -o$@ $<; \ - $(FLEX) -o$@ $<; \ - elif [ ! -f $@ -a ! -f $< ]; then \ - echo "$< missing and flex not available."; \ - false; \ - elif [ ! -f $@ ]; then \ + if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \ + $(FLEX) -o$@ $< && \ + rm -f $@.new && \ + sed -e '/extern.*malloc/d' \ + -e '/extern.*realloc/d' \ + -e '/extern.*free/d' \ + -e '/include.*malloc.h/d' \ + -e 's/malloc/xmalloc/g' \ + -e 's/realloc/xrealloc/g' \ + -e 's/yy_flex_xrealloc/yyxrealloc/g' \ + < $@ > $@.new && \ + rm -f $@ && \ + mv $@.new $@; \ + elif [ -f $@ ]; then \ echo "Warning: $*.c older than $*.l and flex not available."; \ + else \ + echo "$@ missing and flex not available."; \ + false; \ fi .PRECIOUS: ada-exp.c ada-lex.c Index: gdb/ada-exp.y =================================================================== RCS file: /cvs/src/src/gdb/ada-exp.y,v retrieving revision 1.12 diff -u -p -r1.12 ada-exp.y --- gdb/ada-exp.y 18 Sep 2004 22:23:23 -0000 1.12 +++ gdb/ada-exp.y 5 Oct 2004 10:26:07 -0000 @@ -952,3 +952,13 @@ _initialize_ada_exp (void) { obstack_init (&temp_parse_space); } + +/* FIXME: Temporary measure to remove warning. The function + string_to_operator is supposed to be used for cases where one + calls an operator function with prefix notation, as in + "+" (a, b), but at some point, this code seems to have gone + missing. */ + +struct stoken (*dummy_string_to_ada_operator) (struct stoken) + = string_to_operator; + Index: gdb/ada-lex.l =================================================================== RCS file: /cvs/src/src/gdb/ada-lex.l,v retrieving revision 1.8 diff -u -p -r1.8 ada-lex.l --- gdb/ada-lex.l 3 Oct 2004 08:35:56 -0000 1.8 +++ gdb/ada-lex.l 5 Oct 2004 10:26:07 -0000 @@ -42,8 +42,6 @@ EXP (e[+-]{NUM10}) POSEXP (e"+"?{NUM10}) %{ -#define malloc xmalloc -#define free xfree #define NUMERAL_WIDTH 256 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1)) @@ -349,7 +347,7 @@ resize_tempbuf (unsigned int n) if (tempbufsize < n) { tempbufsize = (n+63) & ~63; - tempbuf = (char *) xrealloc (tempbuf, tempbufsize); + tempbuf = (char *) realloc (tempbuf, tempbufsize); } } @@ -923,3 +921,10 @@ yywrap(void) { return 1; } + +/* Dummy definition to suppress warnings about unused static definitions. */ +typedef void (*dummy_function) (); +dummy_function ada_flex_use[] = +{ + (dummy_function) yyrealloc, (dummy_function) yyunput +};