mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
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.
(cherry picked from commit ca01f454f0)
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2009-12-14 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
|
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 <jdenny@clemson.edu>
|
2009-12-14 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
Expand GLR acronym in summary of Bison.
|
Expand GLR acronym in summary of Bison.
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
announce-gen argmatch config-h c-strcase configmake dirname error
|
announce-gen argmatch assert config-h c-strcase configmake dirname
|
||||||
extensions fopen-safer gendocs getopt-gnu gettext git-version-gen hash
|
error extensions fopen-safer gendocs getopt-gnu gettext
|
||||||
inttypes javacomp-script javaexec-script maintainer-makefile malloc
|
git-version-gen hash inttypes javacomp-script javaexec-script
|
||||||
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
|
maintainer-makefile malloc mbswidth obstack quote quotearg stdbool
|
||||||
strverscmp unistd unistd-safer unlocked-io update-copyright unsetenv
|
stpcpy strerror strtoul strverscmp unistd unistd-safer unlocked-io
|
||||||
verify warnings xalloc xalloc-die xstrndup
|
update-copyright unsetenv verify warnings xalloc xalloc-die xstrndup
|
||||||
'
|
'
|
||||||
|
|
||||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
00gnulib.m4
|
00gnulib.m4
|
||||||
absolute-header.m4
|
absolute-header.m4
|
||||||
argmatch.m4
|
argmatch.m4
|
||||||
|
assert.m4
|
||||||
config-h.m4
|
config-h.m4
|
||||||
dirname.m4
|
dirname.m4
|
||||||
dos.m4
|
dos.m4
|
||||||
|
|||||||
1
m4/.gitignore
vendored
1
m4/.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
/00gnulib.m4
|
/00gnulib.m4
|
||||||
/absolute-header.m4
|
/absolute-header.m4
|
||||||
/argmatch.m4
|
/argmatch.m4
|
||||||
|
/assert.m4
|
||||||
/config-h.m4
|
/config-h.m4
|
||||||
/dirname.m4
|
/dirname.m4
|
||||||
/dos.m4
|
/dos.m4
|
||||||
|
|||||||
25
src/system.h
25
src/system.h
@@ -123,17 +123,26 @@ typedef size_t uintptr_t;
|
|||||||
| Assertions. |
|
| Assertions. |
|
||||||
`-------------*/
|
`-------------*/
|
||||||
|
|
||||||
/* <assert.h>'s assertions are too heavyweight, and can be disabled
|
/* In the past, Bison defined aver to simply invoke abort in the case of
|
||||||
too easily, so use aver rather than assert. See discussions at
|
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-01/msg00080.html>
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2006-09/msg00111.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
|
#include <assert.h>
|
||||||
aver (bool assertion)
|
#define aver assert
|
||||||
{
|
|
||||||
if (! assertion)
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------.
|
/*-----------.
|
||||||
|
|||||||
Reference in New Issue
Block a user