cvs commit: patches/flex flex-2.5.31-debian_fixes-2.patch flex-2.5.4a-redhat_fixes.patch

jim at linuxfromscratch.org jim at linuxfromscratch.org
Fri Jun 4 14:14:37 PDT 2004


jim         04/06/04 15:14:37

  Added:       flex     flex-2.5.31-debian_fixes-2.patch
                        flex-2.5.4a-redhat_fixes.patch
  Log:
  Naming Scheme Update
  
  Revision  Changes    Path
  1.1                  patches/flex/flex-2.5.31-debian_fixes-2.patch
  
  Index: flex-2.5.31-debian_fixes-2.patch
  ===================================================================
  Submitted By: Zack Winkles <winkie at linuxfromscratch.org>
  Date: 2004-03-01
  Initial Package Version: 2.5.31
  Origin: Debian
  Description: This fixes a ton of things. I'm not entirely sure what, but
  	it's all stuff that Debian thought to be broken, and I trust them.
  	All the non-code changes have been stripped (otherwise it would
  	be gargantuan). I've been using this patch for a few months now
  	and it makes flex not suck anymore. That's a good thing.
  
  diff -Naur flex-2.5.31.orig/filter.c flex-2.5.31/filter.c
  --- flex-2.5.31.orig/filter.c	2003-03-25 11:39:08.000000000 -0500
  +++ flex-2.5.31/filter.c	2004-03-01 23:14:28.868777672 -0500
  @@ -157,11 +157,15 @@
   		if (chain->filter_func) {
   			int     r;
   
  -			/* setup streams again */
  +			/* setup streams again  -- Removed. POSIX states that children inherit
  +			   open streams in the parent. Also, ANSI C99 states that the stdin
  +				 and stdout macors need not be modified lvalues; so this code is 
  +				 broken in the first place.
   			if ((stdin = fdopen (0, "r")) == NULL)
   				flexfatal (_("fdopen(0) failed"));
   			if ((stdout = fdopen (1, "w")) == NULL)
   				flexfatal (_("fdopen(1) failed"));
  +      */
   
   			if ((r = chain->filter_func (chain)) == -1)
   				flexfatal (_("filter_func failed"));
  @@ -181,9 +185,11 @@
   	if (dup2 (pipes[1], 1) == -1)
   		flexfatal (_("dup2(pipes[1],1)"));
   	close (pipes[1]);
  +	/* This is not legal; stfout does not need to be a modifiable
  +	lvalue 
   	if ((stdout = fdopen (1, "w")) == NULL)
   		flexfatal (_("fdopen(1) failed"));
  -
  +	*/
   	return true;
   }
   
  diff -Naur flex-2.5.31.orig/flex.skl flex-2.5.31/flex.skl
  --- flex-2.5.31.orig/flex.skl	2003-03-31 20:51:38.000000000 -0500
  +++ flex-2.5.31/flex.skl	2004-03-01 23:14:28.870777368 -0500
  @@ -27,6 +27,11 @@
   %# Macros for runtime processing stage.
   m4_changecom
   m4_changequote
  +
  +%# Let user use our quoting strings
  +m4_changequote({, })
  +m4_define( {m4_userquote_start}, {m4_changequote(<, >)[[m4_changequote([[, ]])})
  +m4_define( {m4_userquote_end}, {m4_changequote(<, >)]]m4_changequote([[, ]])})
   m4_changequote([[, ]])
   
   %# 
  @@ -345,19 +350,19 @@
   %#        yyscan_t yyscanner;
   %#
   %# Generate traditional function defs
  -    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)
  +    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
           M4_YY_DECL_LAST_ARG]])
  -    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)
  -        $1 $2;
  +    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
  +        $1 $2; [[\]]
           M4_YY_DECL_LAST_ARG]])
  -    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)
  -        $1 $2;
  -        $3 $4;
  +    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
  +        $1 $2; [[\]]
  +        $3 $4; [[\]]
           M4_YY_DECL_LAST_ARG]])
  -    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)
  -        $1 $2;
  -        $3 $4;
  -        $5 $6;
  +    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
  +        $1 $2; [[\]]
  +        $3 $4; [[\]]
  +        $5 $6; [[\]]
           M4_YY_DECL_LAST_ARG]])
   ]],
   [[
  @@ -724,6 +729,7 @@
   
   m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
   [[
  +#ifndef YY_NO_UNISTD_H
   /* Special case for "unistd.h", since it is non-ANSI. We include it way
    * down here because we want the user's section 1 to have been scanned first.
    * The user has a chance to override it with an option.
  @@ -734,6 +740,7 @@
   %if-c++-only
   #include <unistd.h>
   %endif
  +#endif
   ]])
   
   #ifndef YY_EXTRA_TYPE
  @@ -1124,9 +1131,9 @@
       m4_dnl  The bison pure parser is used. Redefine yylex to
       m4_dnl  accept the lval parameter.
   
  -    m4_define( [[M4_YY_LEX_PROTO]],
  +    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
                  [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
  -    m4_define( [[M4_YY_LEX_DECLARATION]],
  +    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
                  [[YYFARGS1(YYSTYPE *,yylval_param)]])
   ]])
   
  @@ -1134,9 +1141,9 @@
   [[
       m4_dnl  Locations are used. yylex should also accept the ylloc parameter.
   
  -    m4_define( [[M4_YY_LEX_PROTO]],
  +    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
                  [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
  -    m4_define( [[M4_YY_LEX_DECLARATION]],
  +    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
                  [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
   ]])
   
  @@ -2251,11 +2258,11 @@
    * @note If you want to scan bytes that may contain NUL values, then use
    *       yy_scan_bytes() instead.
    */
  -YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)
  +YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)
   {
       m4_dnl M4_YY_DECL_GUTS_VAR();
   
  -	return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);
  +	return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG);
   }
   %endif
   ]])
  diff -Naur flex-2.5.31.orig/gen.c flex-2.5.31/gen.c
  --- flex-2.5.31.orig/gen.c	2003-03-30 14:58:44.000000000 -0500
  +++ flex-2.5.31/gen.c	2004-03-01 23:14:28.862778584 -0500
  @@ -1812,7 +1812,6 @@
   			if (yytext_is_array) {
   				if (!reentrant){
       				indent_puts ("static int yy_more_offset = 0;");
  -                }else{
                       indent_puts ("static int yy_prev_more_offset = 0;");
                   }
   			}
  diff -Naur flex-2.5.31.orig/main.c flex-2.5.31/main.c
  --- flex-2.5.31.orig/main.c	2003-03-31 20:51:38.000000000 -0500
  +++ flex-2.5.31/main.c	2004-03-01 23:14:28.863778432 -0500
  @@ -199,6 +199,7 @@
   {
   #if ENABLE_NLS
   	setlocale (LC_MESSAGES, "");
  +	setlocale (LC_CTYPE, "");
   	textdomain (PACKAGE);
   	bindtextdomain (PACKAGE, LOCALEDIR);
   #endif
  @@ -1595,7 +1596,6 @@
   			outn ("#else");
   			outn (yy_stdinit);
   			outn ("#endif");
  -			outn ("#endif");
   		}
   
   		else {
  diff -Naur flex-2.5.31.orig/scan.c flex-2.5.31/scan.c
  --- flex-2.5.31.orig/scan.c	2003-04-01 11:33:17.000000000 -0500
  +++ flex-2.5.31/scan.c	2004-03-01 23:14:28.860778888 -0500
  @@ -1619,11 +1619,13 @@
   #define LINEDIR 18
   #define CODEBLOCK_MATCH_BRACE 19
   
  +#ifndef YY_NO_UNISTD_H
   /* Special case for "unistd.h", since it is non-ANSI. We include it way
    * down here because we want the user's section 1 to have been scanned first.
    * The user has a chance to override it with an option.
    */
   #include <unistd.h>
  +#endif
   
   #ifndef YY_EXTRA_TYPE
   #define YY_EXTRA_TYPE void *
  diff -Naur flex-2.5.31.orig/scan.l flex-2.5.31/scan.l
  --- flex-2.5.31.orig/scan.l	2003-03-31 20:51:38.000000000 -0500
  +++ flex-2.5.31/scan.l	2004-03-01 23:14:28.864778280 -0500
  @@ -194,8 +194,14 @@
   <COMMENT>{
   	"*/"		ACTION_ECHO; yy_pop_state();
   	"*"		ACTION_ECHO;
  -	[^*\n]+		ACTION_ECHO;
  -	[^*\n]*{NL}	++linenum; ACTION_ECHO;
  +	[\[\]]		ACTION_ECHO;
  +	[^*\[\]\n]+	ACTION_ECHO;
  +	[^*\[\]\n]*{NL}	++linenum; ACTION_ECHO;
  +	\[\[		add_action("[" "[]" "]m4_" "userquote_start()");
  +	\]\]		add_action("[" "[]" "]m4_" "userquote_end()");
  +			/* Macros need to be clearly separated from surrounding
  +			 * text and this file needs to go through flex untouched.
  +			 */
   }
   
   <LINEDIR>{
  diff -Naur flex-2.5.31.orig/skel.c flex-2.5.31/skel.c
  --- flex-2.5.31.orig/skel.c	2003-04-01 11:33:08.000000000 -0500
  +++ flex-2.5.31/skel.c	2004-03-01 23:14:28.867777824 -0500
  @@ -404,16 +404,16 @@
     "%#        yyscan_t yyscanner;",
     "%#",
     "%# Generate traditional function defs",
  -  "    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)",
  +  "    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\\]]",
     "        M4_YY_DECL_LAST_ARG]])",
  -  "    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)",
  +  "    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\\]]",
     "        $1 $2;",
     "        M4_YY_DECL_LAST_ARG]])",
  -  "    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)",
  +  "    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\\]]",
     "        $1 $2;",
     "        $3 $4;",
     "        M4_YY_DECL_LAST_ARG]])",
  -  "    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)",
  +  "    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\\]]",
     "        $1 $2;",
     "        $3 $4;",
     "        $5 $6;",
  @@ -783,6 +783,7 @@
     "",
     "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,",
     "[[",
  +  "#ifndef YY_NO_UNISTD_H",
     "/* Special case for \"unistd.h\", since it is non-ANSI. We include it way",
     " * down here because we want the user's section 1 to have been scanned first.",
     " * The user has a chance to override it with an option.",
  @@ -793,6 +794,7 @@
     "%if-c++-only",
     "#include <unistd.h>",
     "%endif",
  +  "#endif",
     "]])",
     "",
     "#ifndef YY_EXTRA_TYPE",
  @@ -2454,11 +2456,11 @@
     " * @note If you want to scan bytes that may contain NUL values, then use",
     " *       yy_scan_bytes() instead.",
     " */",
  -  "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)",
  +  "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)",
     "{",
     "    m4_dnl M4_YY_DECL_GUTS_VAR();",
     "",
  -  "	return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);",
  +  "	return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG);",
     "}",
     "%endif",
     "]])",
  
  
  
  1.1                  patches/flex/flex-2.5.4a-redhat_fixes.patch
  
  Index: flex-2.5.4a-redhat_fixes.patch
  ===================================================================
  Submitted By: Tushar Teredesai <tushar at linuxfromscratch.org>
  Date: 2002-12-31
  Initial Package Version: 2.5.4a
  Origin: Redhat RPM, http://archives.linuxfromscratch.org/mail-archives/lfs-dev/2003-January/031014.html
  Description: Various fixes related to the newer GCC & GLIBC releases
      * conflicting isatty() prototype w/ glibc 2.2.
      * gcc-3 related fixes.
      * ISO C++ 98 compliance.
      * YY_NO_INPUT patch.
  
  diff -ur flex-2.5.4.orig/FlexLexer.h flex-2.5.4/FlexLexer.h
  --- flex-2.5.4.orig/FlexLexer.h	1997-07-26 21:41:38.000000000 -0500
  +++ flex-2.5.4/FlexLexer.h	2002-10-22 14:19:46.000000000 -0500
  @@ -44,7 +44,7 @@
   #ifndef __FLEX_LEXER_H
   // Never included before - need to define base class.
   #define __FLEX_LEXER_H
  -#include <iostream.h>
  +#include <iostream>
   
   extern "C++" {
   
  @@ -61,14 +61,14 @@
   	virtual void
   		yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
   	virtual struct yy_buffer_state*
  -		yy_create_buffer( istream* s, int size ) = 0;
  +		yy_create_buffer( std::istream* s, int size ) = 0;
   	virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
  -	virtual void yyrestart( istream* s ) = 0;
  +	virtual void yyrestart( std::istream* s ) = 0;
   
   	virtual int yylex() = 0;
   
   	// Call yylex with new input/output sources.
  -	int yylex( istream* new_in, ostream* new_out = 0 )
  +	int yylex( std::istream* new_in, std::ostream* new_out = 0 )
   		{
   		switch_streams( new_in, new_out );
   		return yylex();
  @@ -76,8 +76,8 @@
   
   	// Switch to new input/output streams.  A nil stream pointer
   	// indicates "keep the current one".
  -	virtual void switch_streams( istream* new_in = 0,
  -					ostream* new_out = 0 ) = 0;
  +	virtual void switch_streams( std::istream* new_in = 0,
  +				     std::ostream* new_out = 0 ) = 0;
   
   	int lineno() const		{ return yylineno; }
   
  @@ -104,17 +104,17 @@
   public:
   	// arg_yyin and arg_yyout default to the cin and cout, but we
   	// only make that assignment when initializing in yylex().
  -	yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
  +	yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
   
   	virtual ~yyFlexLexer();
   
   	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
  -	struct yy_buffer_state* yy_create_buffer( istream* s, int size );
  +	struct yy_buffer_state* yy_create_buffer( std::istream* s, int size );
   	void yy_delete_buffer( struct yy_buffer_state* b );
  -	void yyrestart( istream* s );
  +	void yyrestart( std::istream* s );
   
   	virtual int yylex();
  -	virtual void switch_streams( istream* new_in, ostream* new_out );
  +	virtual void switch_streams( std::istream* new_in, std::ostream* new_out );
   
   protected:
   	virtual int LexerInput( char* buf, int max_size );
  @@ -125,7 +125,7 @@
   	int yyinput();
   
   	void yy_load_buffer_state();
  -	void yy_init_buffer( struct yy_buffer_state* b, istream* s );
  +	void yy_init_buffer( struct yy_buffer_state* b, std::istream* s );
   	void yy_flush_buffer( struct yy_buffer_state* b );
   
   	int yy_start_stack_ptr;
  @@ -140,8 +140,8 @@
   	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
   	int yy_get_next_buffer();
   
  -	istream* yyin;	// input source for default LexerInput
  -	ostream* yyout;	// output sink for default LexerOutput
  +	std::istream* yyin;	// input source for default LexerInput
  +	std::ostream* yyout;	// output sink for default LexerOutput
   
   	struct yy_buffer_state* yy_current_buffer;
   
  diff -ur flex-2.5.4.orig/flex.skl flex-2.5.4/flex.skl
  --- flex-2.5.4.orig/flex.skl	1996-09-10 18:58:54.000000000 -0500
  +++ flex-2.5.4/flex.skl	2002-10-22 14:19:46.000000000 -0500
  @@ -10,6 +10,7 @@
   
   %-
   #include <stdio.h>
  +#include <unistd.h>
   %*
   
   
  @@ -27,7 +28,6 @@
   %+
   class istream;
   %*
  -#include <unistd.h>
   
   /* Use prototypes in function declarations. */
   #define YY_USE_PROTOS
  @@ -1177,11 +1177,6 @@
   
   
   %-
  -#ifndef YY_ALWAYS_INTERACTIVE
  -#ifndef YY_NEVER_INTERACTIVE
  -extern int isatty YY_PROTO(( int ));
  -#endif
  -#endif
   
   #ifdef YY_USE_PROTOS
   void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  @@ -1192,7 +1187,6 @@
   #endif
   
   %+
  -extern "C" int isatty YY_PROTO(( int ));
   void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
   %*
   
  diff -ur flex-2.5.4.orig/initscan.c flex-2.5.4/initscan.c
  --- flex-2.5.4.orig/initscan.c	1997-07-26 21:32:18.000000000 -0500
  +++ flex-2.5.4/initscan.c	2002-10-22 14:19:46.000000000 -0500
  @@ -10,7 +10,7 @@
   #define YY_FLEX_MINOR_VERSION 5
   
   #include <stdio.h>
  -
  +#include <unistd.h>
   
   /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
   #ifdef c_plusplus
  @@ -23,7 +23,6 @@
   #ifdef __cplusplus
   
   #include <stdlib.h>
  -#include <unistd.h>
   
   /* Use prototypes in function declarations. */
   #define YY_USE_PROTOS
  @@ -3311,12 +3310,6 @@
   	}
   
   
  -#ifndef YY_ALWAYS_INTERACTIVE
  -#ifndef YY_NEVER_INTERACTIVE
  -extern int isatty YY_PROTO(( int ));
  -#endif
  -#endif
  -
   #ifdef YY_USE_PROTOS
   void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
   #else
  diff -ur flex-2.5.4.orig/skel.c flex-2.5.4/skel.c
  --- flex-2.5.4.orig/skel.c	1996-09-10 19:00:38.000000000 -0500
  +++ flex-2.5.4/skel.c	2002-10-22 14:19:46.000000000 -0500
  @@ -15,6 +15,7 @@
     "",
     "%-",
     "#include <stdio.h>",
  +  "#include <unistd.h>",
     "%*",
     "",
     "",
  @@ -30,9 +31,9 @@
     "",
     "#include <stdlib.h>",
     "%+",
  -  "class istream;",
  +  "#include <iostream>",
  +  "using namespace std;",
     "%*",
  -  "#include <unistd.h>",
     "",
     "/* Use prototypes in function declarations. */",
     "#define YY_USE_PROTOS",
  @@ -454,7 +455,7 @@
     "YY_DECL",
     "	{",
     "	register yy_state_type yy_current_state;",
  -  "	register char *yy_cp, *yy_bp;",
  +  "	register char *yy_cp = NULL, *yy_bp = NULL;",
     "	register int yy_act;",
     "",
     "%% user's declarations go here",
  @@ -1182,11 +1183,6 @@
     "",
     "",
     "%-",
  -  "#ifndef YY_ALWAYS_INTERACTIVE",
  -  "#ifndef YY_NEVER_INTERACTIVE",
  -  "extern int isatty YY_PROTO(( int ));",
  -  "#endif",
  -  "#endif",
     "",
     "#ifdef YY_USE_PROTOS",
     "void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )",
  @@ -1197,7 +1193,6 @@
     "#endif",
     "",
     "%+",
  -  "extern \"C\" int isatty YY_PROTO(( int ));",
     "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )",
     "%*",
     "",
  
  
  



More information about the patches mailing list