configure.ac (enable-checking): Add 'runtime' option.
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 24 Mar 2005 14:09:06 +0000 (14:09 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 24 Mar 2005 14:09:06 +0000 (14:09 +0000)
* 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.

From-SVN: r96990

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/doc/install.texi
gcc/tsystem.h

index 3382458f0db3e298bcb5a7832ee52ad7c5418934..897acce1c6311f1d64e63ad634758cd06df88daa 100644 (file)
@@ -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.
index 34fb521f4dafab8f0b49a85a5917a8b6b0dcbfa8..eb58153d8f8ca04b9c07b1a1b599d096097aa53d 100644 (file)
@@ -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
index dfefaebfd172ebec59ade9d7196653ef38ff827f..a8dd3da4cd60f60e5c4815f912660e9cd34c0b6c 100755 (executable)
@@ -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
@@ -6329,6 +6332,13 @@ cat >>confdefs.h <<\_ACEOF
 #define ENABLE_ASSERT_CHECKING 1
 _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
 
index d8be15830ff02ae2852a57dd80f56ee21d91884e..1d6ced1868631e2ccfa3074e577c5c2b6642e820 100644 (file)
@@ -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
index 0a629a73f29a0040bc1d07bf51b5762e3e5451f4..471c5a0d36968ca7253fae56cf4dba17c100dc5e 100644 (file)
@@ -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}
index b2b95446c6fde0c53fbf0491e4f1b04aebccefb0..5342178c414cbd26265ca8184421cf19cbc238c6 100644 (file)
@@ -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 */