From dd79f09da8bfda3a8c98e5ca9b2efa484f884012 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 14 Sep 2013 09:02:13 +0000 Subject: [PATCH] [WPP] * Sync with Wine 1.7.1. svn path=/trunk/; revision=60092 --- reactos/include/reactos/wine/wpp.h | 8 +- reactos/media/doc/README.WINE | 2 +- reactos/tools/wpp/CMakeLists.txt | 2 +- reactos/tools/wpp/ppl.l | 9 +- reactos/tools/wpp/{lex.yy.c => ppl.yy.c} | 313 +++++----- reactos/tools/wpp/ppy.tab.c | 763 ++++++++++++----------- reactos/tools/wpp/ppy.tab.h | 13 +- reactos/tools/wpp/ppy.y | 34 +- reactos/tools/wpp/preproc.c | 12 +- reactos/tools/wpp/wpp.c | 22 + reactos/tools/wpp/wpp_private.h | 2 +- 11 files changed, 626 insertions(+), 554 deletions(-) rename reactos/tools/wpp/{lex.yy.c => ppl.yy.c} (98%) diff --git a/reactos/include/reactos/wine/wpp.h b/reactos/include/reactos/wine/wpp.h index 2d284f154f0..ac180bec9ff 100644 --- a/reactos/include/reactos/wine/wpp.h +++ b/reactos/include/reactos/wine/wpp.h @@ -29,12 +29,12 @@ struct wpp_callbacks /* I/O callbacks */ /* Looks for a file to include, returning the path where it is found */ - /* parent_name is the directory of the parent source file (for local - * includes), includepath is an array of additional include paths */ - char *(*lookup)( const char *filename, const char *parent_name, + /* The type param is true for local (#include "filename.h") includes */ + /* parent_name is the directory of the parent source file, includepath + * is an array of additional include paths */ + char *(*lookup)( const char *filename, int type, const char *parent_name, char **include_path, int include_path_count ); /* Opens an include file */ - /* The type param is true if it is a local ("...") include */ void *(*open)( const char *filename, int type ); /* Closes a previously opened file */ void (*close)( void *file ); diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index bc8e590bd1e..0489ff6f38b 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -23,7 +23,7 @@ The following build tools are shared with Wine. reactos/tools/unicode # Synced to Wine-1.5.19 reactos/tools/widl # Synced to Wine-1.5.11 -reactos/tools/wpp # Synced to Wine-1.3.26 +reactos/tools/wpp # Synced to Wine-1.7.1 The following libraries are shared with Wine. diff --git a/reactos/tools/wpp/CMakeLists.txt b/reactos/tools/wpp/CMakeLists.txt index 432e48bde81..124aa202f74 100644 --- a/reactos/tools/wpp/CMakeLists.txt +++ b/reactos/tools/wpp/CMakeLists.txt @@ -13,9 +13,9 @@ if(MSVC) endif() list(APPEND SOURCE - lex.yy.c preproc.c wpp.c + ppl.yy.c ppy.tab.c) add_library(wpp ${SOURCE}) diff --git a/reactos/tools/wpp/ppl.l b/reactos/tools/wpp/ppl.l index 98f3e1a3b2d..70bd213122b 100644 --- a/reactos/tools/wpp/ppl.l +++ b/reactos/tools/wpp/ppl.l @@ -329,6 +329,7 @@ void pp_writestring(const char *format, ...) va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); /* If the string is longer than buffersize, vsnprintf returns * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ while(len > buffercapacity || len < 0) @@ -345,10 +346,11 @@ void pp_writestring(const char *format, ...) return; } buffer = new_buffer; + va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); } - va_end(valist); wpp_callbacks->write(buffer, len); } @@ -772,7 +774,10 @@ void pp_writestring(const char *format, ...) if(!bep) { if(YY_START != INITIAL) + { ppy_error("Unexpected end of file during preprocessing"); + BEGIN(INITIAL); + } yyterminate(); } else if(bep->should_pop == 2) @@ -1596,7 +1601,7 @@ void pp_do_include(char *fname, int type) /* Undo the effect of the quotation */ fname[n-1] = '\0'; - if((fp = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) { ppy_error("Unable to open include file %s", fname+1); return; diff --git a/reactos/tools/wpp/lex.yy.c b/reactos/tools/wpp/ppl.yy.c similarity index 98% rename from reactos/tools/wpp/lex.yy.c rename to reactos/tools/wpp/ppl.yy.c index 7a93ad74415..50f00af0434 100644 --- a/reactos/tools/wpp/lex.yy.c +++ b/reactos/tools/wpp/ppl.yy.c @@ -1,11 +1,11 @@ -#line 2 "lex.yy.c" +#line 2 "ppl.yy.c" #line 125 "ppl.l" #include "config.h" #include "wine/port.h" -#line 9 "lex.yy.c" +#line 9 "ppl.yy.c" #define YY_INT_ALIGNED short int @@ -1367,6 +1367,7 @@ void pp_writestring(const char *format, ...) va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); /* If the string is longer than buffersize, vsnprintf returns * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ while(len > buffercapacity || len < 0) @@ -1383,10 +1384,11 @@ void pp_writestring(const char *format, ...) return; } buffer = new_buffer; + va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); } - va_end(valist); wpp_callbacks->write(buffer, len); } @@ -1396,7 +1398,7 @@ void pp_writestring(const char *format, ...) * The scanner starts here ************************************************************************** */ -#line 1400 "lex.yy.c" +#line 1402 "ppl.yy.c" #define INITIAL 0 #define pp_pp 1 @@ -1615,7 +1617,7 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 364 "ppl.l" +#line 366 "ppl.l" /* * Catch line-continuations. @@ -1629,7 +1631,7 @@ YY_DECL /* * Detect the leading # of a preprocessor directive. */ -#line 1633 "lex.yy.c" +#line 1635 "ppl.yy.c" if ( !(yy_init) ) { @@ -1711,7 +1713,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 377 "ppl.l" +#line 379 "ppl.l" pp_incl_state.seen_junk++; yy_push_state(pp_pp); YY_BREAK /* @@ -1719,104 +1721,104 @@ pp_incl_state.seen_junk++; yy_push_state(pp_pp); */ case 2: YY_RULE_SETUP -#line 382 "ppl.l" +#line 384 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);} YY_BREAK case 3: YY_RULE_SETUP -#line 383 "ppl.l" +#line 385 "ppl.l" yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol); YY_BREAK case 4: YY_RULE_SETUP -#line 384 "ppl.l" +#line 386 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR; YY_BREAK case 5: YY_RULE_SETUP -#line 385 "ppl.l" +#line 387 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING; YY_BREAK case 6: YY_RULE_SETUP -#line 386 "ppl.l" +#line 388 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA; YY_BREAK case 7: YY_RULE_SETUP -#line 387 "ppl.l" +#line 389 "ppl.l" yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT; YY_BREAK case 8: YY_RULE_SETUP -#line 388 "ppl.l" +#line 390 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);} YY_BREAK case 9: YY_RULE_SETUP -#line 389 "ppl.l" +#line 391 "ppl.l" yy_pp_state(pp_ifd); return tIFDEF; YY_BREAK case 10: YY_RULE_SETUP -#line 390 "ppl.l" +#line 392 "ppl.l" pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF; YY_BREAK case 11: YY_RULE_SETUP -#line 391 "ppl.l" +#line 393 "ppl.l" yy_pp_state(pp_if); return tIF; YY_BREAK case 12: YY_RULE_SETUP -#line 392 "ppl.l" +#line 394 "ppl.l" yy_pp_state(pp_if); return tELIF; YY_BREAK case 13: YY_RULE_SETUP -#line 393 "ppl.l" +#line 395 "ppl.l" yy_pp_state(pp_endif); return tELSE; YY_BREAK case 14: YY_RULE_SETUP -#line 394 "ppl.l" +#line 396 "ppl.l" yy_pp_state(pp_endif); return tENDIF; YY_BREAK case 15: YY_RULE_SETUP -#line 395 "ppl.l" +#line 397 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);} YY_BREAK case 16: YY_RULE_SETUP -#line 396 "ppl.l" +#line 398 "ppl.l" if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);} YY_BREAK case 17: YY_RULE_SETUP -#line 397 "ppl.l" +#line 399 "ppl.l" ppy_error("Invalid preprocessor token '%s'", ppy_text); YY_BREAK case 18: /* rule 18 can match eol */ YY_RULE_SETUP -#line 398 "ppl.l" +#line 400 "ppl.l" newline(1); yy_pop_state(); return tNL; /* This could be the null-token */ YY_BREAK case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 399 "ppl.l" +#line 401 "ppl.l" newline(0); YY_BREAK case 20: YY_RULE_SETUP -#line 400 "ppl.l" +#line 402 "ppl.l" ppy_error("Preprocessor junk '%s'", ppy_text); YY_BREAK case 21: YY_RULE_SETUP -#line 401 "ppl.l" +#line 403 "ppl.l" return *ppy_text; YY_BREAK /* @@ -1824,39 +1826,39 @@ return *ppy_text; */ case 22: YY_RULE_SETUP -#line 406 "ppl.l" +#line 408 "ppl.l" return make_number(10, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 23: YY_RULE_SETUP -#line 407 "ppl.l" +#line 409 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs); YY_BREAK case 24: YY_RULE_SETUP -#line 408 "ppl.l" +#line 410 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 25: YY_RULE_SETUP -#line 409 "ppl.l" +#line 411 "ppl.l" ; YY_BREAK case 26: /* rule 26 can match eol */ YY_RULE_SETUP -#line 410 "ppl.l" +#line 412 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 27: /* rule 27 can match eol */ YY_RULE_SETUP -#line 411 "ppl.l" +#line 413 "ppl.l" newline(0); YY_BREAK case 28: YY_RULE_SETUP -#line 412 "ppl.l" +#line 414 "ppl.l" ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line"); YY_BREAK /* @@ -1864,24 +1866,24 @@ ppy_error(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing */ case 29: YY_RULE_SETUP -#line 417 "ppl.l" +#line 419 "ppl.l" ; YY_BREAK case 30: /* rule 30 can match eol */ YY_RULE_SETUP -#line 418 "ppl.l" +#line 420 "ppl.l" newline(1); YY_BREAK case 31: /* rule 31 can match eol */ YY_RULE_SETUP -#line 419 "ppl.l" +#line 421 "ppl.l" newline(0); YY_BREAK case 32: YY_RULE_SETUP -#line 420 "ppl.l" +#line 422 "ppl.l" ; YY_BREAK /* @@ -1892,109 +1894,109 @@ YY_RULE_SETUP */ case 33: YY_RULE_SETUP -#line 429 "ppl.l" +#line 431 "ppl.l" return make_number(8, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 34: YY_RULE_SETUP -#line 430 "ppl.l" +#line 432 "ppl.l" ppy_error("Invalid octal digit"); YY_BREAK case 35: YY_RULE_SETUP -#line 431 "ppl.l" +#line 433 "ppl.l" return make_number(10, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 36: YY_RULE_SETUP -#line 432 "ppl.l" +#line 434 "ppl.l" return make_number(16, &ppy_lval, ppy_text, ppy_leng); YY_BREAK case 37: YY_RULE_SETUP -#line 433 "ppl.l" +#line 435 "ppl.l" ppy_error("Invalid hex number"); YY_BREAK case 38: YY_RULE_SETUP -#line 434 "ppl.l" +#line 436 "ppl.l" yy_push_state(pp_defined); return tDEFINED; YY_BREAK case 39: YY_RULE_SETUP -#line 435 "ppl.l" +#line 437 "ppl.l" return tLSHIFT; YY_BREAK case 40: YY_RULE_SETUP -#line 436 "ppl.l" +#line 438 "ppl.l" return tRSHIFT; YY_BREAK case 41: YY_RULE_SETUP -#line 437 "ppl.l" +#line 439 "ppl.l" return tLOGAND; YY_BREAK case 42: YY_RULE_SETUP -#line 438 "ppl.l" +#line 440 "ppl.l" return tLOGOR; YY_BREAK case 43: YY_RULE_SETUP -#line 439 "ppl.l" +#line 441 "ppl.l" return tEQ; YY_BREAK case 44: YY_RULE_SETUP -#line 440 "ppl.l" +#line 442 "ppl.l" return tNE; YY_BREAK case 45: YY_RULE_SETUP -#line 441 "ppl.l" +#line 443 "ppl.l" return tLTE; YY_BREAK case 46: YY_RULE_SETUP -#line 442 "ppl.l" +#line 444 "ppl.l" return tGTE; YY_BREAK case 47: /* rule 47 can match eol */ YY_RULE_SETUP -#line 443 "ppl.l" +#line 445 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 48: /* rule 48 can match eol */ YY_RULE_SETUP -#line 444 "ppl.l" +#line 446 "ppl.l" newline(0); YY_BREAK case 49: YY_RULE_SETUP -#line 445 "ppl.l" +#line 447 "ppl.l" ppy_error("Junk in conditional expression"); YY_BREAK case 50: YY_RULE_SETUP -#line 446 "ppl.l" +#line 448 "ppl.l" ; YY_BREAK case 51: YY_RULE_SETUP -#line 447 "ppl.l" +#line 449 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 52: YY_RULE_SETUP -#line 448 "ppl.l" +#line 450 "ppl.l" ppy_error("String constants not allowed in conditionals"); YY_BREAK case 53: YY_RULE_SETUP -#line 449 "ppl.l" +#line 451 "ppl.l" return *ppy_text; YY_BREAK /* @@ -2003,29 +2005,29 @@ return *ppy_text; */ case 54: YY_RULE_SETUP -#line 455 "ppl.l" +#line 457 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 55: YY_RULE_SETUP -#line 456 "ppl.l" +#line 458 "ppl.l" ; YY_BREAK case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 457 "ppl.l" +#line 459 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 458 "ppl.l" +#line 460 "ppl.l" newline(0); YY_BREAK case 58: YY_RULE_SETUP -#line 459 "ppl.l" +#line 461 "ppl.l" ppy_error("Identifier expected"); YY_BREAK /* @@ -2033,24 +2035,24 @@ ppy_error("Identifier expected"); */ case 59: YY_RULE_SETUP -#line 464 "ppl.l" +#line 466 "ppl.l" ; YY_BREAK case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 465 "ppl.l" +#line 467 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 466 "ppl.l" +#line 468 "ppl.l" newline(0); YY_BREAK case 62: YY_RULE_SETUP -#line 467 "ppl.l" +#line 469 "ppl.l" ppy_error("Garbage after #else or #endif."); YY_BREAK /* @@ -2060,29 +2062,29 @@ ppy_error("Garbage after #else or #endif."); */ case 63: YY_RULE_SETUP -#line 474 "ppl.l" +#line 476 "ppl.l" yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 64: YY_RULE_SETUP -#line 475 "ppl.l" +#line 477 "ppl.l" ; YY_BREAK case 65: YY_RULE_SETUP -#line 476 "ppl.l" +#line 478 "ppl.l" return *ppy_text; YY_BREAK case 66: /* rule 66 can match eol */ YY_RULE_SETUP -#line 477 "ppl.l" +#line 479 "ppl.l" newline(0); YY_BREAK case 67: /* rule 67 can match eol */ YY_RULE_SETUP -#line 478 "ppl.l" +#line 480 "ppl.l" ppy_error("Identifier expected"); YY_BREAK /* @@ -2093,30 +2095,30 @@ ppy_error("Identifier expected"); */ case 68: YY_RULE_SETUP -#line 486 "ppl.l" +#line 488 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 69: YY_RULE_SETUP -#line 487 "ppl.l" +#line 489 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 70: /* rule 70 can match eol */ YY_RULE_SETUP -#line 488 "ppl.l" +#line 490 "ppl.l" if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; } YY_BREAK case 71: /* rule 71 can match eol */ YY_RULE_SETUP -#line 489 "ppl.l" +#line 491 "ppl.l" newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; } YY_BREAK case 72: /* rule 72 can match eol */ YY_RULE_SETUP -#line 490 "ppl.l" +#line 492 "ppl.l" newline(0); YY_BREAK /* @@ -2124,29 +2126,29 @@ newline(0); */ case 73: YY_RULE_SETUP -#line 495 "ppl.l" +#line 497 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; YY_BREAK case 74: YY_RULE_SETUP -#line 496 "ppl.l" +#line 498 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; YY_BREAK case 75: YY_RULE_SETUP -#line 497 "ppl.l" +#line 499 "ppl.l" ; YY_BREAK case 76: /* rule 76 can match eol */ YY_RULE_SETUP -#line 498 "ppl.l" +#line 500 "ppl.l" newline(0); YY_BREAK case 77: /* rule 77 can match eol */ YY_RULE_SETUP -#line 499 "ppl.l" +#line 501 "ppl.l" perror("Identifier expected"); YY_BREAK /* @@ -2154,41 +2156,41 @@ perror("Identifier expected"); */ case 78: YY_RULE_SETUP -#line 504 "ppl.l" +#line 506 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 79: /* rule 79 can match eol */ YY_RULE_SETUP -#line 505 "ppl.l" +#line 507 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 80: /* rule 80 can match eol */ YY_RULE_SETUP -#line 506 "ppl.l" +#line 508 "ppl.l" newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; YY_BREAK case 81: /* rule 81 can match eol */ YY_RULE_SETUP -#line 507 "ppl.l" +#line 509 "ppl.l" newline(0); YY_BREAK case 82: /* rule 82 can match eol */ YY_RULE_SETUP -#line 508 "ppl.l" +#line 510 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 83: YY_RULE_SETUP -#line 509 "ppl.l" +#line 511 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 84: YY_RULE_SETUP -#line 510 "ppl.l" +#line 512 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK /* @@ -2196,39 +2198,39 @@ new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); */ case 85: YY_RULE_SETUP -#line 515 "ppl.l" +#line 517 "ppl.l" yy_pp_state(pp_mbody); return tMACROEND; YY_BREAK case 86: YY_RULE_SETUP -#line 516 "ppl.l" +#line 518 "ppl.l" ; YY_BREAK case 87: YY_RULE_SETUP -#line 517 "ppl.l" +#line 519 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 88: YY_RULE_SETUP -#line 518 "ppl.l" +#line 520 "ppl.l" return ','; YY_BREAK case 89: YY_RULE_SETUP -#line 519 "ppl.l" +#line 521 "ppl.l" return tELIPSIS; YY_BREAK case 90: /* rule 90 can match eol */ YY_RULE_SETUP -#line 520 "ppl.l" +#line 522 "ppl.l" ppy_error("Argument identifier expected"); YY_BREAK case 91: /* rule 91 can match eol */ YY_RULE_SETUP -#line 521 "ppl.l" +#line 523 "ppl.l" newline(0); YY_BREAK /* @@ -2236,60 +2238,60 @@ newline(0); */ case 92: YY_RULE_SETUP -#line 526 "ppl.l" +#line 528 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 93: YY_RULE_SETUP -#line 527 "ppl.l" +#line 529 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; YY_BREAK case 94: YY_RULE_SETUP -#line 528 "ppl.l" +#line 530 "ppl.l" return tCONCAT; YY_BREAK case 95: YY_RULE_SETUP -#line 529 "ppl.l" +#line 531 "ppl.l" return tSTRINGIZE; YY_BREAK case 96: YY_RULE_SETUP -#line 530 "ppl.l" +#line 532 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 97: YY_RULE_SETUP -#line 531 "ppl.l" +#line 533 "ppl.l" ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; YY_BREAK case 98: /* rule 98 can match eol */ YY_RULE_SETUP -#line 532 "ppl.l" +#line 534 "ppl.l" newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL; YY_BREAK case 99: /* rule 99 can match eol */ YY_RULE_SETUP -#line 533 "ppl.l" +#line 535 "ppl.l" newline(0); YY_BREAK case 100: /* rule 100 can match eol */ YY_RULE_SETUP -#line 534 "ppl.l" +#line 536 "ppl.l" newline(1); yy_pop_state(); return tNL; YY_BREAK case 101: YY_RULE_SETUP -#line 535 "ppl.l" +#line 537 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 102: YY_RULE_SETUP -#line 536 "ppl.l" +#line 538 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK /* @@ -2306,13 +2308,13 @@ case 103: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up ppy_text again */ YY_RULE_SETUP -#line 547 "ppl.l" +#line 549 "ppl.l" yy_pp_state(pp_macscan); YY_BREAK case 104: /* rule 104 can match eol */ YY_RULE_SETUP -#line 548 "ppl.l" +#line 550 "ppl.l" { if(yy_top_state() != pp_macscan) newline(0); @@ -2321,12 +2323,12 @@ YY_RULE_SETUP case 105: /* rule 105 can match eol */ YY_RULE_SETUP -#line 552 "ppl.l" +#line 554 "ppl.l" newline(0); YY_BREAK case 106: YY_RULE_SETUP -#line 553 "ppl.l" +#line 555 "ppl.l" { macexpstackentry_t *mac = pop_macro(); yy_pop_state(); @@ -2341,7 +2343,7 @@ YY_RULE_SETUP */ case 107: YY_RULE_SETUP -#line 565 "ppl.l" +#line 567 "ppl.l" { if(++MACROPARENTHESES() > 1) add_text_to_macro(ppy_text, ppy_leng); @@ -2349,7 +2351,7 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 569 "ppl.l" +#line 571 "ppl.l" { if(--MACROPARENTHESES() == 0) { @@ -2362,7 +2364,7 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 578 "ppl.l" +#line 580 "ppl.l" { if(MACROPARENTHESES() > 1) add_text_to_macro(ppy_text, ppy_leng); @@ -2372,34 +2374,34 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 584 "ppl.l" +#line 586 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 111: YY_RULE_SETUP -#line 585 "ppl.l" +#line 587 "ppl.l" new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 112: YY_RULE_SETUP -#line 586 "ppl.l" +#line 588 "ppl.l" yy_push_state(pp_comment); add_text_to_macro(" ", 1); YY_BREAK case 113: /* rule 113 can match eol */ YY_RULE_SETUP -#line 587 "ppl.l" +#line 589 "ppl.l" pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng); YY_BREAK case 114: YY_RULE_SETUP -#line 588 "ppl.l" +#line 590 "ppl.l" add_text_to_macro(ppy_text, ppy_leng); YY_BREAK case 115: /* rule 115 can match eol */ YY_RULE_SETUP -#line 589 "ppl.l" +#line 591 "ppl.l" newline(0); YY_BREAK /* @@ -2407,23 +2409,23 @@ newline(0); */ case 116: YY_RULE_SETUP -#line 594 "ppl.l" +#line 596 "ppl.l" yy_push_state(pp_comment); YY_BREAK case 117: YY_RULE_SETUP -#line 595 "ppl.l" +#line 597 "ppl.l" ; YY_BREAK case 118: /* rule 118 can match eol */ YY_RULE_SETUP -#line 596 "ppl.l" +#line 598 "ppl.l" newline(0); YY_BREAK case 119: YY_RULE_SETUP -#line 597 "ppl.l" +#line 599 "ppl.l" yy_pop_state(); YY_BREAK /* @@ -2431,7 +2433,7 @@ yy_pop_state(); */ case 120: YY_RULE_SETUP -#line 602 "ppl.l" +#line 604 "ppl.l" { if(ppy_text[ppy_leng-1] == '\\') ppy_warning("C++ style comment ends with an escaped newline (escape ignored)"); @@ -2442,22 +2444,22 @@ YY_RULE_SETUP */ case 121: YY_RULE_SETUP -#line 610 "ppl.l" +#line 612 "ppl.l" pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs); YY_BREAK case 122: YY_RULE_SETUP -#line 611 "ppl.l" +#line 613 "ppl.l" pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs); YY_BREAK case 123: YY_RULE_SETUP -#line 612 "ppl.l" +#line 614 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 124: YY_RULE_SETUP -#line 613 "ppl.l" +#line 615 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2481,12 +2483,12 @@ YY_RULE_SETUP YY_BREAK case 125: YY_RULE_SETUP -#line 633 "ppl.l" +#line 635 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 126: YY_RULE_SETUP -#line 634 "ppl.l" +#line 636 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2504,12 +2506,12 @@ YY_RULE_SETUP YY_BREAK case 127: YY_RULE_SETUP -#line 648 "ppl.l" +#line 650 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 128: YY_RULE_SETUP -#line 649 "ppl.l" +#line 651 "ppl.l" { add_string(ppy_text, ppy_leng); yy_pop_state(); @@ -2520,7 +2522,7 @@ YY_RULE_SETUP case 129: /* rule 129 can match eol */ YY_RULE_SETUP -#line 655 "ppl.l" +#line 657 "ppl.l" { /* * This is tricky; we need to remove the line-continuation @@ -2548,17 +2550,17 @@ YY_RULE_SETUP YY_BREAK case 130: YY_RULE_SETUP -#line 679 "ppl.l" +#line 681 "ppl.l" add_string(ppy_text, ppy_leng); YY_BREAK case 131: /* rule 131 can match eol */ YY_RULE_SETUP -#line 680 "ppl.l" +#line 682 "ppl.l" { newline(1); add_string(ppy_text, ppy_leng); - ppy_warning("Newline in string constant encounterd (started line %d)", string_start()); + ppy_warning("Newline in string constant encountered (started line %d)", string_start()); } YY_BREAK /* @@ -2566,7 +2568,7 @@ YY_RULE_SETUP */ case 132: YY_RULE_SETUP -#line 689 "ppl.l" +#line 691 "ppl.l" { pp_entry_t *ppp; pp_incl_state.seen_junk++; @@ -2615,29 +2617,29 @@ YY_RULE_SETUP */ case 133: YY_RULE_SETUP -#line 735 "ppl.l" +#line 737 "ppl.l" pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); YY_BREAK case 134: YY_RULE_SETUP -#line 736 "ppl.l" +#line 738 "ppl.l" put_buffer(ppy_text, ppy_leng); YY_BREAK case 135: /* rule 135 can match eol */ YY_RULE_SETUP -#line 737 "ppl.l" +#line 739 "ppl.l" newline(1); YY_BREAK case 136: /* rule 136 can match eol */ YY_RULE_SETUP -#line 738 "ppl.l" +#line 740 "ppl.l" newline(0); YY_BREAK case 137: YY_RULE_SETUP -#line 739 "ppl.l" +#line 741 "ppl.l" pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); YY_BREAK /* @@ -2647,12 +2649,12 @@ pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng); case 138: /* rule 138 can match eol */ YY_RULE_SETUP -#line 745 "ppl.l" +#line 747 "ppl.l" put_buffer(ppy_text, ppy_leng); YY_BREAK case 139: YY_RULE_SETUP -#line 747 "ppl.l" +#line 749 "ppl.l" { ppy_lval.cptr=pp_xstrdup(ppy_text); yy_pop_state(); @@ -2661,12 +2663,12 @@ YY_RULE_SETUP YY_BREAK case 140: YY_RULE_SETUP -#line 753 "ppl.l" +#line 755 "ppl.l" ; YY_BREAK case 141: YY_RULE_SETUP -#line 755 "ppl.l" +#line 757 "ppl.l" { new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs); } @@ -2677,7 +2679,7 @@ YY_RULE_SETUP */ case 142: YY_RULE_SETUP -#line 763 "ppl.l" +#line 765 "ppl.l" pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text); YY_BREAK case YY_STATE_EOF(INITIAL): @@ -2702,7 +2704,7 @@ case YY_STATE_EOF(pp_line): case YY_STATE_EOF(pp_defined): case YY_STATE_EOF(pp_ignore): case YY_STATE_EOF(RCINCL): -#line 765 "ppl.l" +#line 767 "ppl.l" { YY_BUFFER_STATE b = YY_CURRENT_BUFFER; bufferstackentry_t *bep = pop_buffer(); @@ -2713,7 +2715,10 @@ case YY_STATE_EOF(RCINCL): if(!bep) { if(YY_START != INITIAL) + { ppy_error("Unexpected end of file during preprocessing"); + BEGIN(INITIAL); + } yyterminate(); } else if(bep->should_pop == 2) @@ -2727,10 +2732,10 @@ case YY_STATE_EOF(RCINCL): YY_BREAK case 143: YY_RULE_SETUP -#line 787 "ppl.l" +#line 792 "ppl.l" ECHO; YY_BREAK -#line 2734 "lex.yy.c" +#line 2739 "ppl.yy.c" case YY_END_OF_BUFFER: { @@ -3734,7 +3739,7 @@ void ppy_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 787 "ppl.l" +#line 792 "ppl.l" /* @@ -4548,7 +4553,7 @@ void pp_do_include(char *fname, int type) /* Undo the effect of the quotation */ fname[n-1] = '\0'; - if((fp = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) { ppy_error("Unable to open include file %s", fname+1); return; diff --git a/reactos/tools/wpp/ppy.tab.c b/reactos/tools/wpp/ppy.tab.c index 53dc231772c..fa5816584c5 100644 --- a/reactos/tools/wpp/ppy.tab.c +++ b/reactos/tools/wpp/ppy.tab.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.2" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -74,7 +73,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 30 "ppy.y" #include "config.h" @@ -172,8 +171,8 @@ static int nmacro_args; -/* Line 189 of yacc.c */ -#line 177 "ppy.tab.c" +/* Line 268 of yacc.c */ +#line 176 "ppy.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -252,7 +251,7 @@ static int nmacro_args; typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 126 "ppy.y" int sint; @@ -269,8 +268,8 @@ typedef union YYSTYPE -/* Line 214 of yacc.c */ -#line 274 "ppy.tab.c" +/* Line 293 of yacc.c */ +#line 273 "ppy.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -281,8 +280,8 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 286 "ppy.tab.c" +/* Line 343 of yacc.c */ +#line 285 "ppy.tab.c" #ifdef short # undef short @@ -385,11 +384,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -412,24 +411,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -458,23 +457,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -494,6 +477,26 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ @@ -678,8 +681,8 @@ static const yytype_uint8 yyr2[] = 2, 2, 2, 3, 5 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -740,8 +743,7 @@ static const yytype_int16 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { @@ -778,6 +780,12 @@ static const yytype_uint8 yytable[] = 147, 148, 152, 149 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-27)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_uint8 yycheck[] = { 8, 24, 28, 14, 15, 16, 25, 10, 19, 28, @@ -868,7 +876,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -910,19 +917,10 @@ while (YYID (0)) #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -1114,7 +1112,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1217,115 +1214,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1358,6 +1382,7 @@ yydestruct (yymsg, yytype, yyvaluep) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1384,10 +1409,9 @@ YYSTYPE yylval; int yynerrs; - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1411,8 +1435,6 @@ yyparse () #endif #endif { - - int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1567,7 +1589,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1598,8 +1620,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1654,35 +1676,35 @@ yyreduce: { case 4: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 186 "ppy.y" - { pp_do_include((yyvsp[(2) - (3)].cptr), 1); ;} + { pp_do_include((yyvsp[(2) - (3)].cptr), 1); } break; case 5: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 187 "ppy.y" - { pp_do_include((yyvsp[(2) - (3)].cptr), 0); ;} + { pp_do_include((yyvsp[(2) - (3)].cptr), 0); } break; case 6: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 188 "ppy.y" - { pp_next_if_state(boolean(&(yyvsp[(2) - (3)].cval))); ;} + { pp_next_if_state(boolean(&(yyvsp[(2) - (3)].cval))); } break; case 7: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 189 "ppy.y" - { pp_next_if_state(pplookup((yyvsp[(2) - (3)].cptr)) != NULL); free((yyvsp[(2) - (3)].cptr)); ;} + { pp_next_if_state(pplookup((yyvsp[(2) - (3)].cptr)) != NULL); free((yyvsp[(2) - (3)].cptr)); } break; case 8: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 190 "ppy.y" { int t = pplookup((yyvsp[(2) - (3)].cptr)) == NULL; @@ -1703,12 +1725,12 @@ yyreduce: if(pp_status.debug) fprintf(stderr, "tIFNDEF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); - ;} + } break; case 9: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 210 "ppy.y" { pp_if_state_t s = pp_pop_if(); @@ -1733,12 +1755,12 @@ yyreduce: default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); } - ;} + } break; case 10: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 234 "ppy.y" { pp_if_state_t s = pp_pop_if(); @@ -1765,12 +1787,12 @@ yyreduce: default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); } - ;} + } break; case 11: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 260 "ppy.y" { if(pp_pop_if() != if_error) @@ -1788,105 +1810,105 @@ yyreduce: fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } - ;} + } break; case 12: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 277 "ppy.y" - { pp_del_define((yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} + { pp_del_define((yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); } break; case 13: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 278 "ppy.y" - { pp_add_define((yyvsp[(1) - (3)].cptr), (yyvsp[(2) - (3)].cptr)); free((yyvsp[(1) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} + { pp_add_define((yyvsp[(1) - (3)].cptr), (yyvsp[(2) - (3)].cptr)); free((yyvsp[(1) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); } break; case 14: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 279 "ppy.y" { pp_add_macro((yyvsp[(1) - (6)].cptr), macro_args, nmacro_args, (yyvsp[(5) - (6)].mtext)); - ;} + } break; case 15: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 282 "ppy.y" - { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); ;} + { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); } break; case 16: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 283 "ppy.y" - { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); ;} + { if((yyvsp[(3) - (4)].cptr)) pp_writestring("# %d %s\n", (yyvsp[(2) - (4)].sint) , (yyvsp[(3) - (4)].cptr)); free((yyvsp[(3) - (4)].cptr)); } break; case 17: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 285 "ppy.y" - { if((yyvsp[(3) - (5)].cptr)) pp_writestring("# %d %s %d\n", (yyvsp[(2) - (5)].sint), (yyvsp[(3) - (5)].cptr), (yyvsp[(4) - (5)].sint)); free((yyvsp[(3) - (5)].cptr)); ;} + { if((yyvsp[(3) - (5)].cptr)) pp_writestring("# %d %s %d\n", (yyvsp[(2) - (5)].sint), (yyvsp[(3) - (5)].cptr), (yyvsp[(4) - (5)].sint)); free((yyvsp[(3) - (5)].cptr)); } break; case 18: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 287 "ppy.y" - { if((yyvsp[(3) - (6)].cptr)) pp_writestring("# %d %s %d %d\n", (yyvsp[(2) - (6)].sint) ,(yyvsp[(3) - (6)].cptr), (yyvsp[(4) - (6)].sint), (yyvsp[(5) - (6)].sint)); free((yyvsp[(3) - (6)].cptr)); ;} + { if((yyvsp[(3) - (6)].cptr)) pp_writestring("# %d %s %d %d\n", (yyvsp[(2) - (6)].sint) ,(yyvsp[(3) - (6)].cptr), (yyvsp[(4) - (6)].sint), (yyvsp[(5) - (6)].sint)); free((yyvsp[(3) - (6)].cptr)); } break; case 19: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 289 "ppy.y" - { if((yyvsp[(3) - (7)].cptr)) pp_writestring("# %d %s %d %d %d\n", (yyvsp[(2) - (7)].sint) ,(yyvsp[(3) - (7)].cptr) ,(yyvsp[(4) - (7)].sint) ,(yyvsp[(5) - (7)].sint), (yyvsp[(6) - (7)].sint)); free((yyvsp[(3) - (7)].cptr)); ;} + { if((yyvsp[(3) - (7)].cptr)) pp_writestring("# %d %s %d %d %d\n", (yyvsp[(2) - (7)].sint) ,(yyvsp[(3) - (7)].cptr) ,(yyvsp[(4) - (7)].sint) ,(yyvsp[(5) - (7)].sint), (yyvsp[(6) - (7)].sint)); free((yyvsp[(3) - (7)].cptr)); } break; case 20: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 291 "ppy.y" - { if((yyvsp[(3) - (8)].cptr)) pp_writestring("# %d %s %d %d %d %d\n", (yyvsp[(2) - (8)].sint) ,(yyvsp[(3) - (8)].cptr) ,(yyvsp[(4) - (8)].sint) ,(yyvsp[(5) - (8)].sint), (yyvsp[(6) - (8)].sint), (yyvsp[(7) - (8)].sint)); free((yyvsp[(3) - (8)].cptr)); ;} + { if((yyvsp[(3) - (8)].cptr)) pp_writestring("# %d %s %d %d %d %d\n", (yyvsp[(2) - (8)].sint) ,(yyvsp[(3) - (8)].cptr) ,(yyvsp[(4) - (8)].sint) ,(yyvsp[(5) - (8)].sint), (yyvsp[(6) - (8)].sint), (yyvsp[(7) - (8)].sint)); free((yyvsp[(3) - (8)].cptr)); } break; case 22: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 293 "ppy.y" - { ppy_error("#error directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} + { ppy_error("#error directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); } break; case 23: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 294 "ppy.y" - { ppy_warning("#warning directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} + { ppy_warning("#warning directive: '%s'", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); } break; case 24: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 295 "ppy.y" - { pp_writestring("#pragma %s\n", (yyvsp[(2) - (3)].cptr) ? (yyvsp[(2) - (3)].cptr) : ""); free((yyvsp[(2) - (3)].cptr)); ;} + { pp_writestring("#pragma %s\n", (yyvsp[(2) - (3)].cptr) ? (yyvsp[(2) - (3)].cptr) : ""); free((yyvsp[(2) - (3)].cptr)); } break; case 25: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 296 "ppy.y" - { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); ;} + { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", (yyvsp[(2) - (3)].cptr)); free((yyvsp[(2) - (3)].cptr)); } break; case 26: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 297 "ppy.y" { if((yyvsp[(2) - (2)].cptr)) @@ -1900,185 +1922,185 @@ yyreduce: } free((yyvsp[(2) - (2)].cptr)); } - ;} + } break; case 27: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 310 "ppy.y" { pp_do_include((yyvsp[(2) - (2)].cptr),1); - ;} + } break; case 28: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 316 "ppy.y" - { (yyval.cptr) = NULL; ;} + { (yyval.cptr) = NULL; } break; case 29: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 317 "ppy.y" - { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); } break; case 30: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 320 "ppy.y" - { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); } break; case 31: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 321 "ppy.y" - { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); } break; case 32: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 322 "ppy.y" - { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); ;} + { (yyval.cptr) = (yyvsp[(1) - (1)].cptr); } break; case 33: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 323 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); } break; case 34: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 324 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); } break; case 35: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 325 "ppy.y" - { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); ;} + { (yyval.cptr) = merge_text((yyvsp[(1) - (2)].cptr), (yyvsp[(2) - (2)].cptr)); } break; case 36: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 328 "ppy.y" - { macro_args = NULL; nmacro_args = 0; ;} + { macro_args = NULL; nmacro_args = 0; } break; case 37: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 331 "ppy.y" - { (yyval.sint) = 0; macro_args = NULL; nmacro_args = 0; ;} + { (yyval.sint) = 0; macro_args = NULL; nmacro_args = 0; } break; case 38: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 332 "ppy.y" - { (yyval.sint) = nmacro_args; ;} + { (yyval.sint) = nmacro_args; } break; case 39: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 335 "ppy.y" - { (yyval.marg) = (yyvsp[(1) - (1)].marg); ;} + { (yyval.marg) = (yyvsp[(1) - (1)].marg); } break; case 40: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 336 "ppy.y" - { (yyval.marg) = add_new_marg(NULL, arg_list); nmacro_args *= -1; ;} + { (yyval.marg) = add_new_marg(NULL, arg_list); nmacro_args *= -1; } break; case 41: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 339 "ppy.y" - { (yyval.marg) = add_new_marg((yyvsp[(3) - (3)].cptr), arg_single); ;} + { (yyval.marg) = add_new_marg((yyvsp[(3) - (3)].cptr), arg_single); } break; case 42: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 340 "ppy.y" - { (yyval.marg) = add_new_marg((yyvsp[(1) - (1)].cptr), arg_single); ;} + { (yyval.marg) = add_new_marg((yyvsp[(1) - (1)].cptr), arg_single); } break; case 43: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 344 "ppy.y" - { (yyval.mtext) = NULL; ;} + { (yyval.mtext) = NULL; } break; case 44: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 345 "ppy.y" { for((yyval.mtext) = (yyvsp[(1) - (1)].mtext); (yyval.mtext) && (yyval.mtext)->prev; (yyval.mtext) = (yyval.mtext)->prev) ; - ;} + } break; case 45: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 351 "ppy.y" - { (yyval.mtext) = (yyvsp[(1) - (1)].mtext); ;} + { (yyval.mtext) = (yyvsp[(1) - (1)].mtext); } break; case 46: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 352 "ppy.y" - { (yyval.mtext) = combine_mtext((yyvsp[(1) - (2)].mtext), (yyvsp[(2) - (2)].mtext)); ;} + { (yyval.mtext) = combine_mtext((yyvsp[(1) - (2)].mtext), (yyvsp[(2) - (2)].mtext)); } break; case 47: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 355 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); } break; case 48: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 356 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); } break; case 49: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 357 "ppy.y" - { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); ;} + { (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); } break; case 50: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 358 "ppy.y" - { (yyval.mtext) = new_mtext(NULL, 0, exp_concat); ;} + { (yyval.mtext) = new_mtext(NULL, 0, exp_concat); } break; case 51: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 359 "ppy.y" { int mat = marg_index((yyvsp[(2) - (2)].cptr)); @@ -2086,12 +2108,12 @@ yyreduce: ppy_error("Stringification identifier must be an argument parameter"); else (yyval.mtext) = new_mtext(NULL, mat, exp_stringize); - ;} + } break; case 52: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 366 "ppy.y" { int mat = marg_index((yyvsp[(1) - (1)].cptr)); @@ -2099,239 +2121,250 @@ yyreduce: (yyval.mtext) = new_mtext(NULL, mat, exp_subst); else if((yyvsp[(1) - (1)].cptr)) (yyval.mtext) = new_mtext((yyvsp[(1) - (1)].cptr), 0, exp_text); - ;} + } break; case 53: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 375 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[(1) - (1)].sint); ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = (yyvsp[(1) - (1)].sint); } break; case 54: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 376 "ppy.y" - { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[(1) - (1)].uint); ;} + { (yyval.cval).type = cv_uint; (yyval.cval).val.ui = (yyvsp[(1) - (1)].uint); } break; case 55: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 377 "ppy.y" - { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[(1) - (1)].slong); ;} + { (yyval.cval).type = cv_slong; (yyval.cval).val.sl = (yyvsp[(1) - (1)].slong); } break; case 56: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 378 "ppy.y" - { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[(1) - (1)].ulong); ;} + { (yyval.cval).type = cv_ulong; (yyval.cval).val.ul = (yyvsp[(1) - (1)].ulong); } break; case 57: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 379 "ppy.y" - { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[(1) - (1)].sll); ;} + { (yyval.cval).type = cv_sll; (yyval.cval).val.sll = (yyvsp[(1) - (1)].sll); } break; case 58: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 380 "ppy.y" - { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[(1) - (1)].ull); ;} + { (yyval.cval).type = cv_ull; (yyval.cval).val.ull = (yyvsp[(1) - (1)].ull); } break; case 59: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 381 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(2) - (2)].cptr)) != NULL; ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(2) - (2)].cptr)) != NULL; } break; case 60: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 382 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(3) - (4)].cptr)) != NULL; ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = pplookup((yyvsp[(3) - (4)].cptr)) != NULL; } break; case 61: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 383 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = 0; ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = 0; } break; case 62: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 384 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) || boolean(&(yyvsp[(3) - (3)].cval)); ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) || boolean(&(yyvsp[(3) - (3)].cval)); } break; case 63: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 385 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) && boolean(&(yyvsp[(3) - (3)].cval)); ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = boolean(&(yyvsp[(1) - (3)].cval)) && boolean(&(yyvsp[(3) - (3)].cval)); } break; case 64: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 386 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ==) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ==); } break; case 65: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 387 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), !=) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), !=); } break; case 66: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 388 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <); } break; case 67: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 389 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >); } break; case 68: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 390 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <=) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <=); } break; case 69: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 391 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >=) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >=); } break; case 70: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 392 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), +) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), +); } break; case 71: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 393 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), -) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), -); } break; case 72: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 394 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ^) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), ^); } break; case 73: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 395 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), &) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), &); } break; case 74: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 396 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), |) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), |); } break; case 75: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 397 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), *) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), *); } break; case 76: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 398 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), /) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), /); } break; case 77: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 399 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <<) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), <<); } break; case 78: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 400 "ppy.y" - { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >>) ;} + { promote_equal_size(&(yyvsp[(1) - (3)].cval), &(yyvsp[(3) - (3)].cval)); BIN_OP((yyval.cval), (yyvsp[(1) - (3)].cval), (yyvsp[(3) - (3)].cval), >>); } break; case 79: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 401 "ppy.y" - { (yyval.cval) = (yyvsp[(2) - (2)].cval); ;} + { (yyval.cval) = (yyvsp[(2) - (2)].cval); } break; case 80: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 402 "ppy.y" - { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), -) ;} + { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), -); } break; case 81: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 403 "ppy.y" - { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), ~) ;} + { UNARY_OP((yyval.cval), (yyvsp[(2) - (2)].cval), ~); } break; case 82: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 404 "ppy.y" - { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[(2) - (2)].cval)); ;} + { (yyval.cval).type = cv_sint; (yyval.cval).val.si = !boolean(&(yyvsp[(2) - (2)].cval)); } break; case 83: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 405 "ppy.y" - { (yyval.cval) = (yyvsp[(2) - (3)].cval); ;} + { (yyval.cval) = (yyvsp[(2) - (3)].cval); } break; case 84: -/* Line 1464 of yacc.c */ +/* Line 1806 of yacc.c */ #line 406 "ppy.y" - { (yyval.cval) = boolean(&(yyvsp[(1) - (5)].cval)) ? (yyvsp[(3) - (5)].cval) : (yyvsp[(5) - (5)].cval); ;} + { (yyval.cval) = boolean(&(yyvsp[(1) - (5)].cval)) ? (yyvsp[(3) - (5)].cval) : (yyvsp[(5) - (5)].cval); } break; -/* Line 1464 of yacc.c */ -#line 2333 "ppy.tab.c" +/* Line 1806 of yacc.c */ +#line 2355 "ppy.tab.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2359,6 +2392,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2366,37 +2403,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2455,7 +2491,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -2514,8 +2550,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2540,7 +2581,7 @@ yyreturn: -/* Line 1684 of yacc.c */ +/* Line 2067 of yacc.c */ #line 409 "ppy.y" diff --git a/reactos/tools/wpp/ppy.tab.h b/reactos/tools/wpp/ppy.tab.h index 5225bed741d..2e02c24adaf 100644 --- a/reactos/tools/wpp/ppy.tab.h +++ b/reactos/tools/wpp/ppy.tab.h @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.5. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,7 +89,7 @@ typedef union YYSTYPE { -/* Line 1685 of yacc.c */ +/* Line 2068 of yacc.c */ #line 126 "ppy.y" int sint; @@ -107,8 +106,8 @@ typedef union YYSTYPE -/* Line 1685 of yacc.c */ -#line 112 "ppy.tab.h" +/* Line 2068 of yacc.c */ +#line 111 "ppy.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/reactos/tools/wpp/ppy.y b/reactos/tools/wpp/ppy.y index f2805e1247a..dbbe9722df8 100644 --- a/reactos/tools/wpp/ppy.y +++ b/reactos/tools/wpp/ppy.y @@ -383,24 +383,24 @@ pp_expr : tSINT { $$.type = cv_sint; $$.val.si = $1; } | tIDENT { $$.type = cv_sint; $$.val.si = 0; } | pp_expr tLOGOR pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) || boolean(&$3); } | pp_expr tLOGAND pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) && boolean(&$3); } - | pp_expr tEQ pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ==) } - | pp_expr tNE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, !=) } - | pp_expr '<' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <) } - | pp_expr '>' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >) } - | pp_expr tLTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <=) } - | pp_expr tGTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >=) } - | pp_expr '+' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, +) } - | pp_expr '-' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, -) } - | pp_expr '^' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ^) } - | pp_expr '&' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, &) } - | pp_expr '|' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, |) } - | pp_expr '*' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, *) } - | pp_expr '/' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, /) } - | pp_expr tLSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <<) } - | pp_expr tRSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >>) } + | pp_expr tEQ pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ==); } + | pp_expr tNE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, !=); } + | pp_expr '<' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <); } + | pp_expr '>' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >); } + | pp_expr tLTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <=); } + | pp_expr tGTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >=); } + | pp_expr '+' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, +); } + | pp_expr '-' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, -); } + | pp_expr '^' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ^); } + | pp_expr '&' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, &); } + | pp_expr '|' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, |); } + | pp_expr '*' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, *); } + | pp_expr '/' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, /); } + | pp_expr tLSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <<); } + | pp_expr tRSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >>); } | '+' pp_expr { $$ = $2; } - | '-' pp_expr { UNARY_OP($$, $2, -) } - | '~' pp_expr { UNARY_OP($$, $2, ~) } + | '-' pp_expr { UNARY_OP($$, $2, -); } + | '~' pp_expr { UNARY_OP($$, $2, ~); } | '!' pp_expr { $$.type = cv_sint; $$.val.si = !boolean(&$2); } | '(' pp_expr ')' { $$ = $2; } | pp_expr '?' pp_expr ':' pp_expr { $$ = boolean(&$1) ? $3 : $5; } diff --git a/reactos/tools/wpp/preproc.c b/reactos/tools/wpp/preproc.c index 2575b006d84..fd99167d9e6 100644 --- a/reactos/tools/wpp/preproc.c +++ b/reactos/tools/wpp/preproc.c @@ -115,7 +115,7 @@ char *pp_xstrdup(const char *str) return memcpy(s, str, len); } -static char *wpp_default_lookup(const char *name, const char *parent_name, +static char *wpp_default_lookup(const char *name, int type, const char *parent_name, char **include_path, int include_path_count) { char *cpy; @@ -144,7 +144,7 @@ static char *wpp_default_lookup(const char *name, const char *parent_name, } *cptr = '\0'; - if(parent_name) + if(type && parent_name) { /* Search directory of parent include and then -I path */ const char *p; @@ -507,17 +507,17 @@ int wpp_add_include_path(const char *path) char *wpp_find_include(const char *name, const char *parent_name) { - return wpp_default_lookup(name, parent_name, includepath, nincludepath); + return wpp_default_lookup(name, !!parent_name, parent_name, includepath, nincludepath); } -void *pp_open_include(const char *name, const char *parent_name, char **newpath) +void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath) { char *path; void *fp; - if (!(path = wpp_callbacks->lookup(name, parent_name, includepath, + if (!(path = wpp_callbacks->lookup(name, type, parent_name, includepath, nincludepath))) return NULL; - fp = wpp_callbacks->open(path, parent_name == NULL ? 1 : 0); + fp = wpp_callbacks->open(path, type); if (fp) { diff --git a/reactos/tools/wpp/wpp.c b/reactos/tools/wpp/wpp.c index 0c9c80852ea..66eb0261e4d 100644 --- a/reactos/tools/wpp/wpp.c +++ b/reactos/tools/wpp/wpp.c @@ -49,6 +49,16 @@ static void add_cmdline_defines(void) } } +static void del_cmdline_defines(void) +{ + struct define *def; + + for (def = cmdline_defines; def; def = def->next) + { + if (def->value) pp_del_define( def->name ); + } +} + static void add_special_defines(void) { time_t now = time(NULL); @@ -70,6 +80,14 @@ static void add_special_defines(void) ppp->type = def_special; } +static void del_special_defines(void) +{ + pp_del_define( "__DATE__" ); + pp_del_define( "__TIME__" ); + pp_del_define( "__FILE__" ); + pp_del_define( "__LINE__" ); +} + /* add a define to the preprocessor list */ int wpp_add_define( const char *name, const char *value ) @@ -182,6 +200,8 @@ int wpp_parse( const char *input, FILE *output ) else if (!(pp_status.file = wpp_callbacks->open(input, 1))) { ppy_error("Could not open %s\n", input); + del_special_defines(); + del_cmdline_defines(); pp_pop_define_state(); return 2; } @@ -198,6 +218,8 @@ int wpp_parse( const char *input, FILE *output ) if (input) wpp_callbacks->close(pp_status.file); /* Clean if_stack, it could remain dirty on errors */ while (pp_get_if_depth()) pp_pop_if(); + del_special_defines(); + del_cmdline_defines(); pp_pop_define_state(); return ret; } diff --git a/reactos/tools/wpp/wpp_private.h b/reactos/tools/wpp/wpp_private.h index 288d709be36..4e2aa5bffc4 100644 --- a/reactos/tools/wpp/wpp_private.h +++ b/reactos/tools/wpp/wpp_private.h @@ -207,7 +207,7 @@ void pp_pop_define_state(void); pp_entry_t *pp_add_define(const char *def, const char *text); pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp); void pp_del_define(const char *name); -void *pp_open_include(const char *name, const char *parent_name, char **newpath); +void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath); void pp_push_if(pp_if_state_t s); void pp_next_if_state(int); pp_if_state_t pp_pop_if(void);