mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 23:33:03 +00:00
m4: use a safer pattern to enable/disable output
Work on some other areas of Bison revealed that some macros expanded to be expanded only once were actually expanded several times. This was due to the fact that changecom was not properly restored each time, and macro names appearing in comments were then expanded. Introduce begin/end macros which are easier to match that changecom()/changecom(#). * data/bison.m4 (b4_output_begin, b4_output_end): New. * data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java, * data/location.cc, data/stack.hh, data/yacc.c: Use them.
This commit is contained in:
21
data/glr.c
21
data/glr.c
@@ -179,13 +179,10 @@ m4_define([b4_shared_declarations],
|
||||
## Output files. ##
|
||||
## -------------- ##
|
||||
|
||||
# We do want M4 expansion after # for CPP macros.
|
||||
m4_changecom()
|
||||
m4_divert_push(0)dnl
|
||||
@output(b4_parser_file_name@)@
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||
[2002-2012])
|
||||
[
|
||||
[2002-2012])[
|
||||
|
||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||
|
||||
]b4_identification
|
||||
@@ -2571,17 +2568,17 @@ yypdumpstack (yyGLRStack* yystackp)
|
||||
}
|
||||
#endif
|
||||
]b4_epilogue[]dnl
|
||||
dnl
|
||||
dnl glr.cc produces its own header.
|
||||
dnl
|
||||
b4_output_end()
|
||||
|
||||
# glr.cc produces its own header.
|
||||
m4_if(b4_skeleton, ["glr.c"],
|
||||
[b4_defines_if(
|
||||
[@output(b4_spec_defines_file@)@
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
[2002-2012])[
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||
]])])dnl
|
||||
m4_divert_pop(0)
|
||||
]b4_output_end()
|
||||
])])
|
||||
|
||||
Reference in New Issue
Block a user