From c0f3b55b2542882b1e735b57d7997a807c9fcaf4 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 21 Dec 2020 07:51:02 +0100 Subject: [PATCH] style: address syntax-check diagnostics * examples/c/glr/c++-types.y: Formatting changes. * po/POTFILES.in: Add missing files. * src/reader.c: Remove useless include. * tests/calc.at: Avoid magic values for exit. Obfuscate calls to error. --- examples/c/glr/c++-types.y | 1 - po/POTFILES.in | 1 + src/reader.c | 3 +-- tests/calc.at | 10 +++++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/c/glr/c++-types.y b/examples/c/glr/c++-types.y index a6118c0b..33d1abc6 100644 --- a/examples/c/glr/c++-types.y +++ b/examples/c/glr/c++-types.y @@ -295,4 +295,3 @@ stmtMerge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, NULL); } - diff --git a/po/POTFILES.in b/po/POTFILES.in index 5b15e936..c9647675 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,6 +14,7 @@ src/main.c src/muscle-tab.c src/parse-gram.y src/print-graph.c +src/print-xml.c src/print.c src/reader.c src/reduce.c diff --git a/src/reader.c b/src/reader.c index 8f77fc72..786e38f6 100644 --- a/src/reader.c +++ b/src/reader.c @@ -21,7 +21,6 @@ #include #include "system.h" -#include #include #include @@ -349,7 +348,7 @@ grammar_rule_check_and_complete (symbol_list *r) const symbol *start = r->next->next->content.sym; if (start->content->type_name) obstack_printf (obstack_for_actions, - "{ ]b4_accept([%s%d])[; }", + "{ ]b4_accept""([%s%d])[; }", start->content->class == nterm_sym ? "orig " : "", start->content->number); else diff --git a/tests/calc.at b/tests/calc.at index 75b64e10..6fd19e1a 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -84,6 +84,10 @@ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; +#ifndef EX_NOINPUT +# define EX_NOINPUT 66 +#endif + static FILE * open_file (const char *file) { @@ -91,7 +95,7 @@ open_file (const char *file) if (!res) { perror (file); - exit (3); + exit (EX_NOINPUT); } return res; } @@ -424,14 +428,14 @@ exp: { YYLTYPE old_yylloc = yylloc; yylloc = @3; - yyerror (]AT_PARAM_IF([result, count, nerrs, ])["error: null divisor"); + yyerr][or (]AT_PARAM_IF([result, count, nerrs, ])["error: null divisor"); yylloc = old_yylloc; } ]])[ }]], [c++], [[ { - ]AT_GLR_IF([[yyparser.]])[error (]AT_LOCATION_IF([[@3, ]])["error: null divisor"); + ]AT_GLR_IF([[yyparser.]])[err][or (]AT_LOCATION_IF([[@3, ]])["error: null divisor"); }]])[ else $$ = $1 / $3;