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.
This commit is contained in:
Joel E. Denny
2009-12-14 18:04:57 -05:00
parent 9dc3ee6d54
commit ca01f454f0
5 changed files with 32 additions and 14 deletions

View File

@@ -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
/*-----------.