Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Hilfinger <hilfingr@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: Remove warnings from ada-exp.tab.c compilation
Date: Wed, 06 Oct 2004 09:31:00 -0000	[thread overview]
Message-ID: <20041006093119.BA8B6F2CAA@nile.gnat.com> (raw)
In-Reply-To: <4162FA1F.2030207@gnu.org> (message from Andrew Cagney on Tue, 05 Oct 2004 15:46:39 -0400)


Now committed.

Paul Hilfinger

ChangeLog:

2004-10-06  Paul N. Hilfinger  <Hilfinger@gnat.com>

	* 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	6 Oct 2004 09:25:42 -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	6 Oct 2004 09:25:42 -0000
@@ -952,3 +952,13 @@ _initialize_ada_exp (void)
 {
   obstack_init (&temp_parse_space);
 }
+
+/* FIXME: hilfingr/2004-10-05: Hack 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	6 Oct 2004 09:25:42 -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
+};


  reply	other threads:[~2004-10-06  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05 10:37 Paul Hilfinger
2004-10-05 19:47 ` Andrew Cagney
2004-10-06  9:31   ` Paul Hilfinger [this message]
2004-10-06  9:47   ` Paul Hilfinger
2004-10-06 10:14     ` Andreas Schwab
2004-10-06 16:29     ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041006093119.BA8B6F2CAA@nile.gnat.com \
    --to=hilfingr@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox