[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/6] errors: factor b4_error @directives

From: Akim Demaille
Subject: Re: [PATCH 2/6] errors: factor b4_error @directives
Date: Thu, 4 Oct 2012 14:44:43 +0200

Le 4 oct. 2012 à 12:35, Theophile Ranquet a écrit :

> Instead of @complain, @warn, and @fatal, use a unique @complain
> directive. This directive's first argument is "complain", "warn", etc.
> * data/bison.m4 (m4_error): Here.
> * src/scan-skel.l (at_directive_perform): Adjust.
> (flag): Replace the switch by safer and more explicit if branches.

Nit picking: the switch was fine *before*, since the argument
was already scanned as being "@complain", or "@warn" etc.  It
is this change that made this argument not being checked before,
so _now_ it must be verified.

Anyway, installed, with this minor change added.

diff --git a/gnulib b/gnulib
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit dcf27bef48c9800d5a2be8349226f73f1b8ff2e5
+Subproject commit dcf27bef48c9800d5a2be8349226f73f1b8ff2e5-dirty
diff --git a/src/scan-skel.l b/src/scan-skel.l
index 4b64623..662a00b 100644
--- a/src/scan-skel.l
+++ b/src/scan-skel.l
@@ -201,9 +201,7 @@ at_directive_perform (int argc, char *argv[], char 
**outnamep, int *out_linenop)
           boundary_set_from_string (&loc.end, argv[3]);
           locp = &loc;
-      argc -= 3;
-      argv += 3;
-      complain_args (locp, w, argc, argv);
+      complain_args (locp, w, argc - 3, argv + 3);
   else if (STREQ (argv[0], "@output"))

BTW, could you please have complain_args start from argv[0]
instead of argv[1]?  So it would be argc + 4, which is more
logical here.

Unless we decide that it is complain_args which is in charge
of converting a message type string into a warning type
(which makes sense).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]