]> granicus.if.org Git - flex/commitdiff
Honor user definitions of yy_* macros
authorDemi Obenour <demiobenour@gmail.com>
Wed, 3 May 2017 00:05:14 +0000 (20:05 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 3 May 2017 20:16:37 +0000 (16:16 -0400)
The user may have defined the yy_* macros themselves.  In that case,
don't clobber them.

src/flex.skl

index e125e3aa563cb6134fbbd56053092a116e3ac1aa..d9854f44a75e46f72d6308323a1f8752111842cd 100644 (file)
@@ -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