diff options
author | Brad King <brad.king@kitware.com> | 2006-08-08 18:00:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-08-08 18:00:28 (GMT) |
commit | a3836e09a22790f9b4a12628e37dd164158880e3 (patch) | |
tree | 65e717189000aa0dc3cc701f03dbe61c1e5221f8 /Source | |
parent | 8f1aaf28c13094f21a835a5b0fe47f7813179126 (diff) | |
download | CMake-a3836e09a22790f9b4a12628e37dd164158880e3.zip CMake-a3836e09a22790f9b4a12628e37dd164158880e3.tar.gz CMake-a3836e09a22790f9b4a12628e37dd164158880e3.tar.bz2 |
COMP: Moved duplicate flex-generated lexer warning suppression and cross-platform support code to a single cmStandardLexer.h included by all lexer sources. Added fix for macro redefinitions on Borland 5.8 compiler.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommandArgumentLexer.cxx | 35 | ||||
-rw-r--r-- | Source/cmCommandArgumentLexer.in.l | 37 | ||||
-rw-r--r-- | Source/cmDependsFortranLexer.cxx | 33 | ||||
-rw-r--r-- | Source/cmDependsFortranLexer.in.l | 35 | ||||
-rw-r--r-- | Source/cmDependsJavaLexer.cxx | 36 | ||||
-rw-r--r-- | Source/cmDependsJavaLexer.in.l | 39 | ||||
-rw-r--r-- | Source/cmExprLexer.cxx | 38 | ||||
-rw-r--r-- | Source/cmExprLexer.in.l | 37 | ||||
-rw-r--r-- | Source/cmListFileLexer.c | 22 | ||||
-rw-r--r-- | Source/cmListFileLexer.in.l | 26 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 67 |
11 files changed, 96 insertions, 309 deletions
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx index 1f49ad1..127ffe1 100644 --- a/Source/cmCommandArgumentLexer.cxx +++ b/Source/cmCommandArgumentLexer.cxx @@ -477,30 +477,9 @@ Modify cmCommandArgumentLexer.h: */ -#include "cmCommandArgumentParserHelper.h" - -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif +#include "cmStandardLexer.h" -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -510,16 +489,6 @@ Modify cmCommandArgumentLexer.h: /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /*--------------------------------------------------------------------------*/ diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/cmCommandArgumentLexer.in.l index 7aa90e6..a4357b0 100644 --- a/Source/cmCommandArgumentLexer.in.l +++ b/Source/cmCommandArgumentLexer.in.l @@ -26,7 +26,7 @@ Run flex like this: Modify cmCommandArgumentLexer.cxx: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, yyalloc, yyrealloc, yyfree + yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) @@ -38,30 +38,9 @@ Modify cmCommandArgumentLexer.h: */ -#include "cmCommandArgumentParserHelper.h" +#include "cmStandardLexer.h" -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -71,16 +50,6 @@ Modify cmCommandArgumentLexer.h: /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /*--------------------------------------------------------------------------*/ %} diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx index b8feb17..318443e 100644 --- a/Source/cmDependsFortranLexer.cxx +++ b/Source/cmDependsFortranLexer.cxx @@ -640,45 +640,16 @@ Modify cmDependsFortranLexer.h: */ +#include "cmStandardLexer.h" + #define cmDependsFortranLexer_cxx #include "cmDependsFortranParser.h" /* Interface to parser object. */ -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#define ECHO - /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } -/* Provide isatty on Windows. */ -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /* Include the set of tokens from the parser. */ #include "cmDependsFortranParserTokens.h" diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmDependsFortranLexer.in.l index f95ccdb..8326eae 100644 --- a/Source/cmDependsFortranLexer.in.l +++ b/Source/cmDependsFortranLexer.in.l @@ -36,7 +36,7 @@ Run flex like this: Modify cmDependsFortranLexer.cxx: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, yyalloc, yyrealloc, yyfree + yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) @@ -48,45 +48,16 @@ Modify cmDependsFortranLexer.h: */ +#include "cmStandardLexer.h" + #define cmDependsFortranLexer_cxx #include "cmDependsFortranParser.h" /* Interface to parser object. */ -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#define ECHO - /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ { result = cmDependsFortranParser_Input(yyextra, buf, max_size); } -/* Provide isatty on Windows. */ -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /* Include the set of tokens from the parser. */ #include "cmDependsFortranParserTokens.h" diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx index aa7b571..361caa4 100644 --- a/Source/cmDependsJavaLexer.cxx +++ b/Source/cmDependsJavaLexer.cxx @@ -671,33 +671,13 @@ Modify cmDependsJavaLexer.h: - remove TABs - remove the yy_init_globals function - remove the block that includes unistd.h + - remove #line directives (avoids bogus warning on old Sun) */ -#include "cmDependsJavaParserHelper.h" - -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif +#include "cmStandardLexer.h" -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmDependsJavaParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -707,16 +687,6 @@ Modify cmDependsJavaLexer.h: /* Include the set of tokens from the parser. */ #include "cmDependsJavaParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - #define KEYWORD yylvalp->str = 0 #define SYMBOL yylvalp->str = 0 #define PRIMITIVE yylvalp->str = 0 diff --git a/Source/cmDependsJavaLexer.in.l b/Source/cmDependsJavaLexer.in.l index 3ca61a3..f26aede 100644 --- a/Source/cmDependsJavaLexer.in.l +++ b/Source/cmDependsJavaLexer.in.l @@ -23,10 +23,10 @@ Run flex like this: flex --prefix=cmDependsJava_yy --header-file=cmDependsJavaLexer.h -ocmDependsJavaLexer.cxx cmDependsJavaLexer.in.l -Modify cmDependsJavaLexer.cxx: +Modify cmDependsJavaLexer.c: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, yyalloc, yyrealloc, yyfree + yy_fatal_error, cmDependsJava_yyalloc, cmDependsJava_yyrealloc, cmDependsJava_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) @@ -38,30 +38,9 @@ Modify cmDependsJavaLexer.h: */ -#include "cmDependsJavaParserHelper.h" +#include "cmStandardLexer.h" -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmDependsJavaParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -71,16 +50,6 @@ Modify cmDependsJavaLexer.h: /* Include the set of tokens from the parser. */ #include "cmDependsJavaParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - #define KEYWORD yylvalp->str = 0 #define SYMBOL yylvalp->str = 0 #define PRIMITIVE yylvalp->str = 0 diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx index 045cf11..5367be4 100644 --- a/Source/cmExprLexer.cxx +++ b/Source/cmExprLexer.cxx @@ -458,8 +458,7 @@ This file must be translated to C and modified to build everywhere. Run flex like this: - flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx - cmExprLexer.in.l + flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l Modify cmExprLexer.cxx: - remove TABs @@ -476,30 +475,9 @@ Modify cmExprLexer.h: */ -#include "cmExprParserHelper.h" - -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif +#include "cmStandardLexer.h" -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmExprParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -509,16 +487,6 @@ Modify cmExprLexer.h: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /*--------------------------------------------------------------------------*/ #line 518 "/home/andy/vtk/CMake-bin/Source/cmExprLexer.cxx" diff --git a/Source/cmExprLexer.in.l b/Source/cmExprLexer.in.l index bc2ec1c..fccc4f6 100644 --- a/Source/cmExprLexer.in.l +++ b/Source/cmExprLexer.in.l @@ -26,7 +26,7 @@ Run flex like this: Modify cmExprLexer.cxx: - remove TABs - remove "yyscanner" argument from these methods: - yy_fatal_error, yyalloc, yyrealloc, yyfree + yy_fatal_error, cmExpr_yyalloc, cmExpr_yyrealloc, cmExpr_yyfree - remove all YY_BREAK lines occurring right after return statements - change while ( 1 ) to for(;;) @@ -38,30 +38,9 @@ Modify cmExprLexer.h: */ -#include "cmExprParserHelper.h" +#include "cmStandardLexer.h" -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 -#undef ECHO /* SGI termios defines this differently. */ -#define ECHO +#include "cmExprParserHelper.h" /* Replace the lexer input function. */ #undef YY_INPUT @@ -71,16 +50,6 @@ Modify cmExprLexer.h: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" - -#if defined( _WIN32 ) && !defined( __CYGWIN__ ) -/* Handle Windows properly */ -# include <io.h> -# if defined( _MSC_VER ) -# define isatty _isatty -# endif -# define YY_NO_UNISTD_H 1 -#endif - /*--------------------------------------------------------------------------*/ %} diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index 8f5def6..d0159a5 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -506,35 +506,17 @@ Modify cmListFileLexer.c: */ +#include "cmStandardLexer.h" + /* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 #define YY_NO_INPUT 1 #define YY_NO_UNPUT 1 #define YY_NO_UNISTD_H 1 -#define ECHO /* Setup the proper cmListFileLexer_yylex declaration. */ #define YY_EXTRA_TYPE cmListFileLexer* #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer) -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - #include "cmListFileLexer.h" /*--------------------------------------------------------------------------*/ diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l index 00b38be..e98fb3e 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/cmListFileLexer.in.l @@ -27,40 +27,22 @@ Modify cmListFileLexer.c: - remove TABs - remove the yyunput function - add a statement "(void)yyscanner;" to the top of these methods: - yy_fatal_error, yyalloc, yyrealloc, yyfree + yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree - remove all YY_BREAK lines occurring right after return statements */ +#include "cmStandardLexer.h" + /* Disable features we do not need. */ -#define YY_NEVER_INTERACTIVE 1 #define YY_NO_INPUT 1 #define YY_NO_UNPUT 1 #define YY_NO_UNISTD_H 1 -#define ECHO -/* Setup the proper yylex declaration. */ +/* Setup the proper cmListFileLexer_yylex declaration. */ #define YY_EXTRA_TYPE cmListFileLexer* #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer) -/* Disable some warnings. */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4127 ) -# pragma warning ( disable : 4131 ) -# pragma warning ( disable : 4244 ) -# pragma warning ( disable : 4251 ) -# pragma warning ( disable : 4267 ) -# pragma warning ( disable : 4305 ) -# pragma warning ( disable : 4309 ) -# pragma warning ( disable : 4706 ) -# pragma warning ( disable : 4786 ) -#endif - -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - #include "cmListFileLexer.h" /*--------------------------------------------------------------------------*/ diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h new file mode 100644 index 0000000..7ee448e --- /dev/null +++ b/Source/cmStandardLexer.h @@ -0,0 +1,67 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmStandardLexer_h +#define cmStandardLexer_h + +/* Disable some warnings. */ +#if defined(_MSC_VER) +# pragma warning ( disable : 4127 ) +# pragma warning ( disable : 4131 ) +# pragma warning ( disable : 4244 ) +# pragma warning ( disable : 4251 ) +# pragma warning ( disable : 4267 ) +# pragma warning ( disable : 4305 ) +# pragma warning ( disable : 4309 ) +# pragma warning ( disable : 4706 ) +# pragma warning ( disable : 4786 ) +#endif + +#if defined(__BORLANDC__) +# pragma warn -8008 /* condition always returns true */ +# pragma warn -8066 /* unreachable code */ +/* Borland system header defines these macros without first undef-ing them. */ +# if __BORLANDC__ >= 0x580 +# undef INT8_MIN +# undef INT16_MIN +# undef INT32_MIN +# undef INT8_MAX +# undef INT16_MAX +# undef INT32_MAX +# undef UINT8_MAX +# undef UINT16_MAX +# undef UINT32_MAX +# include <stdint.h> +# endif +#endif + +/* Define isatty on windows. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +# include <io.h> +# if defined( _MSC_VER ) +# define isatty _isatty +# endif +# define YY_NO_UNISTD_H 1 +#endif + +/* Disable features we do not need. */ +#define YY_NEVER_INTERACTIVE 1 + +/* Avoid display of input matches to standard output. */ +#undef ECHO /* SGI termios defines this differently. */ +#define ECHO + +#endif |