* Patch: fix #line directives in bison output
@ 2010-11-19 18:10 Tom Tromey
2010-11-20 5:08 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-11-19 18:10 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch: fix #line directives in bison output
2010-11-19 18:10 Patch: fix #line directives in bison output Tom Tromey
@ 2010-11-20 5:08 ` Joel Brobecker
2010-11-22 20:26 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2010-11-20 5:08 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Hi Tom,
I'll admit being lazy this evening and not having the energy trying to
understand the incantations being used in the makefile, and why we have
to make the following targets non-.PRECIOUS. Something did catch my eye,
though:
> -.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
Did you mean the last line to be "ada-lex.c"?
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch: fix #line directives in bison output
2010-11-20 5:08 ` Joel Brobecker
@ 2010-11-22 20:26 ` Tom Tromey
2010-11-22 20:31 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-11-22 20:26 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> I'll admit being lazy this evening and not having the energy trying to
Joel> understand the incantations being used in the makefile, and why we have
Joel> to make the following targets non-.PRECIOUS.
If they are .PRECIOUS, then an interrupt means that the file will not be
removed. However, the patched rule creates the target file as the
output of $(YLWRAP). If an interrupt came just after ylwrap finished,
then an incorrect .c file would be left, breaking future builds.
Joel> Something did catch my eye, though:
>> -.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
Joel> Did you mean the last line to be "ada-lex.c"?
Yeah, oops.
I will fix it shortly.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch: fix #line directives in bison output
2010-11-22 20:26 ` Tom Tromey
@ 2010-11-22 20:31 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2010-11-22 20:31 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel> Did you mean the last line to be "ada-lex.c"?
Tom> Yeah, oops.
Tom> I will fix it shortly.
Here's the patch.
Tom
2010-11-22 Tom Tromey <tromey@redhat.com>
* Makefile.in (.PRECIOUS): Reference ada-lex.c.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1140
diff -u -r1.1140 Makefile.in
--- Makefile.in 19 Nov 2010 18:10:51 -0000 1.1140
+++ Makefile.in 22 Nov 2010 20:28:00 -0000
@@ -1653,7 +1653,7 @@
false; \
fi
-.PRECIOUS: ada-exp.c
+.PRECIOUS: ada-lex.c
# XML rules
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-22 20:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-19 18:10 Patch: fix #line directives in bison output Tom Tromey
2010-11-20 5:08 ` Joel Brobecker
2010-11-22 20:26 ` Tom Tromey
2010-11-22 20:31 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox