Submitted By: Tushar Teredesai 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 +#include 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 +#include %* @@ -27,7 +28,6 @@ %+ class istream; %* -#include /* 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 - +#include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus @@ -23,7 +23,6 @@ #ifdef __cplusplus #include -#include /* 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 ", + "#include ", "%*", "", "", @@ -30,9 +31,9 @@ "", "#include ", "%+", - "class istream;", + "#include ", + "using namespace std;", "%*", - "#include ", "", "/* 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 )", "%*", "",