From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: Patch: fix #line directives in bison output
Date: Fri, 19 Nov 2010 18:10:00 -0000 [thread overview]
Message-ID: <m3eiahb2wi.fsf@fleche.redhat.com> (raw)
I am checking this in.
This is another patch we've been carrying in Fedora for quite some time.
Right now the #line directives in a .c file created from a .y file are
rewritten by ylwrap to not have any directory information. Due to how
the Makefile rule is written, the .c file also refers to the .tmp file
as well. This is not very nice for debugging; it is better to use the
real source paths.
This patch fixes these problems.
Due to how the new rule is written, I had to remove the .PHONY targets
referring to the intermediate .c files. I tested this in various ways
(including inserting sleeps and C-c'ing make) and as far as I can tell
it works just as well this way.
Tom
2010-11-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>
* Makefile.in (.y.c): Directly create $@ from YLWRAP.
(.PHONY): Remove for .y outputs.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1139
diff -u -r1.1139 Makefile.in
--- Makefile.in 5 Nov 2010 14:31:25 -0000 1.1139
+++ Makefile.in 19 Nov 2010 18:09:47 -0000
@@ -1615,8 +1615,10 @@
.SUFFIXES: .y .l
.y.c:
- $(SHELL) $(YLWRAP) $< y.tab.c $@.tmp -- $(YACC) $(YFLAGS)
- -sed -e '/extern.*malloc/d' \
+ rm -f $@ $@.tmp
+ $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
+ || (rm -f $@; false)
+ sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
-e '/extern.*free/d' \
-e '/include.*malloc.h/d' \
@@ -1625,9 +1627,9 @@
-e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
-e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-e '/^#line.*y.tab.c/d' \
- < $@.tmp > $@.new
- -rm $@.tmp
- mv $@.new ./$*.c
+ -e "s/^\(#line.*\)`basename $<`/\1`echo $<|sed 's/\//\\\\\//g'`/" \
+ < $@.tmp > $@
+ rm -f $@.tmp
.l.c:
if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
$(FLEX) -o$@ $< && \
@@ -1651,13 +1653,7 @@
false; \
fi
-.PRECIOUS: ada-exp.c ada-lex.c
-.PRECIOUS: c-exp.c
-.PRECIOUS: f-exp.c
-.PRECIOUS: jv-exp.c
-.PRECIOUS: m2-exp.c
-.PRECIOUS: objc-exp.c
-.PRECIOUS: p-exp.c
+.PRECIOUS: ada-exp.c
# XML rules
next reply other threads:[~2010-11-19 18:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 18:10 Tom Tromey [this message]
2010-11-20 5:08 ` Joel Brobecker
2010-11-22 20:26 ` Tom Tromey
2010-11-22 20:31 ` Tom Tromey
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=m3eiahb2wi.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@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