mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
escape properly the file names in #line for printer/destructor
Reported by Jannick. http://lists.gnu.org/archive/html/bug-bison/2017-05/msg00001.html "Amusingly" enough, we have the same problem with %defines when the parser file name has backslashes or quotes: we generate #includes with an incorrect C string. * src/output.c (prepare_symbol_definitions): Escape properly the file names before passing them to M4. * data/bison.m4, data/lalr1.cc: Don't simply put the file name between two quotes (that should have been strong enough a smell...), expect the string to be properly quoted. * tests/synclines.at: New tests to check this.
This commit is contained in:
@@ -444,7 +444,7 @@ m4_define([b4_symbol_action],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[(*yylocationp)])dnl
|
||||
b4_symbol_case_([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;
|
||||
|
||||
@@ -107,7 +107,7 @@ b4_dollar_pushdef([yysym.value],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[yysym.location])dnl
|
||||
b4_symbol_case_([$1])
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user