summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDemi Obenour <demiobenour@gmail.com>2017-05-02 20:05:14 -0400
committerWill Estes <westes575@gmail.com>2017-05-03 16:16:37 -0400
commita1634aa8d3d41a257ad659788dac222739df89f5 (patch)
tree35546464bcdf7894cbf6ccc997a945546b2c9e79 /src
parentd564d454770bfdb38a1632516f83c0aab7fa3c07 (diff)
Honor user definitions of yy_* macros
The user may have defined the yy_* macros themselves. In that case, don't clobber them.
Diffstat (limited to 'src')
-rw-r--r--src/flex.skl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/flex.skl b/src/flex.skl
index e125e3a..d9854f4 100644
--- a/src/flex.skl
+++ b/src/flex.skl
@@ -112,9 +112,15 @@ m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
m4preproc_define(`M4_GEN_PREFIX',``
-[[#define yy$1 ]]M4_YY_PREFIX[[$1]]
+[[#ifdef yy$1
+#define ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED
+#else
+#define yy$1 ]]M4_YY_PREFIX[[$1
+#endif]]
'm4preproc_divert(1)`
-[[#undef yy$1]]'m4preproc_divert(0)')
+[[#ifndef ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED
+#undef yy$1
+#endif]]'m4preproc_divert(0)')
%if-c++-only
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the