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: Joel E. Denny
Subject: Re: Help with create_pipe_bidi
Date: Mon, 14 Dec 2009 18:43:04 -0500 (EST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Mon, 7 Sep 2009, Joel E. Denny wrote:

> On Mon, 7 Sep 2009, Akim Demaille wrote:
> 
> > I can understand the concerns of Paul wrt the space-footprint of assert,
> 
> I'm probably showing my ignorance here, but are we talking about the size 
> of the bison executable?  I didn't know what Paul meant by "heavyweight".
> 
> On my system, src/bison increases from 988K to 1000K when I adjust 
> src/system.h as follows:
> 
>   -static inline void
>   -aver (bool assertion)
>   -{
>   -  if (! assertion)
>   -    abort ();
>   -}
>   -
>   +#include <assert.h>
>   +#define aver assert
> 
> After stripping, it's 300K and 312K.  Will anyone be bothered by 12K?
> 
> > that's why I meant to twist the meaning of NDEBUG into "smaller foot-print".
> > I would make --disable-asserts equivalent to NDEBUG, so it would move from
> > classical assert to our current aver.
> > 
> > We can also provide a three-state --disable-asserts:
> > 
> > - yes: fully blown assert,
> > - no: our current aver, same as NDEBUG,
> > - totally: completely remove the assertions.
> 
> During development, assert's output could prove helpful.  Also, if a user 
> ever sees an assertion failure, it might be nice that he can report the 
> assert output to bug-bison.  I can also understand the motivation to 
> suppress NDEBUG's effect.  So, assert ignoring NDEBUG seems good to me.  
> I don't yet see much motivation for other options, but I'm not opposed to 
> bison providing them if you think people would find them useful.

I want assert's output as it can facilitate development and bug reporting, 
so I pushed the following to master, branch-2.5, and branch-2.4.2.  I 
decided to simply do `#define aver assert'.  I also added gnulib's assert 
module.  We can address the remaining concerns later once we've figured 
out what's really needed.

Does anyone feel that these changes are NEWS-worthy?

>From ca01f454f01645533622a59ef0df335ee07679e5 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Mon, 14 Dec 2009 18:04:57 -0500
Subject: [PATCH] Enable assertion output and --disable-assert for configure.

* bootstrap.conf (gnulib_modules): Add assert module.
* src/system.h (aver): Define as assert, and summarize the
discussion on this issue.
---
 ChangeLog      |    7 +++++++
 bootstrap.conf |   12 ++++++------
 m4/.cvsignore  |    1 +
 m4/.gitignore  |    1 +
 src/system.h   |   25 +++++++++++++++++--------
 5 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 549b084..e465744 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-12-14  Joel E. Denny  <address@hidden>
 
+       Enable assertion output and --disable-assert for configure.
+       * bootstrap.conf (gnulib_modules): Add assert module.
+       * src/system.h (aver): Define as assert, and summarize the
+       discussion on this issue.
+
+2009-12-14  Joel E. Denny  <address@hidden>
+
        Expand GLR acronym in summary of Bison.
        Based on discussion with Akim Demaille starting at
        <http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00087.html>.
diff --git a/bootstrap.conf b/bootstrap.conf
index 1cef2f0..dff8d80 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -17,12 +17,12 @@
 
 # gnulib modules used by this package.
 gnulib_modules='
-  announce-gen argmatch config-h c-strcase configmake dirname error
-  extensions fopen-safer gendocs getopt-gnu gettext git-version-gen hash
-  inttypes javacomp-script javaexec-script maintainer-makefile malloc
-  mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
-  strverscmp unistd unistd-safer unlocked-io update-copyright unsetenv
-  verify warnings xalloc xalloc-die xstrndup
+  announce-gen argmatch assert config-h c-strcase configmake dirname
+  error extensions fopen-safer gendocs getopt-gnu gettext
+  git-version-gen hash inttypes javacomp-script javaexec-script
+  maintainer-makefile malloc mbswidth obstack quote quotearg stdbool
+  stpcpy strerror strtoul strverscmp unistd unistd-safer unlocked-io
+  update-copyright unsetenv verify warnings xalloc xalloc-die xstrndup
 '
 
 # Additional xgettext options to use.  Use "\\\newline" to break lines.
diff --git a/src/system.h b/src/system.h
index 8ea5653..8d2358c 100644
--- a/src/system.h
+++ b/src/system.h
@@ -123,17 +123,26 @@ typedef size_t uintptr_t;
 | Assertions.  |
 `-------------*/
 
-/* <assert.h>'s assertions are too heavyweight, and can be disabled
-   too easily, so use aver rather than assert.  See discussions at
+/* In the past, Bison defined aver to simply invoke abort in the case of
+   a failed assertion.  The rationale was that <assert.h>'s assertions
+   were too heavyweight and could be disabled too easily.  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>.
+
+   However, normal assert output can be helpful during development and
+   in bug reports from users.  Moreover, it's not clear now that
+   <assert.h>'s assertions are significantly heavyweight.  Finally, if
+   users want to experiment with disabling assertions, it's debatable
+   whether it's our responsibility to stop them.  See discussion
+   starting at
+   <http://lists.gnu.org/archive/html/bison-patches/2009-09/msg00013.html>.
+
+   For now, we use assert but we call it aver throughout Bison in case
+   we later wish to try another scheme.
 */
-static inline void
-aver (bool assertion)
-{
-  if (! assertion)
-    abort ();
-}
+#include <assert.h>
+#define aver assert
 
 
 /*-----------.
-- 
1.5.4.3





reply via email to

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