Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* 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

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