[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cxx-type.at patch for C99 (yylex, yerror problem)
From: |
Paul Eggert |
Subject: |
cxx-type.at patch for C99 (yylex, yerror problem) |
Date: |
16 Jun 2003 11:41:37 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I installed this patch to port the most recent cxx-type.at changes to C99.
The hassle of declaring yylex and yyerror continues to increase.
I am becoming inclined to think that Bison should do this
automatically, so that users don't have to.
2003-06-16 Paul Eggert <address@hidden>
* tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Ensure yylex and
yyerror are declared before use; C99 requires this.
--- cxx-type.at.~1.15.~ Mon Jun 9 19:44:58 2003
+++ cxx-type.at Mon Jun 16 11:35:40 2003
@@ -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;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- cxx-type.at patch for C99 (yylex, yerror problem),
Paul Eggert <=