summaryrefslogtreecommitdiff
path: root/src/flex-scanner.h
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-11-07 09:27:52 +0100
committerAkim Demaille <akim.demaille@gmail.com>2021-11-07 09:52:05 +0100
commit6571c2d1b134bd04d81f1426c08985407e8c7087 (patch)
treefe0328628246b1db6b2a661c6738a1940a5bfac1 /src/flex-scanner.h
parentc95d0dd5f54b98825e4cfe00a807db78a073e376 (diff)
downloadbison-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 'src/flex-scanner.h')
-rw-r--r--src/flex-scanner.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/flex-scanner.h b/src/flex-scanner.h
index 238ca881..08c0e62c 100644
--- a/src/flex-scanner.h
+++ b/src/flex-scanner.h
@@ -106,6 +106,9 @@ static struct obstack obstack_for_string;
# define STRING_GROW() \
obstack_grow (&obstack_for_string, yytext, yyleng)
+# define STRING_SGROW(String) \
+ obstack_sgrow (&obstack_for_string, String)
+
# define STRING_FINISH() \
(last_string = obstack_finish0 (&obstack_for_string))