Also make the define names more consistent.
fi
], [with_cooperative_gc=no])
-AC_ARG_WITH(checked_build, [ --with-checked-build=yes|no Enable checked build (expensive asserts)) (defaults to no)],[
- if test x$with_checked_build != xno ; then
- AC_DEFINE(CHECKED_BUILD,1,[Enable checked build.])
- fi
-], [with_checked_build=no])
+AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable checked build (expensive asserts), configure with a comma-separated LIST of checked build modules and then include that same list in the environment variable MONO_CHECK_MODE at runtime. Recognized checked build modules: all, gc, metadata, thread],[
-if test x$with_checked_build != xno ; then
- DISABLED_CHECKED_BUILD_TEST=none
+ if test x$enable_checked_build != x ; then
+ AC_DEFINE(ENABLE_CHECKED_BUILD,1,[Enable checked build])
+ fi
+ for feature in `echo "$enable_checked_build" | sed -e "s/,/ /g"`; do
+ eval "mono_checked_build_test_enable_$feature='yes'"
+ done
- AC_ARG_ENABLE(checked_build_test, [ --enable-checked-build-test=LIST drop support for LIST checked build tests. LIST is a comma-separated list from: gc, metadata, thread.],
- [
- for feature in `echo "$enable_checked_build_test" | sed -e "s/,/ /g"`; do
- eval "mono_checked_build_test_disable_$feature='yes'"
- done
- DISABLED_CHECKED_BUILD_TEST=$enable_checked_build_test
- ],[])
+ if test "x$mono_checked_build_test_enable_all" = "xyes"; then
+ eval "mono_checked_build_test_enable_gc='yes'"
+ eval "mono_checked_build_test_enable_metadata='yes'"
+ eval "mono_checked_build_test_enable_thread='yes'"
+ fi
- if test "x$mono_checked_build_test_disable_gc" = "xyes"; then
- AC_DEFINE(DISABLE_CHECKED_BUILD_GC, 1, [Disable GC checked build])
+ if test "x$mono_checked_build_test_enable_gc" = "xyes"; then
+ AC_DEFINE(ENABLE_CHECKED_BUILD_GC, 1, [Enable GC checked build])
fi
- if test "x$mono_checked_build_test_disable_metadata" = "xyes"; then
- AC_DEFINE(DISABLE_CHECKED_BUILD_METADATA, 1, [Disable metadata checked build])
+ if test "x$mono_checked_build_test_enable_metadata" = "xyes"; then
+ AC_DEFINE(ENABLE_CHECKED_BUILD_METADATA, 1, [Enable metadata checked build])
fi
- if test "x$mono_checked_build_test_disable_thread" = "xyes"; then
- AC_DEFINE(DISABLE_CHECKED_BUILD_THREAD, 1, [Disable thread checked build])
+ if test "x$mono_checked_build_test_enable_thread" = "xyes"; then
+ AC_DEFINE(ENABLE_CHECKED_BUILD_THREAD, 1, [Enable thread checked build])
fi
-fi
+
+], [])
AC_CHECK_HEADER([malloc.h],
[AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1],
return mono_handle_arena_elevate (mono_handle_arena_current (), handle);
}
-#ifndef CHECKED_BUILD
+#ifndef ENABLE_CHECKED_BUILD
#define mono_handle_obj(handle) ((handle)->__private_obj)
*/
#include <config.h>
-#ifdef CHECKED_BUILD
+#ifdef ENABLE_CHECKED_BUILD
#include <mono/utils/checked-build.h>
#include <mono/utils/mono-threads.h>
return state;
}
-#if !defined(DISABLE_CHECKED_BUILD_THREAD)
+#ifdef ENABLE_CHECKED_BUILD_THREAD
#define MAX_NATIVE_BT 6
#define MAX_NATIVE_BT_PROBE (MAX_NATIVE_BT + 5)
g_ptr_array_add (state->transitions, t);
}
-#endif /* !defined(DISABLE_CHECKED_BUILD_THREAD) */
+#endif /* defined(ENABLE_CHECKED_BUILD_THREAD) */
-#if !defined(DISABLE_CHECKED_BUILD_GC)
+#ifdef ENABLE_CHECKED_BUILD_GC
static void
assertion_fail (const char *msg, ...)
g_string_free (err, TRUE);
}
+#endif /* defined(ENABLE_CHECKED_BUILD_THREAD) */
+
+#ifdef ENABLE_CHECKED_BUILD_GC
+
void
assert_gc_safe_mode (void)
{
assertion_fail("Expected GC critical region");
}
-#endif /* !defined(DISABLE_CHECKED_BUILD_GC) */
+#endif /* defined(ENABLE_CHECKED_BUILD_GC) */
-#if !defined(DISABLE_CHECKED_BUILD_METADATA)
+#ifdef ENABLE_CHECKED_BUILD_METADATA
// check_metadata_store et al: The goal of these functions is to verify that if there is a pointer from one mempool into
// another, that the pointed-to memory is protected by the reference count mechanism for MonoImages.
check_mempool_may_reference_mempool (from, to, TRUE);
}
-#endif /* !defined(DISABLE_CHECKED_BUILD_METADATA) */
+#endif /* defined(ENABLE_CHECKED_BUILD_METADATA) */
-#endif /* CHECKED_BUILD */
+#endif /* ENABLE_CHECKED_BUILD */
// The current reason why this is needed is for pointers to constant strings, which the checker cannot verify yet.
#define CHECKED_METADATA_WRITE_PTR_EXEMPT(ptr, val) do { (ptr) = (val); } while (0)
-#if defined(CHECKED_BUILD)
+#ifdef ENABLE_CHECKED_BUILD
#define g_assert_checked g_assert
#define CHECKED_MONO_INIT()
-#endif /* CHECKED_BUILD */
-
-#if defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_GC)
+#endif /* ENABLE_CHECKED_BUILD */
+#ifdef ENABLE_CHECKED_BUILD_GC
/*
GC runtime modes rules:
#define MONO_REQ_GC_NOT_CRITICAL
#define MONO_REQ_GC_CRITICAL
-#endif /* defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_GC) */
+#endif /* defined(ENABLE_CHECKED_BUILD_GC) */
-#if defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_METADATA)
+#ifdef ENABLE_CHECKED_BUILD_METADATA
// Use when writing a pointer from one image or imageset to another.
#define CHECKED_METADATA_WRITE_PTR(ptr, val) do { \
#define CHECKED_METADATA_WRITE_PTR_LOCAL(ptr, val) do { (ptr) = (val); } while (0)
#define CHECKED_METADATA_WRITE_PTR_ATOMIC(ptr, val) do { mono_atomic_store_release (&(ptr), (val)); } while (0)
-#endif /* defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_METADATA) */
+#endif /* defined(ENABLE_CHECKED_BUILD_METADATA) */
-#if defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_THREAD)
+#ifdef ENABLE_CHECKED_BUILD_THREAD
#define CHECKED_BUILD_THREAD_TRANSITION(transition, info, from_state, suspend_count, next_state, suspend_count_delta) do { \
checked_build_thread_transition (transition, info, from_state, suspend_count, next_state, suspend_count_delta); \
#define CHECKED_BUILD_THREAD_TRANSITION(transition, info, from_state, suspend_count, next_state, suspend_count_delta)
-#endif /* defined(CHECKED_BUILD) && !defined(DISABLE_CHECKED_BUILD_THREAD) */
+#endif /* defined(ENABLE_CHECKED_BUILD_THREAD) */
#endif /* __CHECKED_BUILD_H__ */