don't #define yywrap yywrap (that is if the prefix is yy, don't #define macros

for the same name). Breaks compatibility for things like:
#ifndef yywrap
int
yywrap(void)
{
	return 1;
}
#endif
This commit is contained in:
christos 2017-01-03 00:22:56 +00:00
parent 6d0346a9a0
commit 2e20bf3056
2 changed files with 8 additions and 3 deletions

View File

@ -120,6 +120,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
%endif
%if-c-only
m4_ifelse(M4_YY_PREFIX,yy,,
M4_GEN_PREFIX(`_create_buffer')
M4_GEN_PREFIX(`_delete_buffer')
M4_GEN_PREFIX(`_scan_buffer')
@ -155,6 +156,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
M4_GEN_PREFIX(`set_column')
]])
M4_GEN_PREFIX(`wrap')
)
%endif
m4_ifdef( [[M4_YY_BISON_LVAL]],
@ -170,11 +172,14 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
]])
m4_ifelse(M4_YY_PREFIX,yy,,
M4_GEN_PREFIX(`alloc')
M4_GEN_PREFIX(`realloc')
M4_GEN_PREFIX(`free')
)
%if-c-only
m4_ifelse(M4_YY_PREFIX,yy,,
m4_ifdef( [[M4_YY_NOT_REENTRANT]],
[[
M4_GEN_PREFIX(`text')
@ -184,6 +189,7 @@ m4_ifdef( [[M4_YY_NOT_REENTRANT]],
M4_GEN_PREFIX(`_flex_debug')
M4_GEN_PREFIX(`lineno')
]])
)
%endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.4 2017/01/02 19:24:39 christos Exp $ */
/* $NetBSD: main.c,v 1.5 2017/01/03 00:22:56 christos Exp $ */
/* flex - tool to generate fast lexical analyzers */
@ -33,7 +33,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: main.c,v 1.4 2017/01/02 19:24:39 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.5 2017/01/03 00:22:56 christos Exp $");
#include "version.h"
@ -1589,7 +1589,6 @@ void readin (void)
if (!do_yywrap) {
if (!C_plus_plus) {
outn ("\n#undef yywrap");
if (reentrant)
outn ("\n#define yywrap(yyscanner) (/*CONSTCOND*/1)");
else