warnings: simplify the m4 interface

* data/bison.m4 (error_at): Replace...
(error): this.
(b4_warn, b4_complain, b4_fatal): Bounce to their _at equivalent,
with empty location.
* src/scan-skel.l (at_directive_perform): Simplify accordingly.
This commit is contained in:
Akim Demaille
2012-10-01 16:47:50 +02:00
parent 20964c33f9
commit c4e3a1622d
2 changed files with 29 additions and 45 deletions

View File

@@ -186,25 +186,23 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop)
fail_for_at_directive_too_many_args (argv[0]);
fputs (last_component (argv[1]), yyout);
}
else if (STREQ (argv[0], "@warn") || STREQ (argv[0], "@warn_at")
|| STREQ (argv[0], "@complain") || STREQ (argv[0], "@complain_at")
|| STREQ (argv[0], "@fatal") || STREQ (argv[0], "@fatal_at"))
else if (STREQ (argv[0], "@warn")
|| STREQ (argv[0], "@complain")
|| STREQ (argv[0], "@fatal"))
{
warnings w = flag (*argv);
location loc;
location *locp = NULL;
if (STREQ (*argv + strlen (*argv) - 3, "_at"))
if (argc < 4)
fail_for_at_directive_too_few_args (argv[0]);
if (argv[1] && argv[1][0])
{
if (argc < 4)
fail_for_at_directive_too_few_args (argv[0]);
boundary_set_from_string (&loc.start, argv[1]);
boundary_set_from_string (&loc.end, argv[2]);
argc -= 2;
argv += 2;
locp = &loc;
}
else if (argc < 2)
fail_for_at_directive_too_few_args (argv[0]);
argc -= 2;
argv += 2;
complain_args (locp, w, argc, argv);
}
else if (STREQ (argv[0], "@output"))