Merge pull request #3082 from alexanderkyte/no_alloc_klass_error
[mono.git] / mono / utils / mono-error-internals.h
index 71498c0d99b4e2e8148f5c73658aba7b934c2f0a..e143901748d710d2e2f8bce87d31b0bf32dbe102 100644 (file)
@@ -33,8 +33,8 @@ typedef struct {
 } MonoErrorInternal;
 
 #define error_init(error) do { \
-       (error)->error_code = MONO_ERROR_NONE;  \
-       (error)->flags = 0;     \
+       ((MonoErrorInternal*)(error))->error_code = MONO_ERROR_NONE;    \
+       ((MonoErrorInternal*)(error))->flags = 0;       \
 } while (0);
 
 #define is_ok(error) ((error)->error_code == MONO_ERROR_NONE)
@@ -42,6 +42,11 @@ typedef struct {
 #define return_if_nok(error) do { if (!is_ok ((error))) return; } while (0)
 #define return_val_if_nok(error,val) do { if (!is_ok ((error))) return (val); } while (0)
 
+/* Only use this in icalls */
+#define return_val_and_set_pending_if_nok(error,value) \
+       if (mono_error_set_pending_exception ((error))) \
+               return (value);
+
 void
 mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno) MONO_LLVM_INTERNAL;
 
@@ -108,6 +113,9 @@ mono_error_set_invalid_operation (MonoError *error, const char *msg_format, ...)
 void
 mono_error_set_exception_instance (MonoError *error, MonoException *exc);
 
+void
+mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...);
+
 MonoException*
 mono_error_prepare_exception (MonoError *error, MonoError *error_out);