-/*
- * checked-build.h: Expensive asserts used when mono is built with --with-checked-build=yes
+/**
+ * \file
+ * Expensive asserts used when mono is built with --with-checked-build=yes
*
* Author:
* Rodrigo Kumpera (kumpera@gmail.com)
#include <config.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-publib.h>
typedef enum {
*/
#define MONO_REQ_GC_SAFE_MODE do { \
- assert_gc_safe_mode (); \
+ assert_gc_safe_mode (__FILE__, __LINE__); \
} while (0);
#define MONO_REQ_GC_UNSAFE_MODE do { \
- assert_gc_unsafe_mode (); \
+ assert_gc_unsafe_mode (__FILE__, __LINE__); \
} while (0);
#define MONO_REQ_GC_NEUTRAL_MODE do { \
- assert_gc_neutral_mode (); \
+ assert_gc_neutral_mode (__FILE__, __LINE__); \
} while (0);
/* In a GC critical region, the thread is not allowed to switch to GC safe mode.
assert_in_gc_critical_region(); \
} while(0)
-void assert_gc_safe_mode (void);
-void assert_gc_unsafe_mode (void);
-void assert_gc_neutral_mode (void);
+void assert_gc_safe_mode (const char *file, int lineno);
+void assert_gc_unsafe_mode (const char *file, int lineno);
+void assert_gc_neutral_mode (const char *file, int lineno);
void* critical_gc_region_begin(void);
void critical_gc_region_end(void* token);
void check_metadata_store(void *from, void *to);
void check_metadata_store_local(void *from, void *to);
+#define CHECKED_METADATA_STORE(ptr, val) check_metadata_store ((ptr), (val))
+#define CHECKED_METADATA_STORE_LOCAL(ptr, val) check_metadata_store_local ((ptr), (val))
+
#else
#define CHECKED_METADATA_WRITE_PTR(ptr, val) do { (ptr) = (val); } while (0)
#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)
+#define CHECKED_METADATA_STORE(ptr, val) do { (ptr); (val); } while (0)
+#define CHECKED_METADATA_STORE_LOCAL(ptr, val) do { (ptr); (val); } while (0)
+
#endif /* defined(ENABLE_CHECKED_BUILD_METADATA) */
#ifdef ENABLE_CHECKED_BUILD_THREAD
void checked_build_thread_transition(const char *transition, void *info, int from_state, int suspend_count, int next_state, int suspend_count_delta);
-void mono_fatal_with_history(const char *msg, ...);
+G_GNUC_NORETURN MONO_ATTR_FORMAT_PRINTF(1,2) void mono_fatal_with_history(const char *msg, ...);
#else