diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2021-11-07 09:27:52 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2021-11-07 09:52:05 +0100 |
commit | 6571c2d1b134bd04d81f1426c08985407e8c7087 (patch) | |
tree | fe0328628246b1db6b2a661c6738a1940a5bfac1 /tests | |
parent | c95d0dd5f54b98825e4cfe00a807db78a073e376 (diff) | |
download | bison-6571c2d1b134bd04d81f1426c08985407e8c7087.tar.gz |
warnings: don't complain about m4_foo and b4_foo when from the user
Currently, occurrences of these identifiers in the user's input yield
spurious warnings.
To tell the difference between a legitimate m4_foo from the user, and
a bad m4_foo coming from a non-evaluated macro of a skeleton, escape
the user's identifiers as m4@'_foo. We already use @' as a special
sequence to be stripped from the skeleton's output.
See <https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html> and
previous commit ("warnings: be less picky about occurrences of m4_/b4_
in the output").
* src/flex-scanner.h (OBSTACK_SGROW): New.
* src/output.c (output_escaped): Escape m4_ and b4_.
* src/scan-code.l: Likewise.
* src/system.h (obstack_escape): Likewise.
And rewrite as a function.
* tests/skeletons.at (Suspicious sequences): Make sure the user can
use m4_foo/b4_foo without spurious warnings.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/skeletons.at | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/skeletons.at b/tests/skeletons.at index 30f25a61..8cd87f96 100644 --- a/tests/skeletons.at +++ b/tests/skeletons.at @@ -332,14 +332,18 @@ AT_CLEANUP AT_SETUP([[Suspicious sequences]]) +# <https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html>. + +# We must escape m4_foo as m4@&t@_foo to avoid Autotest's protection +# against its own suspicious sequences. AT_DATA([[skel.c]], [[m4@&t@_include(b4_skeletonsdir/[c.m4]) m4@&t@_divert_push(0)d@&t@nl @output(b4_parser_file_name@)d@&t@nl ]b4_user_pre_prologue[ ]b4_user_post_prologue[ -b4_unevaluated -m4@&t@_unevaluated +b4_poison +m4@&t@_poison ]b4_epilogue[ m4@&t@_divert_pop(0) @@ -348,19 +352,21 @@ m4@&t@_divert_pop(0) AT_DATA([[input1.y]], [[%skeleton "./skel.c" %{ - myb4_unevaluated - mym4_unevaluated + myb4_user + mym4_user + b4_user + m4@&t@_user %} %% -start: ; +b4_user: "b4_user"; %% -myb4_unevaluated -mym4_unevaluated +b4_user +m4@&t@_user ]]) AT_BISON_CHECK([[input1.y]], [], [], -[[input1.tab.c:10: warning: suspicious sequence in the output: b4_unevaluated [-Wother] -input1.tab.c:11: warning: suspicious sequence in the output: m4@&t@_unevaluated [-Wother] +[[input1.tab.c:12: warning: suspicious sequence in the output: b4_poison [-Wother] +input1.tab.c:13: warning: suspicious sequence in the output: m4@&t@_poison [-Wother] ]]) |