From: Paul Eggert Date: Mon, 12 Sep 2005 05:50:44 +0000 (+0000) Subject: [defined YYSETJMP]: Don't include . X-Git-Tag: BISON-2_1~12 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/c89b4c032c039eedbd64418e7082f5268a27af1b?ds=inline [defined YYSETJMP]: Don't include . (YYJMP_BUF, YYSETJMP, YYLONGJMP) [!defined YYSETJMP]: New macros. All uses of jmp_buf, setjmp, longjmp changed to use these instead. (yyparse): Abort if user code uses longjmp to throw an unexpected value. --- diff --git a/data/glr.c b/data/glr.c index 37e05af7..d2f19218 100644 --- a/data/glr.c +++ b/data/glr.c @@ -221,7 +221,6 @@ b4_syncline([@oline@], [@ofile@]) #include #include #include -#include #ifndef YY_ # if YYENABLE_NLS @@ -255,6 +254,13 @@ b4_syncline([@oline@], [@ofile@]) #define yytrue 1 #define yyfalse 0 +#ifndef YYSETJMP +# include +# define YYJMP_BUF jmp_buf +# define YYSETJMP(env) setjmp (env) +# define YYLONGJMP(env, val) longjmp (env, val) +#endif + /*-----------------. | GCC extensions. | `-----------------*/ @@ -728,7 +734,7 @@ struct yyGLRStack { int yyrawchar; ])[ yySymbol* yytokenp; - jmp_buf yyexception_buffer; + YYJMP_BUF yyexception_buffer; yyGLRStackItem* yyitems; yyGLRStackItem* yynextFree; size_t yyspaceLeft; @@ -746,7 +752,7 @@ yyFail (yyGLRStack* yystack]b4_pure_formals[, const char* yymsg) { if (yymsg != NULL) yyerror (]b4_yyerror_args[yymsg); - longjmp (yystack->yyexception_buffer, 1); + YYLONGJMP (yystack->yyexception_buffer, 1); } static void yyMemoryExhausted (yyGLRStack* yystack) @@ -754,7 +760,7 @@ static void yyMemoryExhausted (yyGLRStack* yystack) static void yyMemoryExhausted (yyGLRStack* yystack) { - longjmp (yystack->yyexception_buffer, 2); + YYLONGJMP (yystack->yyexception_buffer, 2); } #if YYDEBUG || YYERROR_VERBOSE @@ -2081,10 +2087,12 @@ b4_syncline([@oline@], [@ofile@])])dnl [ if (! yyinitGLRStack (&yystack, YYINITDEPTH)) goto yyexhaustedlab; - switch (setjmp (yystack.yyexception_buffer)) + switch (YYSETJMP (yystack.yyexception_buffer)) { + case 0: break; case 1: goto yyabortlab; case 2: goto yyexhaustedlab; + default: goto yybuglab; } yystack.yytokenp = &yytoken; yyglrShift (&yystack, 0, 0, 0, yylval, &yylloc);