summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-04 18:18:16 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-04 18:18:16 -0800
commitb8577c30fcc6e962e341f5ab3402197cd9bb1124 (patch)
tree8763ee3a7cbbb0e614b4a807931bebe8a164c395 /main.c
parentc29d6e204b4dfe99a2f08c258652823e4c26c324 (diff)
downloadflex-b8577c30fcc6e962e341f5ab3402197cd9bb1124.tar.gz
flex-b8577c30fcc6e962e341f5ab3402197cd9bb1124.tar.bz2
flex-b8577c30fcc6e962e341f5ab3402197cd9bb1124.zip
Imported Upstream version 2.5.37upstream/2.5.37
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/main.c b/main.c
index cec2d77..31833c4 100644
--- a/main.c
+++ b/main.c
@@ -57,7 +57,7 @@ int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap,
int reentrant, bison_bridge_lval, bison_bridge_lloc;
int yymore_used, reject, real_reject, continued_action, in_rule;
int yymore_really_used, reject_really_used;
-int datapos, dataline, linenum, out_linenum;
+int datapos, dataline, linenum;
FILE *skelfile = NULL;
int skel_ind = 0;
char *action_array;
@@ -455,6 +455,8 @@ void check_options ()
size_t strsz;
str = (char*)flex_alloc(strsz = strlen(fmt) + strlen(scname[i]) + (int)(1 + log10(i)) + 2);
+ if (!str)
+ flexfatal(_("allocation of macro definition failed"));
snprintf(str, strsz, fmt, scname[i], i - 1);
buf_strappend(&tmpbuf, str);
free(str);
@@ -1441,7 +1443,7 @@ void flexinit (argc, argv)
num_backing_up = onesp = numprots = 0;
variable_trailing_context_rules = bol_needed = false;
- out_linenum = linenum = sectnum = 1;
+ linenum = sectnum = 1;
firstprot = NIL;
/* Used in mkprot() so that the first proto goes in slot 1
@@ -1576,9 +1578,11 @@ void readin ()
}
if (!do_yywrap) {
- if (!C_plus_plus) {
- outn ("\n#define yywrap(n) 1");
- }
+ if (!C_plus_plus)
+ if (reentrant)
+ outn ("\n#define yywrap(yyscanner) 1");
+ else
+ outn ("\n#define yywrap() 1");
outn ("#define YY_SKIP_YYWRAP");
}