Index: doc/Makefile.in
--- doc/Makefile.in.orig	2015-11-17 17:19:45.000000000 +0100
+++ doc/Makefile.in	2016-03-20 20:44:10.392958897 +0100
@@ -156,7 +156,7 @@
 PSS = flex.ps
 HTMLS = flex.html
 TEXINFOS = flex.texi
-TEXI2DVI = texi2dvi
+TEXI2DVI = true
 TEXI2PDF = $(TEXI2DVI) --pdf --batch
 MAKEINFOHTML = $(MAKEINFO) --html
 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
@@ -239,7 +239,7 @@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
 GREP = @GREP@
-HELP2MAN = @HELP2MAN@
+HELP2MAN = true
 INDENT = @INDENT@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
Index: doc/flex.texi
--- doc/flex.texi.orig	2015-11-11 00:42:27.000000000 +0100
+++ doc/flex.texi	2016-03-20 20:44:10.392958897 +0100
@@ -3890,6 +3890,7 @@
 @example
 @verbatim
      // An example of using the flex C++ scanner class.
+    %option noyywrap
 
     %{
     #include <iostream>
@@ -3932,13 +3933,13 @@
                 }
             }
 
-    {number}  cout << "number " << YYText() << '\n';
+    {number}  std::cout << "number " << YYText() << '\n';
 
     \n        mylineno++;
 
-    {name}    cout << "name " << YYText() << '\n';
+    {name}    std::cout << "name " << YYText() << '\n';
 
-    {string}  cout << "string " << YYText() << '\n';
+    {string}  std::cout << "string " << YYText() << '\n';
 
     %%
 
Index: src/flex.skl
--- src/flex.skl.orig	2015-11-11 00:28:54.000000000 +0100
+++ src/flex.skl	2016-03-20 20:44:10.392958897 +0100
@@ -982,6 +982,18 @@
 int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
 ]])
 
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
+[[
+int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
+[[
+void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
+]])
+]])
+
 m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
 [[
 void yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
@@ -2350,7 +2362,7 @@
 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 		 * immediate realloc on the next call.
          */
-		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
+		num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
 		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								M4_YY_CALL_LAST_ARG);
@@ -3017,8 +3029,10 @@
 m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
 [[
     /* Destroy the start condition stack. */
+    if (YY_G(yy_start_stack) != NULL) {
         yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
         YY_G(yy_start_stack) = NULL;
+    }
 ]])
 
 m4_ifdef( [[M4_YY_USES_REJECT]],
Index: src/main.c
--- src/main.c.orig	2015-11-11 00:10:20.000000000 +0100
+++ src/main.c	2016-03-20 20:44:10.392958897 +0100
@@ -1167,7 +1167,6 @@
 			break;
 
 		case OPT_NO_UNISTD_H:
-			//buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0);
 			break;
 
@@ -1282,7 +1281,6 @@
 			break;
 
 		case OPT_STACK:
-			//buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
 			break;
 
@@ -1339,87 +1337,66 @@
             break;
 
 		case OPT_NO_YY_PUSH_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
 			break;
 		case OPT_NO_YY_POP_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0);
 			break;
 		case OPT_NO_YY_TOP_STATE:
-			//buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0);
 			break;
 		case OPT_NO_UNPUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0);
 			break;
 		case OPT_NO_YY_SCAN_BUFFER:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0);
 			break;
 		case OPT_NO_YY_SCAN_BYTES:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0);
 			break;
 		case OPT_NO_YY_SCAN_STRING:
-			//buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0);
 			break;
 		case OPT_NO_YYGET_EXTRA:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0);
 			break;
 		case OPT_NO_YYSET_EXTRA:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0);
 			break;
 		case OPT_NO_YYGET_LENG:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0);
 			break;
 		case OPT_NO_YYGET_TEXT:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0);
 			break;
 		case OPT_NO_YYGET_LINENO:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0);
 			break;
 		case OPT_NO_YYSET_LINENO:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
 			break;
 		case OPT_NO_YYGET_IN:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
 			break;
 		case OPT_NO_YYSET_IN:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0);
 			break;
 		case OPT_NO_YYGET_OUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0);
 			break;
 		case OPT_NO_YYSET_OUT:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0);
 			break;
 		case OPT_NO_YYGET_LVAL:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0);
 			break;
 		case OPT_NO_YYSET_LVAL:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0);
 			break;
 		case OPT_NO_YYGET_LLOC:
-			//buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0);
 			break;
 		case OPT_NO_YYSET_LLOC:
-			//buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1");
             buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0);
 			break;
 		case OPT_HEX:
@@ -1573,13 +1550,12 @@
 
 	if (reject){
         out_m4_define( "M4_YY_USES_REJECT", NULL);
-		//outn ("\n#define YY_USES_REJECT");
     }
 
 	if (!do_yywrap) {
 		if (!C_plus_plus) {
 			 if (reentrant)
-				outn ("\n#define yywrap(yyscanner) (/*CONSTCOND*/1)");
+				outn ("\n#define yywrap(M4_YY_CALL_ONLY_ARG) (/*CONSTCOND*/1)");
 			 else
 				outn ("\n#define yywrap() (/*CONSTCOND*/1)");
 		}
Index: src/scan.c
--- src/scan.c.orig	2015-11-17 17:17:41.000000000 +0100
+++ src/scan.c	2016-03-20 20:44:10.392958897 +0100
@@ -2763,7 +2763,7 @@
 case 90:
 YY_RULE_SETUP
 #line 386 "scan.l"
-ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
@@ -4672,7 +4672,7 @@
 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 		 * immediate realloc on the next call.
          */
-		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
+		num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								);
Index: src/scan.l
--- src/scan.l.orig	2015-11-11 00:18:24.000000000 +0100
+++ src/scan.l	2016-03-20 20:44:10.392958897 +0100
@@ -383,7 +383,7 @@
 	stack		ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
 	stdinit		do_stdinit = option_sense;
 	stdout		use_stdout = option_sense;
-    unistd      ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+    unistd      ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
 	unput		ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
 	verbose		printstats = option_sense;
 	warn		nowarn = ! option_sense;
Index: src/skel.c
--- src/skel.c.orig	2015-11-17 17:17:39.000000000 +0100
+++ src/skel.c	2016-03-20 20:44:10.392958897 +0100
@@ -1070,6 +1070,18 @@
   "]])",
   "]])",
   "",
+  "m4_ifdef( [[M4_YY_REENTRANT]],",
+  "[[",
+  "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+  "[[",
+  "int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+  "]])",
+  "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+  "[[",
+  "void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );",
+  "]])",
+  "]])",
+  "",
   "%if-bison-bridge",
   "m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
   "[[",
@@ -2561,7 +2573,7 @@
   "		 * scanner will even need a stack. We use 2 instead of 1 to avoid an",
   "		 * immediate realloc on the next call.",
   "         */",
-  "		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...",
+  "		num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */",
   "		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc",
   "								(num_to_alloc * sizeof(struct yy_buffer_state*)",
   "								M4_YY_CALL_LAST_ARG);",
@@ -3228,8 +3240,10 @@
   "m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],",
   "[[",
   "    /* Destroy the start condition stack. */",
+  "    if (YY_G(yy_start_stack) != NULL) {",
   "        yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );",
   "        YY_G(yy_start_stack) = NULL;",
+  "    }",
   "]])",
   "",
   "m4_ifdef( [[M4_YY_USES_REJECT]],",
Index: src/tables.c
--- src/tables.c.orig	2015-11-11 00:10:20.000000000 +0100
+++ src/tables.c	2016-03-20 20:44:10.392958897 +0100
@@ -88,7 +88,7 @@
 	th->th_magic = YYTBL_MAGIC;
 	th->th_hsize = 14 + strlen (version_str) + 1 + strlen (name) + 1;
 	th->th_hsize += yypad64 (th->th_hsize);
-	th->th_ssize = 0;	// Not known at this point.
+	th->th_ssize = 0;
 	th->th_flags = 0;
 	th->th_version = copy_string (version_str);
 	th->th_name = copy_string (name);
