From: Christos Zoulas Date: Fri, 19 Sep 2008 21:32:38 +0000 (+0000) Subject: When using flex -P instead of ylwrap all the yy symbols get #defined X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=37b792e3fd7fe08ce27237341ec44bbae1ee77ce;p=am-utils-6.0.git When using flex -P instead of ylwrap all the yy symbols get #defined to the prefixed ones in the begining of the c file. This breaks the #ifndef yywrap test. We detect this by checking also yylex and if that is defined too we declare and define yywrap. --- diff --git a/amd/conf_tok.l b/amd/conf_tok.l index dab571f..6cf04de 100644 --- a/amd/conf_tok.l +++ b/amd/conf_tok.l @@ -86,9 +86,9 @@ int yylex(void); * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void); -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ #define TOK_DEBUG 0 @@ -184,9 +184,9 @@ NONQUOTE [^\"] * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void) { return 1; } -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ diff --git a/amd/sun_map_tok.l b/amd/sun_map_tok.l index 173f6bd..6c56c97 100644 --- a/amd/sun_map_tok.l +++ b/amd/sun_map_tok.l @@ -75,6 +75,9 @@ # endif /* not ECHO */ #endif /* FLEX_SCANNER */ +int yylex(void); +int yyerror(const char *); + /* * We need to configure lex to parse from a string * instead of a file. Each version of lex has it's @@ -124,9 +127,9 @@ int sun_map_input(char *buff, int maxsize); * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void); -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ /* no need to use yywrap() */ #define YY_SKIP_YYWRAP @@ -226,9 +229,9 @@ sun_map_tok_setbuff(const char* buff) * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void) { return 1; } -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ diff --git a/fsinfo/fsi_lex.l b/fsinfo/fsi_lex.l index 044a102..cc5d948 100644 --- a/fsinfo/fsi_lex.l +++ b/fsinfo/fsi_lex.l @@ -111,9 +111,9 @@ static int ayylineno; * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void); -#endif /* not yywrap */ +#endif /* not yywrap or yylex */ int yyerror(const char *, ...); @@ -268,9 +268,9 @@ current_location(void) * which automatically generates yywrap macros and symbols. So I must * distinguish between them and when yywrap is actually needed. */ -#ifndef yywrap +#if !defined(yywrap) || defined(yylex) int yywrap(void) { return 1; } -#endif /* not yywrap */ +#endif /* not yywrap or yylex */