[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: Filenames in Lex and Yacc outputs
From: |
Akim Demaille |
Subject: |
FYI: Filenames in Lex and Yacc outputs |
Date: |
01 Nov 2001 18:11:45 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/am/lex.am, lib/am/yacc.am: Use the output file name in
`#line' and multiple inclusion guards.
* lib/ylwrap: Remove debugging code.
(input_dir, input_rx): Move where used.
Use the output file name in `#line'.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.155
diff -u -u -r1.155 NEWS
--- NEWS 2001/10/20 11:14:36 1.155
+++ NEWS 2001/11/01 17:26:13
@@ -7,6 +7,8 @@
* AM_FUNC_ERROR_AT_LINE, AM_FUNC_STRTOD, AM_FUNC_OBSTACK, AM_PTRDIFF_T
are no longer shipped, since Autoconf 2.52 provides them (both as AM_
and AC_).
+* `#line' of Lex and Yacc files are properly set.
+* Fixed CDPATH portability problems, in particular for MacOS X.
New in 1.5:
* Support for `configure.ac'.
Index: lib/ylwrap
===================================================================
RCS file: /cvs/automake/automake/lib/ylwrap,v
retrieving revision 1.19
diff -u -u -r1.19 ylwrap
--- lib/ylwrap 2001/07/17 06:00:37 1.19
+++ lib/ylwrap 2001/11/01 17:26:13
@@ -1,6 +1,6 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
-# Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
# Written by Tom Tromey <address@hidden>.
#
# This program is free software; you can redistribute it and/or modify
@@ -44,14 +44,6 @@
;;
esac
-# The directory holding the input.
-input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
-# Quote $INPUT_DIR so we can use it in a regexp.
-# FIXME: really we should care about more than `.' and `\'.
-input_rx=`echo "$input_dir" | sed -e 's,\\\\,\\\\\\\\,g' -e 's,\\.,\\\\.,g'`
-
-echo "got $input_rx"
-
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
@@ -94,6 +86,12 @@
y_tab_nodot="yes"
fi
+ # The directory holding the input.
+ input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
+ # Quote $INPUT_DIR so we can use it in a regexp.
+ # FIXME: really we should care about more than `.' and `\'.
+ input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
+
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
@@ -114,11 +112,24 @@
*) target="../$2";;
esac
- # Edit out `#line' or `#' directives. We don't want the
- # resulting debug information to point at an absolute srcdir;
- # it is better for it to just mention the .y file with no
- # path.
- sed -e "/^#/ s,$input_rx,," "$from" > "$target" || status=$?
+ # Edit out `#line' or `#' directives.
+ #
+ # We don't want the resulting debug information to point at
+ # an absolute srcdir; it is better for it to just mention the
+ # .y file with no path.
+ #
+ # We want to use the real output file name, not yy.lex.c for
+ # instance.
+ #
+ # We want the include guards to be adjusted too.
+ FROM=`echo "$from" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+ TARGET=`echo "$2" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+ sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FORM,$TO,;}" "$from"
>"$target" ||
+ status=$?
else
# A missing file is only an error for the first file. This
# is a blatant hack to let us support using "yacc -d". If -d
Index: lib/am/lex.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lex.am,v
retrieving revision 1.3
diff -u -u -r1.3 lex.am
--- lib/am/lex.am 2001/06/24 03:38:26 1.3
+++ lib/am/lex.am 2001/11/01 17:26:13
@@ -16,6 +16,8 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+## FIXME: These two are to be removed once we trace Autoconf, since
+## they are AC_SUBST'ed.
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEXLIB = @LEXLIB@
@@ -24,5 +26,8 @@
if %?MORE-THAN-ONE%
$(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE% && mv $(LEX_OUTPUT_ROOT).c %OBJ%
+ %COMPILE% %SOURCE%
+## Edit out `#line' or `#' directives.
+ sed '/^#/ s/$(LEX_OUTPUT_ROOT)\.c/%OBJ%/' $(LEX_OUTPUT_ROOT).c >%OBJ%
+ rm $(LEX_OUTPUT_ROOT).c
endif !%?MORE-THAN-ONE%
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.6
diff -u -u -r1.6 yacc.am
--- lib/am/yacc.am 2001/08/23 05:00:33 1.6
+++ lib/am/yacc.am 2001/11/01 17:26:13
@@ -21,12 +21,22 @@
if %?MORE-THAN-ONE%
$(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h -- %COMPILE%
else !%?MORE-THAN-ONE%
- %COMPILE% %SOURCE% && mv y.tab.c %OBJ%
+ %COMPILE% %SOURCE%
+## Edit out `#line' or `#' directives.
+ sed '/^#/ s/y\.tab\.c/%OBJ%/' y.tab.c >%OBJ%
+ rm y.tab.c
+## Edit out Bison multiple inclusion guards. It may be BISON_Y_TAB_H,
+## or Y_TAB_H depending upon the version, that's why the regexp is
+## so loose.
if test -f y.tab.h; then \
- if cmp -s y.tab.h %BASE%.h; then \
- rm -f y.tab.h; \
+ to=`echo "%BASE%_H" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
+ sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >%BASE%.ht; \
+ if cmp -s %BASE%.ht %BASE%.h; then \
+ rm %BASE%.ht ;\
else \
- mv y.tab.h %BASE%.h; \
+ mv %BASE%.ht %BASE%.h; \
fi; \
fi
endif !%?MORE-THAN-ONE%
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: Filenames in Lex and Yacc outputs,
Akim Demaille <=