public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix flex rule in gdb
Date: Tue,  1 Feb 2022 18:43:13 +0000 (GMT)	[thread overview]
Message-ID: <20220201184313.19382385BF81@sourceware.org> (raw)

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


                 reply	other threads:[~2022-02-01 18:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220201184313.19382385BF81@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).