Fixed warning in MSVC by prefixing the macros, MEM_FREE is already defined in winnt.h.
authorJoao Matos <joao.matos@xamarin.com>
Thu, 5 Jun 2014 14:09:01 +0000 (15:09 +0100)
committerJoao Matos <joao.matos@xamarin.com>
Thu, 5 Jun 2014 14:09:01 +0000 (15:09 +0100)
mono/metadata/verify.c

index 64111ea7c11b63087c10676fc1769fa2767dfa18..b23a830dbcba02f8f2613f96c052ac10499044f9 100644 (file)
@@ -306,8 +306,8 @@ enum {
 
 #ifdef ENABLE_VERIFIER_STATS
 
-#define MEM_ALLOC(amt) do { allocated_memory += (amt); working_set += (amt); } while (0)
-#define MEM_FREE(amt) do { working_set -= (amt); } while (0)
+#define _MEM_ALLOC(amt) do { allocated_memory += (amt); working_set += (amt); } while (0)
+#define _MEM_FREE(amt) do { working_set -= (amt); } while (0)
 
 static int allocated_memory;
 static int working_set;
@@ -338,8 +338,8 @@ init_verifier_stats (void)
 
 #else
 
-#define MEM_ALLOC(amt) do {} while (0)
-#define MEM_FREE(amt) do { } while (0)
+#define _MEM_ALLOC(amt) do {} while (0)
+#define _MEM_FREE(amt) do { } while (0)
 
 #define finish_collect_stats()
 #define init_verifier_stats()
@@ -378,7 +378,7 @@ static MonoType *
 mono_type_create_fnptr_from_mono_method (VerifyContext *ctx, MonoMethod *method)
 {
        MonoType *res = g_new0 (MonoType, 1);
-       MEM_ALLOC (sizeof (MonoType));
+       _MEM_ALLOC (sizeof (MonoType));
 
        //FIXME use mono_method_get_signature_full
        res->data.method = mono_method_signature (method);
@@ -1500,13 +1500,13 @@ ensure_stack_size (ILCodeDesc *stack, int required)
        g_assert (new_size >= required);
 
        tmp = g_new0 (ILStackDesc, new_size);
-       MEM_ALLOC (sizeof (ILStackDesc) * new_size);
+       _MEM_ALLOC (sizeof (ILStackDesc) * new_size);
 
        if (stack->stack) {
                if (stack->size)
                        memcpy (tmp, stack->stack, stack->size * sizeof (ILStackDesc));
                g_free (stack->stack);
-               MEM_FREE (sizeof (ILStackDesc) * stack->max_size);
+               _MEM_FREE (sizeof (ILStackDesc) * stack->max_size);
        }
 
        stack->stack = tmp;
@@ -4851,19 +4851,19 @@ mono_method_verify (MonoMethod *method, int level)
 
        ctx.code = g_new (ILCodeDesc, ctx.header->code_size);
        ctx.code_size = ctx.header->code_size;
-       MEM_ALLOC (sizeof (ILCodeDesc) * ctx.header->code_size);
+       _MEM_ALLOC (sizeof (ILCodeDesc) * ctx.header->code_size);
 
        memset(ctx.code, 0, sizeof (ILCodeDesc) * ctx.header->code_size);
 
        ctx.num_locals = ctx.header->num_locals;
        ctx.locals = g_memdup (ctx.header->locals, sizeof (MonoType*) * ctx.header->num_locals);
-       MEM_ALLOC (sizeof (MonoType*) * ctx.header->num_locals);
+       _MEM_ALLOC (sizeof (MonoType*) * ctx.header->num_locals);
 
        if (ctx.num_locals > 0 && !ctx.header->init_locals)
                CODE_NOT_VERIFIABLE (&ctx, g_strdup_printf ("Method with locals variable but without init locals set"));
 
        ctx.params = g_new (MonoType*, ctx.max_args);
-       MEM_ALLOC (sizeof (MonoType*) * ctx.max_args);
+       _MEM_ALLOC (sizeof (MonoType*) * ctx.max_args);
 
        if (ctx.signature->hasthis)
                ctx.params [0] = method->klass->valuetype ? &method->klass->this_arg : &method->klass->byval_arg;