diff options
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config.in | 3 | ||||
-rwxr-xr-x | gcc/configure | 20 | ||||
-rw-r--r-- | gcc/configure.ac | 17 | ||||
-rw-r--r-- | gcc/doc/install.texi | 27 | ||||
-rw-r--r-- | gcc/tsystem.h | 10 |
6 files changed, 62 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3382458f0db..897acce1c63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-24 Nathan Sidwell <nathan@codesourcery.com> + + * configure.ac (enable-checking): Add 'runtime' option. + * doc/install.texi (enable-checking): Document 'runtime' checking. + * tsystem.h (gcc_assert, gcc_unreachable): Define. + * config.in: Regenerated. + * configure: Regenerated. + 2005-03-23 Uros Bizjak <uros@kss-loka.si> * optabs.h (enum optab_index): Remove OTI_llrint. diff --git a/gcc/config.in b/gcc/config.in index 34fb521f4da..eb58153d8f8 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -54,6 +54,9 @@ that are supported for each access macro. This is relatively cheap. */ #undef ENABLE_RTL_FLAG_CHECKING +/* Define if you want runtime assertions enabled. This is a cheap check. */ +#undef ENABLE_RUNTIME_CHECKING + /* Define if you want all operations on trees (the basic data structure of the front ends) to be checked for dynamic type safety at runtime. This is moderately expensive. The tree browser debugging routines will also be diff --git a/gcc/configure b/gcc/configure index dfefaebfd17..a8dd3da4cd6 100755 --- a/gcc/configure +++ b/gcc/configure @@ -868,7 +868,7 @@ Optional Features: enable expensive run-time checks. With LIST, enable only specific categories of checks. Categories are: assert,fold,gc,gcac,misc, - rtlflag,rtl,tree,valgrind,release,yes,all; + rtlflag,rtl,runtime,tree,valgrind,release,yes,all; --enable-mapped-location location_t is fileline integer cookie --enable-coverage=LEVEL enable compiler's code coverage collection. @@ -6278,6 +6278,7 @@ ac_checking= ac_tree_checking= ac_rtl_checking= ac_rtlflag_checking= +ac_runtime_checking=1 ac_gc_checking= ac_gc_always_collect= ac_fold_checking= @@ -6287,16 +6288,17 @@ do case $check in yes) ac_assert_checking=1 ; ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; - ac_rtlflag_checking=1 ;; + ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;; no) ac_assert_checking= ; ac_checking= ; ac_tree_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_gc_checking= ; ac_gc_always_collect= ; ac_fold_checking= ;; all) ac_assert_checking=1 ; ac_checking=1 ; ac_tree_checking=1 ; ac_rtl_checking=1 ; - ac_rtlflag_checking=1 ; ac_gc_checking=1 ; - ac_gc_always_collect=1 ; ac_fold_checking=1 ;; - release) ac_assert_checking=1 ;; + ac_rtlflag_checking=1 ; ac_runtime_checking=1; + ac_gc_checking=1 ; ac_gc_always_collect=1 ; + ac_fold_checking=1 ;; + release) ac_assert_checking=1 ; ac_runtime_checking=1 ;; assert) ac_assert_checking=1 ;; fold) ac_fold_checking=1 ;; gc) ac_gc_checking=1 ;; @@ -6304,6 +6306,7 @@ do misc) ac_checking=1 ;; rtlflag) ac_rtlflag_checking=1 ;; rtl) ac_rtl_checking=1 ;; + runtime) ac_runtime_checking=1 ;; tree) ac_tree_checking=1 ;; valgrind) ac_checking_valgrind=1 ;; *) { { echo "$as_me:$LINENO: error: unknown check category $check" >&5 @@ -6330,6 +6333,13 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi +if test x$ac_runtime_checking != x ; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_RUNTIME_CHECKING 1 +_ACEOF + +fi if test x$ac_tree_checking != x ; then cat >>confdefs.h <<\_ACEOF diff --git a/gcc/configure.ac b/gcc/configure.ac index d8be15830ff..1d6ced18686 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -394,7 +394,7 @@ AC_ARG_ENABLE(checking, enable expensive run-time checks. With LIST, enable only specific categories of checks. Categories are: assert,fold,gc,gcac,misc, - rtlflag,rtl,tree,valgrind,release,yes,all;], + rtlflag,rtl,runtime,tree,valgrind,release,yes,all;], [ac_checking_flags="${enableval}"],[ # Determine the default checks. if test x$is_release = x ; then @@ -407,6 +407,7 @@ ac_checking= ac_tree_checking= ac_rtl_checking= ac_rtlflag_checking= +ac_runtime_checking=1 ac_gc_checking= ac_gc_always_collect= ac_fold_checking= @@ -416,16 +417,17 @@ do case $check in yes) ac_assert_checking=1 ; ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; - ac_rtlflag_checking=1 ;; + ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;; no) ac_assert_checking= ; ac_checking= ; ac_tree_checking= ; ac_rtl_checking= ; ac_rtlflag_checking= ; ac_gc_checking= ; ac_gc_always_collect= ; ac_fold_checking= ;; all) ac_assert_checking=1 ; ac_checking=1 ; ac_tree_checking=1 ; ac_rtl_checking=1 ; - ac_rtlflag_checking=1 ; ac_gc_checking=1 ; - ac_gc_always_collect=1 ; ac_fold_checking=1 ;; - release) ac_assert_checking=1 ;; + ac_rtlflag_checking=1 ; ac_runtime_checking=1; + ac_gc_checking=1 ; ac_gc_always_collect=1 ; + ac_fold_checking=1 ;; + release) ac_assert_checking=1 ; ac_runtime_checking=1 ;; assert) ac_assert_checking=1 ;; fold) ac_fold_checking=1 ;; gc) ac_gc_checking=1 ;; @@ -433,6 +435,7 @@ do misc) ac_checking=1 ;; rtlflag) ac_rtlflag_checking=1 ;; rtl) ac_rtl_checking=1 ;; + runtime) ac_runtime_checking=1 ;; tree) ac_tree_checking=1 ;; valgrind) ac_checking_valgrind=1 ;; *) AC_MSG_ERROR(unknown check category $check) ;; @@ -452,6 +455,10 @@ if test x$ac_assert_checking != x ; then AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, [Define if you want assertions enabled. This is a cheap check.]) fi +if test x$ac_runtime_checking != x ; then + AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1, +[Define if you want runtime assertions enabled. This is a cheap check.]) +fi if test x$ac_tree_checking != x ; then AC_DEFINE(ENABLE_TREE_CHECKING, 1, [Define if you want all operations on trees (the basic data diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 0a629a73f29..471c5a0d369 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1114,20 +1114,21 @@ with GCC@. This is on by default when building from CVS or snapshots, but off for releases. More control over the checks may be had by specifying @var{list}; the categories of checks available are @samp{release}, @samp{assert}, @samp{misc}, @samp{tree}, @samp{gc}, -@samp{rtl}, @samp{rtlflag}, @samp{fold}, @samp{gcac} and +@samp{rtl}, @samp{rtlflag}, @samp{runtime}, @samp{fold}, @samp{gcac} and @samp{valgrind}. The @samp{release} category enables only those checks -suitable for release builds, currently this is just @samp{assert}. The -check @samp{valgrind} requires the external @command{valgrind} -simulator, available from @uref{http://valgrind.kde.org/}. The checks -@samp{rtl}, @samp{gcac} and @samp{valgrind} are very expensive. The -default when @var{list} is not specified is -@samp{assert,misc,tree,gc,rtlflag}. That is also the default for -development builds, when @samp{--enable-checking} is not specified. For -release builds the default, when @samp{--enable-checking} is not given, -is @samp{release}. To disable all checking, @samp{--disable-checking} -must be explicitly requested. Disabling assertions will make the -compiler slightly faster but increase the risk of undetected internal -errors causing wrong code to be generated. +suitable for release builds, currently this is @samp{assert} and +@samp{runtime}. The check @samp{valgrind} requires the external +@command{valgrind} simulator, available from +@uref{http://valgrind.kde.org/}. The checks @samp{rtl}, @samp{gcac} and +@samp{valgrind} are very expensive. The default when @var{list} is not +specified is @samp{assert,misc,tree,gc,rtlflag,runtime}. That is also +the default for development builds, when @samp{--enable-checking} is not +specified. For release builds the default, when +@samp{--enable-checking} is not given, is @samp{release}. To disable +all checking, @samp{--disable-checking} must be explicitly requested. +Disabling assertions will make the compiler and runtime slightly faster +but increase the risk of undetected internal errors causing wrong code +to be generated. @item --enable-coverage @itemx --enable-coverage=@var{level} diff --git a/gcc/tsystem.h b/gcc/tsystem.h index b2b95446c6f..5342178c414 100644 --- a/gcc/tsystem.h +++ b/gcc/tsystem.h @@ -121,4 +121,14 @@ extern int errno; #undef alloca #define alloca(x) __builtin_alloca(x) +#ifdef ENABLE_RUNTIME_CHECKING +#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0)) +#else +/* Include EXPR, so that unused variable warnings do not occur. */ +#define gcc_assert(EXPR) ((void)(0 && (EXPR))) +#endif +/* Use gcc_unreachable() to mark unreachable locations (like an + unreachable default case of a switch. Do not use gcc_assert(0). */ +#define gcc_unreachable() (abort ()) + #endif /* ! GCC_TSYSTEM_H */ |