diff --git a/src/parse-gram.c b/src/parse-gram.c index 517ef508..ca2ca699 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -177,7 +177,7 @@ static void handle_skeleton (location const *loc, char const *skel); /* Handle a %yacc directive. */ - static void handle_yacc (location const *loc, char const *directive); + static void handle_yacc (location const *loc); static void gram_error (location const *, char const *); @@ -912,10 +912,6 @@ tron (yyo); { fputs (((*yyvaluep).PERCENT_PURE_PARSER), yyo); } break; - case 39: /* "%yacc" */ - { fputs (((*yyvaluep).PERCENT_YACC), yyo); } - break; - case 40: /* "{...}" */ { fputs (((*yyvaluep).BRACED_CODE), yyo); } break; @@ -2119,7 +2115,7 @@ yyreduce: break; case 29: - { handle_yacc (&(yyloc), (yyvsp[0].PERCENT_YACC)); } + { handle_yacc (&(yyloc)); } break; case 30: @@ -3017,23 +3013,14 @@ handle_skeleton (location const *loc, char const *skel) static void -handle_yacc (location const *loc, char const *directive) +handle_yacc (location const *loc) { + const char *directive = "%yacc"; bison_directive (loc, directive); - bool warned = false; - if (location_empty (yacc_loc)) yacc_loc = *loc; else - { - duplicate_directive (directive, yacc_loc, *loc); - warned = true; - } - - if (!warned - && STRNEQ (directive, "%fixed-output-files") - && STRNEQ (directive, "%yacc")) - deprecated_directive (loc, directive, "%fixed-output-files"); + duplicate_directive (directive, yacc_loc, *loc); } diff --git a/src/parse-gram.h b/src/parse-gram.h index beb2f37c..76f3ae91 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -207,8 +207,6 @@ union GRAM_STYPE uniqstr PERCENT_NAME_PREFIX; /* "%pure-parser" */ uniqstr PERCENT_PURE_PARSER; - /* "%yacc" */ - uniqstr PERCENT_YACC; /* "[identifier]" */ uniqstr BRACKETED_ID; /* "identifier" */ diff --git a/src/parse-gram.y b/src/parse-gram.y index c7cc35fd..6a19e571 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -104,7 +104,7 @@ static void handle_skeleton (location const *loc, char const *skel); /* Handle a %yacc directive. */ - static void handle_yacc (location const *loc, char const *directive); + static void handle_yacc (location const *loc); static void gram_error (location const *, char const *); @@ -223,7 +223,7 @@ %type BRACKETED_ID ID ID_COLON PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX - PERCENT_PURE_PARSER PERCENT_YACC + PERCENT_PURE_PARSER TAG tag tag.opt variable %printer { fputs ($$, yyo); } %printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID @@ -352,7 +352,7 @@ prologue_declaration: | "%skeleton" STRING { handle_skeleton (&@2, $2); } | "%token-table" { token_table_flag = true; } | "%verbose" { report_flag |= report_states; } -| "%yacc" { handle_yacc (&@$, $1); } +| "%yacc" { handle_yacc (&@$); } | error ";" { current_class = unknown_sym; yyerrok; } | /*FIXME: Err? What is this horror doing here? */ ";" ; @@ -1024,23 +1024,14 @@ handle_skeleton (location const *loc, char const *skel) static void -handle_yacc (location const *loc, char const *directive) +handle_yacc (location const *loc) { + const char *directive = "%yacc"; bison_directive (loc, directive); - bool warned = false; - if (location_empty (yacc_loc)) yacc_loc = *loc; else - { - duplicate_directive (directive, yacc_loc, *loc); - warned = true; - } - - if (!warned - && STRNEQ (directive, "%fixed-output-files") - && STRNEQ (directive, "%yacc")) - deprecated_directive (loc, directive, "%fixed-output-files"); + duplicate_directive (directive, yacc_loc, *loc); } diff --git a/src/scan-gram.l b/src/scan-gram.l index 66a8caa7..70b45060 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -233,7 +233,6 @@ eqopt ({sp}=)? "%expect" return BISON_DIRECTIVE (EXPECT); "%expect-rr" return BISON_DIRECTIVE (EXPECT_RR); "%file-prefix" RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext)); - "%fixed-output-files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext)); "%initial-action" return BISON_DIRECTIVE (INITIAL_ACTION); "%glr-parser" return BISON_DIRECTIVE (GLR_PARSER); "%language" return BISON_DIRECTIVE (LANGUAGE); @@ -262,7 +261,7 @@ eqopt ({sp}=)? "%type" return PERCENT_TYPE; "%union" return PERCENT_UNION; "%verbose" return BISON_DIRECTIVE (VERBOSE); - "%yacc" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext)); + "%yacc" return PERCENT_YACC; /* Deprecated since Bison 2.3b (2008-05-27), but the warning is issued only since Bison 3.4. */ @@ -281,7 +280,7 @@ eqopt ({sp}=)? "%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext)); "%expect"[-_]"rr" DEPRECATED ("%expect-rr"); "%file-prefix"{eqopt} RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext)); - "%fixed"[-_]"output"[-_]"files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext)); + "%fixed"[-_]"output"[-_]"files" DEPRECATED ("%output \"y.tab.c\""); "%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec"); "%no"[-_]"lines" DEPRECATED ("%no-lines"); "%output"{eqopt} DEPRECATED ("%output"); diff --git a/tests/input.at b/tests/input.at index cc5e41fb..0d3a5917 100644 --- a/tests/input.at +++ b/tests/input.at @@ -2538,14 +2538,12 @@ fix-it:"input.y":{13:1-13:15}:"%file-prefix" input.y:14.1-16.5: warning: duplicate directive: '%file-prefix\n =' [-Wother] input.y:13.1-20: previous declaration fix-it:"input.y":{14:1-16:6}:"" -input.y:17.9-27: warning: deprecated directive: '%fixed-output_files', use '%fixed-output-files' [-Wdeprecated] -fix-it:"input.y":{17:2-17:21}:"%fixed-output-files" -input.y:18.9-27: warning: duplicate directive: '%fixed_output-files' [-Wother] -input.y:17.9-27: previous declaration -fix-it:"input.y":{18:9-18:28}:"" -input.y:19.1-19: warning: duplicate directive: '%fixed-output-files' [-Wother] -input.y:17.9-27: previous declaration -fix-it:"input.y":{19:1-19:20}:"" +input.y:17.9-27: warning: deprecated directive: '%fixed-output_files', use '%output "y.tab.c"' [-Wdeprecated] +fix-it:"input.y":{17:2-17:21}:"%output \"y.tab.c\"" +input.y:18.9-27: warning: deprecated directive: '%fixed_output-files', use '%output "y.tab.c"' [-Wdeprecated] +fix-it:"input.y":{18:9-18:28}:"%output \"y.tab.c\"" +input.y:19.1-19: warning: deprecated directive: '%fixed-output-files', use '%output "y.tab.c"' [-Wdeprecated] +fix-it:"input.y":{19:1-19:20}:"%output \"y.tab.c\"" input.y:20.1-19: warning: deprecated directive: '%name-prefix= "foo"', use '%define api.prefix {foo}' [-Wdeprecated] fix-it:"input.y":{20:1-20:20}:"%define api.prefix {foo}" input.y:21.1-16: warning: deprecated directive: '%no-default_prec', use '%no-default-prec' [-Wdeprecated] @@ -2596,8 +2594,9 @@ AT_CHECK([sed -e '1,8d' input.y], [], %define parse.error verbose %expect-rr 0 %file-prefix "foo" - %fixed-output-files - @&t@ + %output "y.tab.c" + %output "y.tab.c" +%output "y.tab.c" %define api.prefix {foo} %no-default-prec %no-default-prec @@ -2674,7 +2673,6 @@ AT_DATA_GRAMMAR([[input.y]], %file-prefix "foo" %file-prefix "bar" -%fixed-output-files %no-default-prec %no-lines %output "foo"