diff options
author | Demi Obenour <demiobenour@gmail.com> | 2017-05-02 19:18:14 -0400 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2017-05-03 16:16:37 -0400 |
commit | d564d454770bfdb38a1632516f83c0aab7fa3c07 (patch) | |
tree | 276771b1bcb350a6031d105c209963c867b9e89e /src | |
parent | ba530cd52fa2d69ddf7194459445a19fc9648014 (diff) |
Don't leak macro definitions into header files
This allowed unnamespaced definitions to leak into header files,
breaking client code.
Fixes #142
Diffstat (limited to 'src')
-rw-r--r-- | src/flex.skl | 8 | ||||
-rw-r--r-- | src/main.c | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/flex.skl b/src/flex.skl index 6f2a00b..e125e3a 100644 --- a/src/flex.skl +++ b/src/flex.skl @@ -111,9 +111,10 @@ 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]] -%# m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') +m4preproc_define(`M4_GEN_PREFIX',`` +[[#define yy$1 ]]M4_YY_PREFIX[[$1]] +'m4preproc_divert(1)` +[[#undef yy$1]]'m4preproc_divert(0)') %if-c++-only /* The c++ scanner is a mess. The FlexLexer.h header file relies on the @@ -3415,4 +3416,5 @@ m4_ifdef( [[M4_YY_IN_HEADER]], #undef YY_DECL_IS_OURS #undef YY_DECL #endif +m4preproc_undivert(1) ]]) @@ -310,8 +310,8 @@ void check_options (void) } } - if (extra_type) - buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type); + if (extra_type) + buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type); if (!use_stdout) { FILE *prev_stdout; |