mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
Improve forward-compatibility with GNU M4.
Reported by Eric Blake at <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>. * bootstrap.conf (gnulib_modules): Add unsetenv. * lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add. * m4/.gitignore, m4/.cvsignore (/environ.m4): Add. (/setenv.m4): Add. * src/output.c (output_skeleton): For the m4 invocation, pass -dV as the first argument because it may become position-dependent, and unset POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions. Add comments explaining these issues in more detail.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2008-07-15 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
Improve forward-compatibility with GNU M4. Reported by Eric Blake at
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>.
|
||||||
|
* bootstrap.conf (gnulib_modules): Add unsetenv.
|
||||||
|
* lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add.
|
||||||
|
* m4/.gitignore, m4/.cvsignore (/environ.m4): Add.
|
||||||
|
(/setenv.m4): Add.
|
||||||
|
* src/output.c (output_skeleton): For the m4 invocation, pass -dV as
|
||||||
|
the first argument because it may become position-dependent, and unset
|
||||||
|
POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions.
|
||||||
|
Add comments explaining these issues in more detail.
|
||||||
|
|
||||||
2008-07-14 Joel E. Denny <jdenny@ces.clemson.edu>
|
2008-07-14 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
Add .gitignore everywhere based on .cvsignore.
|
Add .gitignore everywhere based on .cvsignore.
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ gnulib_modules='
|
|||||||
dirname error extensions fopen-safer git-version-gen
|
dirname error extensions fopen-safer git-version-gen
|
||||||
getopt gettext hash inttypes javacomp-script javaexec-script malloc
|
getopt gettext hash inttypes javacomp-script javaexec-script malloc
|
||||||
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
||||||
strverscmp unistd unistd-safer unlocked-io verify xalloc xalloc-die
|
strverscmp unistd unistd-safer unlocked-io unsetenv verify xalloc
|
||||||
xstrndup
|
xalloc-die xstrndup
|
||||||
'
|
'
|
||||||
|
|
||||||
# Any gnulib files needed that are not in modules.
|
# Any gnulib files needed that are not in modules.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
||||||
.TH BISON "1" "May 2008" "bison 2.3b+" "User Commands"
|
.TH BISON "1" "July 2008" "bison 2.3b+" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
bison \- GNU Project parser generator (yacc replacement)
|
bison \- GNU Project parser generator (yacc replacement)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -174,6 +174,8 @@ disable the report
|
|||||||
Written by Robert Corbett and Richard Stallman.
|
Written by Robert Corbett and Richard Stallman.
|
||||||
.SH "REPORTING BUGS"
|
.SH "REPORTING BUGS"
|
||||||
Report bugs to <bug\-bison@gnu.org>.
|
Report bugs to <bug\-bison@gnu.org>.
|
||||||
|
.PP
|
||||||
|
Id
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2008 Free Software Foundation, Inc.
|
Copyright \(co 2008 Free Software Foundation, Inc.
|
||||||
.br
|
.br
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ unitypes.h
|
|||||||
uniwidth
|
uniwidth
|
||||||
uniwidth.h
|
uniwidth.h
|
||||||
unlocked-io.h
|
unlocked-io.h
|
||||||
|
unsetenv.c
|
||||||
verify.h
|
verify.h
|
||||||
wchar.h
|
wchar.h
|
||||||
wchar.in.h
|
wchar.in.h
|
||||||
|
|||||||
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@@ -89,6 +89,7 @@
|
|||||||
/uniwidth
|
/uniwidth
|
||||||
/uniwidth.h
|
/uniwidth.h
|
||||||
/unlocked-io.h
|
/unlocked-io.h
|
||||||
|
/unsetenv.c
|
||||||
/verify.h
|
/verify.h
|
||||||
/wchar.h
|
/wchar.h
|
||||||
/wchar.in.h
|
/wchar.in.h
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ config-h.m4
|
|||||||
dirname.m4
|
dirname.m4
|
||||||
dos.m4
|
dos.m4
|
||||||
double-slash-root.m4
|
double-slash-root.m4
|
||||||
|
environ.m4
|
||||||
error.m4
|
error.m4
|
||||||
exitfail.m4
|
exitfail.m4
|
||||||
extensions.m4
|
extensions.m4
|
||||||
@@ -37,6 +38,7 @@ po.m4
|
|||||||
progtest.m4
|
progtest.m4
|
||||||
quote.m4
|
quote.m4
|
||||||
quotearg.m4
|
quotearg.m4
|
||||||
|
setenv.m4
|
||||||
stdbool.m4
|
stdbool.m4
|
||||||
stdint.m4
|
stdint.m4
|
||||||
stdint_h.m4
|
stdint_h.m4
|
||||||
|
|||||||
2
m4/.gitignore
vendored
2
m4/.gitignore
vendored
@@ -4,6 +4,7 @@
|
|||||||
/dirname.m4
|
/dirname.m4
|
||||||
/dos.m4
|
/dos.m4
|
||||||
/double-slash-root.m4
|
/double-slash-root.m4
|
||||||
|
/environ.m4
|
||||||
/error.m4
|
/error.m4
|
||||||
/exitfail.m4
|
/exitfail.m4
|
||||||
/extensions.m4
|
/extensions.m4
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
/progtest.m4
|
/progtest.m4
|
||||||
/quote.m4
|
/quote.m4
|
||||||
/quotearg.m4
|
/quotearg.m4
|
||||||
|
/setenv.m4
|
||||||
/stdbool.m4
|
/stdbool.m4
|
||||||
/stdint.m4
|
/stdint.m4
|
||||||
/stdint_h.m4
|
/stdint_h.m4
|
||||||
|
|||||||
56
src/output.c
56
src/output.c
@@ -476,10 +476,7 @@ output_skeleton (void)
|
|||||||
char const *argv[7];
|
char const *argv[7];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
/* Compute the names of the package data dir and skeleton file.
|
/* Compute the names of the package data dir and skeleton files. */
|
||||||
Test whether m4sugar.m4 is readable, to check for proper
|
|
||||||
installation. A faulty installation can cause deadlock, so a
|
|
||||||
cheap sanity check is worthwhile. */
|
|
||||||
char const m4sugar[] = "m4sugar/m4sugar.m4";
|
char const m4sugar[] = "m4sugar/m4sugar.m4";
|
||||||
char const m4bison[] = "bison.m4";
|
char const m4bison[] = "bison.m4";
|
||||||
char *full_m4sugar;
|
char *full_m4sugar;
|
||||||
@@ -505,26 +502,59 @@ output_skeleton (void)
|
|||||||
strcpy (full_skeleton, skeleton);
|
strcpy (full_skeleton, skeleton);
|
||||||
else
|
else
|
||||||
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
|
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
|
||||||
|
|
||||||
|
/* Test whether m4sugar.m4 is readable, to check for proper
|
||||||
|
installation. A faulty installation can cause deadlock, so a
|
||||||
|
cheap sanity check is worthwhile. */
|
||||||
xfclose (xfopen (full_m4sugar, "r"));
|
xfclose (xfopen (full_m4sugar, "r"));
|
||||||
|
|
||||||
/* Create an m4 subprocess connected to us via two pipes. */
|
/* Create an m4 subprocess connected to us via two pipes. */
|
||||||
|
|
||||||
if (trace_flag & trace_tools)
|
if (trace_flag & trace_tools)
|
||||||
fprintf (stderr, "running: %s %s - %s %s\n",
|
fprintf (stderr, "running: %s %s - %s %s\n",
|
||||||
m4, full_m4sugar, full_m4bison, full_skeleton);
|
m4, full_m4sugar, full_m4bison, full_skeleton);
|
||||||
|
|
||||||
argv[0] = m4;
|
/* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a
|
||||||
argv[1] = full_m4sugar;
|
position-dependent manner. Keep it as the first argument so that all
|
||||||
argv[2] = "-";
|
files are traced.
|
||||||
argv[3] = full_m4bison;
|
|
||||||
argv[4] = full_skeleton;
|
|
||||||
argv[5] = trace_flag & trace_m4 ? "-dV" : NULL;
|
|
||||||
argv[6] = NULL;
|
|
||||||
|
|
||||||
|
See the thread starting at
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
|
||||||
|
for details. */
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
argv[i++] = m4;
|
||||||
|
if (trace_flag & trace_m4)
|
||||||
|
argv[i++] = "-dV";
|
||||||
|
argv[i++] = full_m4sugar;
|
||||||
|
argv[i++] = "-";
|
||||||
|
argv[i++] = full_m4bison;
|
||||||
|
argv[i++] = full_skeleton;
|
||||||
|
argv[i++] = NULL;
|
||||||
|
}
|
||||||
|
/* When POSIXLY_CORRECT is set, some future versions of GNU M4 (most likely
|
||||||
|
2.0) may drop some of the GNU extensions that Bison's skeletons depend
|
||||||
|
upon. So that the next release of Bison is forward compatible with those
|
||||||
|
future versions of GNU M4, we unset POSIXLY_CORRECT here.
|
||||||
|
|
||||||
|
FIXME: A user might set POSIXLY_CORRECT to affect processes run from
|
||||||
|
macros like m4_syscmd in a custom skeleton. For now, Bison makes no
|
||||||
|
promises about the behavior of custom skeletons, so this scenario is not a
|
||||||
|
concern. However, we eventually want to eliminate this shortcoming. The
|
||||||
|
next release of GNU M4 (1.4.12 or 1.6) will accept the -g command-line
|
||||||
|
option as a no-op, and later releases will accept it to indicate that
|
||||||
|
POSIXLY_CORRECT should be ignored. Once the GNU M4 versions that accept
|
||||||
|
-g are pervasive, Bison should use -g instead of unsetting
|
||||||
|
POSIXLY_CORRECT.
|
||||||
|
|
||||||
|
See the thread starting at
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
|
||||||
|
for details. */
|
||||||
|
unsetenv ("POSIXLY_CORRECT");
|
||||||
init_subpipe ();
|
init_subpipe ();
|
||||||
pid = create_subpipe (argv, filter_fd);
|
pid = create_subpipe (argv, filter_fd);
|
||||||
free (full_m4bison);
|
|
||||||
free (full_m4sugar);
|
free (full_m4sugar);
|
||||||
|
free (full_m4bison);
|
||||||
free (full_skeleton);
|
free (full_skeleton);
|
||||||
|
|
||||||
out = fdopen (filter_fd[0], "w");
|
out = fdopen (filter_fd[0], "w");
|
||||||
|
|||||||
Reference in New Issue
Block a user