From 31502ccdce373e12142fdd55dc6102a988f718d0 Mon Sep 17 00:00:00 2001 From: Buginator Date: Thu, 17 Mar 2011 19:52:33 -0400 Subject: [PATCH] Let us try this again, leave the never-interactive option for the lexers. Set never-interactive option in lexers so that Flex doesn't use isatty() function from unistd. Define YY_NO_UNISTD_H when no unistd.h is detected. Remove attempt to fix isatty error on Windows introduced in 2f780609. cherry picked from commit c046bb88e5b2562d8159e9555e397b24ab9b7f16 --- lib/framework/frame.h | 3 --- lib/framework/resource_lexer.l | 2 +- lib/framework/strres_lexer.l | 2 +- lib/gamelib/audp_lexer.l | 2 +- lib/script/chat_lexer.l | 1 + lib/script/script_lexer.l | 1 + src/level_lexer.l | 2 +- src/message_lexer.l | 2 +- src/scriptvals_lexer.l | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/framework/frame.h b/lib/framework/frame.h index 6ab6317f7..ef58bffce 100644 --- a/lib/framework/frame.h +++ b/lib/framework/frame.h @@ -123,10 +123,7 @@ extern UDWORD HashStringIgnoreCase( const char *String ); struct timezone; extern int gettimeofday(struct timeval* tv, struct timezone* tz); - -extern "C" int isatty(int); // Apparently flex declares isatty with C++ linkage on Windows. Don't ask why. Declaring here instead. #endif -extern "C" int isatty(int); // Apparently flex declares isatty with C++ linkage on Windows. Don't ask why. Declaring here instead. static inline WZ_DECL_CONST const char * bool2string(bool var) { diff --git a/lib/framework/resource_lexer.l b/lib/framework/resource_lexer.l index 8e21eec2e..6d612f912 100644 --- a/lib/framework/resource_lexer.l +++ b/lib/framework/resource_lexer.l @@ -80,7 +80,7 @@ extern void res_set_debug(int bdebug); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option prefix="res_" %x COMMENT diff --git a/lib/framework/strres_lexer.l b/lib/framework/strres_lexer.l index 35bfe1241..cd812efd7 100644 --- a/lib/framework/strres_lexer.l +++ b/lib/framework/strres_lexer.l @@ -84,7 +84,7 @@ extern void strres_set_debug(int bdebug); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option prefix="strres_" %x COMMENT diff --git a/lib/gamelib/audp_lexer.l b/lib/gamelib/audp_lexer.l index 1f2661f7d..58d095b42 100644 --- a/lib/gamelib/audp_lexer.l +++ b/lib/gamelib/audp_lexer.l @@ -84,7 +84,7 @@ extern void audp_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option prefix="audp_" %x COMMENT diff --git a/lib/script/chat_lexer.l b/lib/script/chat_lexer.l index 494d2da96..943bd0007 100644 --- a/lib/script/chat_lexer.l +++ b/lib/script/chat_lexer.l @@ -80,6 +80,7 @@ static SDWORD playerIndex; %option prefix="chat_" %option nounput %option case-insensitive +%option never-interactive %% diff --git a/lib/script/script_lexer.l b/lib/script/script_lexer.l index 3534c548e..f559162f5 100644 --- a/lib/script/script_lexer.l +++ b/lib/script/script_lexer.l @@ -458,6 +458,7 @@ static void pushInclude(const char *pIncludePath) %option prefix="scr_" %option nounput %option yylineno +%option never-interactive %x COMMENT %x SLCOMMENT diff --git a/src/level_lexer.l b/src/level_lexer.l index b5ba9d261..63b637819 100644 --- a/src/level_lexer.l +++ b/src/level_lexer.l @@ -87,7 +87,7 @@ extern void lev_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option prefix="lev_" %x COMMENT diff --git a/src/message_lexer.l b/src/message_lexer.l index 75f12c8ea..1ebb23839 100644 --- a/src/message_lexer.l +++ b/src/message_lexer.l @@ -79,7 +79,7 @@ extern void message_set_debug(int bdebug); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option prefix="message_" %x COMMENT diff --git a/src/scriptvals_lexer.l b/src/scriptvals_lexer.l index 43696b040..64ab4820d 100644 --- a/src/scriptvals_lexer.l +++ b/src/scriptvals_lexer.l @@ -92,7 +92,7 @@ extern void scrv_set_extra(YY_EXTRA_TYPE user_defined); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput never-interactive %option warn nodefault %option prefix="scrv_"