From: Paul Eggert Date: Mon, 16 Jun 2003 18:37:55 +0000 (+0000) Subject: (_AT_TEST_GLR_CXXTYPES): Ensure yylex and X-Git-Tag: BISON-2_0~273 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/b8a204c09bbe14a804d42f9ca774e9f3881ac6f1?ds=inline (_AT_TEST_GLR_CXXTYPES): Ensure yylex and yyerror are declared before use; C99 requires this. --- diff --git a/tests/cxx-type.at b/tests/cxx-type.at index ded69471..bd931194 100644 --- a/tests/cxx-type.at +++ b/tests/cxx-type.at @@ -40,6 +40,23 @@ $1 #define YYINITDEPTH 10 static char* format (const char*, ...); + struct YYLTYPE; +#if YYPURE +# if YYLSP_NEEDED +# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp +# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s +# else +# define LEX_PARAMETERS YYSTYPE *lvalp +# endif +#endif +#ifndef LEX_PARAMETERS +# define LEX_PARAMETERS void +#endif +#ifndef ERROR_PARAMETERS +# define ERROR_PARAMETERS char const *s +#endif + int yylex (LEX_PARAMETERS); + int yyerror (ERROR_PARAMETERS); %} %token TYPENAME ID @@ -101,13 +118,7 @@ main (int argc, char** argv) } int -#if YYPURE && YYLSP_NEEDED - yylex (YYSTYPE *lvalp, YYLTYPE *llocp) -#elif YYPURE - yylex (YYSTYPE *lvalp) -#else - yylex () -#endif +yylex (LEX_PARAMETERS) { char buffer[256]; int c; @@ -180,13 +191,13 @@ int } int -yyerror ( +yyerror (ERROR_PARAMETERS) +{ #if YYPURE && YYLSP_NEEDED - YYLTYPE *llocp, + /* Pacify GCC by using llocp. */ + if (! llocp) + abort (); #endif - const char *s - ) -{ fprintf (stderr, "%s\n", s); return 0; }