1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
--- main.c
+++ main.c
@@ -1633,9 +1633,11 @@
if (!C_plus_plus && !reentrant) {
outn ("extern int yylineno;");
- OUT_BEGIN_CODE ();
- outn ("int yylineno = 1;");
- OUT_END_CODE ();
+ if (do_yylineno) {
+ OUT_BEGIN_CODE ();
+ outn ("int yylineno = 1;");
+ OUT_END_CODE ();
+ }
}
if (C_plus_plus) {
--- flex.skl
+++ flex.skl
@@ -80,6 +80,16 @@
m4preproc_define(`M4_GEN_PREFIX',
``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+%# don't use yylineno in non-reentrant scanners when %option yylineno not given
+m4_ifdef( [[M4_YY_REENTRANT]],,
+ [[m4_ifdef( [[M4_YY_USE_LINENO]],,
+ [[
+ m4_define( [[M4_YY_NO_GET_LINENO]], [[]])
+ m4_define( [[M4_YY_NO_SET_LINENO]], [[]])
+ ]])
+ ]]
+)
+
%if-c++-only
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
* following macro. This is required in order to pass the c++-multiple-scanners
|