public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix flex rule in gdb
@ 2022-02-01 18:43 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-02-01 18:43 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=326f526e1b87a2b18d7175c88bdebc418be06ad6

commit 326f526e1b87a2b18d7175c88bdebc418be06ad6
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Jan 25 14:57:18 2022 -0700

    Fix flex rule in gdb
    
    Currently, if flex fails, it will leave the resulting .c file in the
    tree.  This will cause a cascade of errors, and requires the manual
    deletion of the .c file in order to recreate the problem.
    
    It's better for the rule to fail such that the .c file is not updated.
    This way, 'make' will fail the same way every time -- which is much
    handier for debugging syntax errors.
    
    This fix just updates the Makefile rule to follow the way that the
    "yacc" rule already works.

Diff:
---
 gdb/Makefile.in | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 3efd2227698..bf19db45343 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2456,20 +2456,19 @@ po/$(PACKAGE).pot: force
 	  rm -f $@.tmp && \
 	  mv $@.new $@
 %.c: %.l
-	$(ECHO_LEX) $(FLEX) -t $<  \
-	    | sed -e '/extern.*malloc/d' \
-	        -e '/extern.*realloc/d' \
-	        -e '/extern.*free/d' \
-	        -e '/include.*malloc.h/d' \
-	        -e 's/\([^x]\)malloc/\1xmalloc/g' \
-	        -e 's/\([^x]\)realloc/\1xrealloc/g' \
-	        -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
-	        -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-		-e 's/yy_flex_xrealloc/yyxrealloc/g' \
-	      > $@.new && \
-	    mv $@.new $@
-
-.PRECIOUS: ada-lex.c
+	$(ECHO_LEX) $(FLEX) -t $< > $@.tmp || (rm -f $@.tmp; false)
+	@sed -e '/extern.*malloc/d' \
+	     -e '/extern.*realloc/d' \
+	     -e '/extern.*free/d' \
+	     -e '/include.*malloc.h/d' \
+	     -e 's/\([^x]\)malloc/\1xmalloc/g' \
+	     -e 's/\([^x]\)realloc/\1xrealloc/g' \
+	     -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
+	     -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
+	     -e 's/yy_flex_xrealloc/yyxrealloc/g' \
+	     < $@.tmp > $@.new && \
+	     rm -f $@.tmp && \
+	     mv $@.new $@
 
 # XML rules


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-01 18:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 18:43 [binutils-gdb] Fix flex rule in gdb Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).