From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2970 invoked by alias); 19 Nov 2010 18:10:32 -0000 Received: (qmail 2823 invoked by uid 22791); 19 Nov 2010 18:10:30 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Nov 2010 18:10:25 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAJIANNZ010581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Nov 2010 13:10:23 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAJIANd8021027; Fri, 19 Nov 2010 13:10:23 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oAJIAMrG021831; Fri, 19 Nov 2010 13:10:22 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 0E15A3784F6; Fri, 19 Nov 2010 11:10:21 -0700 (MST) From: Tom Tromey To: gdb-patches@sourceware.org Subject: Patch: fix #line directives in bison output Date: Fri, 19 Nov 2010 18:10:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00265.txt.bz2 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 Tom Tromey * 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