summaryrefslogtreecommitdiff
path: root/packaging/flex-2.5.33-yylineno.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/flex-2.5.33-yylineno.patch')
-rw-r--r--packaging/flex-2.5.33-yylineno.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/packaging/flex-2.5.33-yylineno.patch b/packaging/flex-2.5.33-yylineno.patch
new file mode 100644
index 0000000..495efeb
--- /dev/null
+++ b/packaging/flex-2.5.33-yylineno.patch
@@ -0,0 +1,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