[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with create_pipe_bidi
From: |
Joel E. Denny |
Subject: |
Re: Help with create_pipe_bidi |
Date: |
Thu, 3 Sep 2009 14:08:54 -0400 (EDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
Hi Eric and Akim.
On Thu, 20 Aug 2009, Eric Blake wrote:
> 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).
That assert is now the only use of assert or assert.h in src/. In Bison's
src/system.h, we have this:
/* <assert.h>'s assertions are too heavyweight, and can be disabled
too easily, so use aver rather than assert. */
static inline void
aver (bool assertion)
{
if (! assertion)
abort ();
}
This was introduced by Paul Eggert. His reason for not using assert from
assert.h is here:
http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00080.html
And his reason for using the name aver is here:
http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00111.html
I don't have a strong opinion on this issue, but we ought to consider it.
Any reason not to continue with his approach?
If not, I'll push this to master, branch-2.5, and branch-2.4.2.
>From b23a6c046dd37e73b3b7069f92071e90990ca293 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Thu, 3 Sep 2009 13:59:07 -0400
Subject: [PATCH] Use aver not assert.
* src/output.c: Don't include assert.h.
(output_skeleton): Use aver not assert.
* src/system.h (aver): In documentation of why, add links to
Paul Eggert's explanations in the mailing lists.
---
ChangeLog | 8 ++++++++
src/output.c | 3 +--
src/system.h | 5 ++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d4cdc6d..f30d1ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-03 Joel E. Denny <address@hidden>
+
+ Use aver not assert.
+ * src/output.c: Don't include assert.h.
+ (output_skeleton): Use aver not assert.
+ * src/system.h (aver): In documentation of why, add links to
+ Paul Eggert's explanations in the mailing lists.
+
2009-09-03 Akim Demaille <address@hidden>
* NEWS (2.4.2): Add "Internationalization" item.
diff --git a/src/output.c b/src/output.c
index 23cd8ff..562918c 100644
--- a/src/output.c
+++ b/src/output.c
@@ -21,7 +21,6 @@
#include <config.h>
#include "system.h"
-#include <assert.h>
#include <configmake.h>
#include <error.h>
#include <get-errno.h>
@@ -637,7 +636,7 @@ output_skeleton (void)
argv[i++] = full_m4bison;
argv[i++] = full_skeleton;
argv[i++] = NULL;
- assert (i <= ARRAY_CARDINALITY (argv));
+ aver (i <= ARRAY_CARDINALITY (argv));
}
init_subpipe ();
diff --git a/src/system.h b/src/system.h
index cc2b09b..8ea5653 100644
--- a/src/system.h
+++ b/src/system.h
@@ -124,7 +124,10 @@ typedef size_t uintptr_t;
`-------------*/
/* <assert.h>'s assertions are too heavyweight, and can be disabled
- too easily, so use aver rather than assert. */
+ too easily, so use aver rather than assert. See discussions at
+ <http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00080.html>
+ <http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00111.html>.
+*/
static inline void
aver (bool assertion)
{
--
1.5.4.3