bison-patches
[Top][All Lists]
Advanced

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

Re: Help with create_pipe_bidi


From: Eric Blake
Subject: Re: Help with create_pipe_bidi
Date: Thu, 20 Aug 2009 16:55:09 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Akim Demaille on 8/12/2009 9:08 AM:
>> * submodules/autoconf: Update.
>> * configure.ac (M4_GNU_OPTION): New define.
>> * src/output.c (output_skeleton): Use it to resolve FIXME.
> 
> This is good, please install.  In addition, please install an assert like
> 
> @@ -622,7 +624,9 @@ output_skeleton (void)
>      argv[i++] = full_m4bison;
>      argv[i++] = full_skeleton;
>      argv[i++] = NULL;
> +    assert(i <= sizeof argv / sizeof *argv);
>    }

Now done on all three active branches, but with the macro
ARRAY_CARDINALITY (in use elsewhere).

>> Subject: [PATCH 4/4] Use pipe module for more robust m4 subprocess.
>>
>> * bootstrap.conf (gnulib_modules): Add pipe.
>> * configure.ac: Adjust to gnulib update.
>> * src/output.c (output_skeleton): Use gnulib functions.
>> * lib/local.mk (lib_libbison_a_SOURCES): Drop subpipe.
>> * .gitignore, lib/cvsignore, lib/.gitignore, m4/.cvsignore,
>> * m4/.gitignore: Regen.
> 
> It seems that Bruno and Paolo are crafting a better suited pipe-filter,
> right?  I don't know if the thread ended on a consensus on the module to
> add to gnulib.

They committed two different pipe filter wrappers.  For the m4 case, we
are okay with just the pipe module with our current usage (thanks to
diversions, m4 sugar doesn't generate any output until all input has been
read), rather than going with the more complicated pipe modules with
asynchronous writers (the difference between Bruno and Paolo's
implementation was whether the reader was also asynchronous).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqN1E0ACgkQ84KuGfSFAYBIxgCghBWn1FEM0hZjdk7eZHST/8Jt
+3cAn3Gd3XdV2PqHzRxxXFDs/2+jZnRT
=Wrej
-----END PGP SIGNATURE-----
>From 1266b636740f0c6719d8cc11a5d569084fa37009 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 20 Aug 2009 16:43:07 -0600
Subject: [PATCH] Make previous patch more robust.

* src/output.c (ARRAY_CARDINALITY): New macro, copied from
argmatch.h.
(output_skeleton): Use it.
Suggested by Akim Demaille.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    6 ++++++
 src/output.c |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9b5fa94..9bf7137 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-08-20  Eric Blake  <address@hidden>

+       Make previous patch more robust.
+       * src/output.c (ARRAY_CARDINALITY): New macro, copied from
+       argmatch.h.
+       (output_skeleton): Use it.
+       Suggested by Akim Demaille.
+
        Import latest m4/m4.m4.
        * m4/m4.m4: Copy from autoconf 2.64.
        * configure.ac (M4_GNU_OPTION): New define.
diff --git a/src/output.c b/src/output.c
index 3fbeb30..759848f 100644
--- a/src/output.c
+++ b/src/output.c
@@ -21,6 +21,7 @@
 #include <config.h>
 #include "system.h"

+#include <assert.h>
 #include <configmake.h>
 #include <error.h>
 #include <get-errno.h>
@@ -40,6 +41,7 @@
 #include "symtab.h"
 #include "tables.h"

+# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))

 static struct obstack format_obstack;

@@ -546,6 +548,7 @@ output_skeleton (void)
     argv[i++] = full_m4bison;
     argv[i++] = full_skeleton;
     argv[i++] = NULL;
+    assert (i <= ARRAY_CARDINALITY (argv));
   }

   init_subpipe ();
-- 
1.6.3.3.334.g916e1


reply via email to

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