I've made a small patch to make most of the mono/mono subdir compile
without warnings. Please verify that I've not introduced some strange
error. Particularly in the assembly code (a change which actually
makes it compile in gcc-3.1).

If this is ok, part 2 coming when I have more time...

-- 
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");
? warnings_part1.diff
Index: io-layer/atomic.h
===================================================================
RCS file: /mono/mono/mono/io-layer/atomic.h,v
retrieving revision 1.4
diff -u -b -B -r1.4 atomic.h
--- io-layer/atomic.h   9 May 2002 13:10:18 -0000       1.4
+++ io-layer/atomic.h   1 Jun 2002 00:03:32 -0000
@@ -33,7 +33,7 @@
 
        __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
                              : "=m" (*dest), "=a" (old)
-                             : "r" (exch), "0" (*dest), "a" (comp));   
+                             : "r" (exch), "m" (*dest), "a" (comp));   
        return(old);
 }
 
@@ -43,7 +43,7 @@
 
        __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
                              : "=m" (*dest), "=a" (old)
-                             : "r" (exch), "0" (*dest), "a" (comp));   
+                             : "r" (exch), "m" (*dest), "a" (comp));   
        return(old);
 }
 
@@ -53,7 +53,7 @@
        
        __asm__ __volatile__ ("lock; xaddl %0, %1"
                              : "=r" (tmp), "=m" (*val)
-                             : "0" (1), "1" (*val));
+                             : "0" (1), "m" (*val));
 
        return(tmp+1);
 }
@@ -64,7 +64,7 @@
        
        __asm__ __volatile__ ("lock; xaddl %0, %1"
                              : "=r" (tmp), "=m" (*val)
-                             : "0" (-1), "1" (*val));
+                             : "0" (-1), "m" (*val));
 
        return(tmp-1);
 }
@@ -80,7 +80,7 @@
        
        __asm__ __volatile__ ("1:; lock; cmpxchgl %2, %0; jne 1b"
                              : "=m" (*val), "=a" (ret)
-                             : "r" (new), "0" (*val), "a" (*val));
+                             : "r" (new), "m" (*val), "a" (*val));
 
        return(ret);
 }
@@ -92,7 +92,7 @@
        
        __asm__ __volatile__ ("1:; lock; cmpxchgl %2, %0; jne 1b"
                              : "=m" (*val), "=a" (ret)
-                             : "r" (new), "0" (*val), "a" (*val));
+                             : "r" (new), "m" (*val), "a" (*val));
 
        return(ret);
 }
@@ -103,7 +103,7 @@
        
        __asm__ __volatile__ ("lock; xaddl %0, %1"
                              : "=r" (ret), "=m" (*val)
-                             : "0" (add), "1" (*val));
+                             : "0" (add), "m" (*val));
        
        return(ret);
 }
Index: metadata/appdomain.c
===================================================================
RCS file: /mono/mono/mono/metadata/appdomain.c,v
retrieving revision 1.35
diff -u -b -B -r1.35 appdomain.c
--- metadata/appdomain.c        31 May 2002 10:14:30 -0000      1.35
+++ metadata/appdomain.c        1 Jun 2002 00:03:32 -0000
@@ -345,9 +345,9 @@
 
        /* FIXME : examine version, culture info */
 
-       name = aname.name = mono_string_to_utf8 (assRef->name);
+       name = mono_string_to_utf8 (assRef->name);
 
-       ass = mono_assembly_load (&aname, NULL, &status);
+       ass = mono_assembly_load (name, NULL, &status);
        
        g_free (name);
 
Index: metadata/appdomain.h
===================================================================
RCS file: /mono/mono/mono/metadata/appdomain.h,v
retrieving revision 1.18
diff -u -b -B -r1.18 appdomain.h
--- metadata/appdomain.h        23 May 2002 07:44:00 -0000      1.18
+++ metadata/appdomain.h        1 Jun 2002 00:03:32 -0000
@@ -65,7 +65,7 @@
        GHashTable         *env;
        GHashTable         *assemblies;
        MonoAppDomainSetup *setup;
-       char*              *friendly_name;
+       char               *friendly_name;
        MonoGHashTable     *ldstr_table;
        MonoGHashTable     *class_vtable_hash;
        MonoGHashTable     *proxy_vtable_hash;
Index: metadata/assembly.c
===================================================================
RCS file: /mono/mono/mono/metadata/assembly.c,v
retrieving revision 1.39
diff -u -b -B -r1.39 assembly.c
--- metadata/assembly.c 23 May 2002 07:44:00 -0000      1.39
+++ metadata/assembly.c 1 Jun 2002 00:03:32 -0000
@@ -55,7 +55,7 @@
 static MonoAssembly *corlib;
 
 static MonoAssembly*
-search_loaded (MonoAssemblyName* aname)
+search_loaded (const char *aname)
 {
        GList *tmp;
        MonoAssembly *ass;
@@ -64,7 +64,7 @@
                ass = tmp->data;
                /* we just compare the name, but later we'll do all the checks */
                /* g_print ("compare %s %s\n", aname->name, ass->aname.name); */
-               if (strcmp (aname->name, ass->aname.name))
+               if (strcmp (aname, ass->aname.name))
                        continue;
                /* g_print ("success\n"); */
                return ass;
@@ -189,7 +189,7 @@
        ass->aname.revision = cols [MONO_ASSEMBLY_REV_NUMBER];
 
        /* avoid loading the same assembly twixe for now... */
-       if ((ass2 = search_loaded (&ass->aname))) {
+       if ((ass2 = search_loaded (ass->aname.name))) {
                g_free (ass);
                if (status)
                        *status = MONO_IMAGE_OK;
@@ -222,7 +222,7 @@
                aname.build = cols [MONO_ASSEMBLYREF_BUILD_NUMBER];
                aname.revision = cols [MONO_ASSEMBLYREF_REV_NUMBER];
 
-               image->references [i] = mono_assembly_load (&aname, base_dir, status);
+               image->references [i] = mono_assembly_load (aname.name, base_dir, 
+status);
 
                if (image->references [i] == NULL){
                        int j;
@@ -262,16 +262,16 @@
 }
 
 MonoAssembly*
-mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus 
*status)
+mono_assembly_load (const char * toload, const char *basedir, MonoImageOpenStatus 
+*status)
 {
        MonoAssembly *result;
        char *fullpath, *filename;
 
        check_env ();
 
-       /* g_print ("loading %s\n", aname->name); */
+       /* g_print ("loading %s\n", toload); */
        /* special case corlib */
-       if ((strcmp (aname->name, "mscorlib") == 0) || (strcmp (aname->name, "corlib") 
== 0)) {
+       if ((strcmp (toload, "mscorlib") == 0) || (strcmp (toload, "corlib") == 0)) {
                if (corlib) {
                        /* g_print ("corlib already loaded\n"); */
                        return corlib;
@@ -282,17 +282,17 @@
                        if (corlib)
                                return corlib;
                }
-               corlib = load_in_path (CORLIB_NAME, default_path, status);
+               corlib = load_in_path (CORLIB_NAME, (char**)default_path, status);
                return corlib;
        }
-       result = search_loaded (aname);
+       result = search_loaded (toload);
        if (result)
                return result;
-       /* g_print ("%s not found in cache\n", aname->name); */
-       if (strstr (aname->name, ".dll"))
-               filename = g_strdup (aname->name);
+       /* g_print ("%s not found in cache\n", toload); */
+       if (strstr (toload, ".dll"))
+               filename = g_strdup (toload);
        else
-               filename = g_strconcat (aname->name, ".dll", NULL);
+               filename = g_strconcat (toload, ".dll", NULL);
        if (basedir) {
                fullpath = g_concat_dir_and_file (basedir, filename);
                result = mono_assembly_open (fullpath, status);
@@ -309,7 +309,7 @@
                        return result;
                }
        }
-       result = load_in_path (filename, default_path, status);
+       result = load_in_path (filename, (char**)default_path, status);
        g_free (filename);
        return result;
 }
Index: metadata/assembly.h
===================================================================
RCS file: /mono/mono/mono/metadata/assembly.h,v
retrieving revision 1.12
diff -u -b -B -r1.12 assembly.h
--- metadata/assembly.h 18 May 2002 17:41:44 -0000      1.12
+++ metadata/assembly.h 1 Jun 2002 00:03:32 -0000
@@ -7,7 +7,7 @@
 
 MonoAssembly *mono_assembly_open       (const char *filename,
                                        MonoImageOpenStatus *status);
-MonoAssembly* mono_assembly_load       (MonoAssemblyName *aname, 
+MonoAssembly* mono_assembly_load       (const char *toload, 
                                                const char       *basedir, 
                                        MonoImageOpenStatus *status);
 void          mono_assembly_close      (MonoAssembly *assembly);
Index: metadata/domain.c
===================================================================
RCS file: /mono/mono/mono/metadata/domain.c,v
retrieving revision 1.5
diff -u -b -B -r1.5 domain.c
--- metadata/domain.c   31 May 2002 10:14:30 -0000      1.5
+++ metadata/domain.c   1 Jun 2002 00:03:32 -0000
@@ -189,7 +189,7 @@
 
        /* find the corlib */
        corlib_aname.name = "corlib";
-       ass = mono_assembly_load (&corlib_aname, NULL, &status);
+       ass = mono_assembly_load (corlib_aname.name, NULL, &status);
        if ((status != MONO_IMAGE_OK) || (ass == NULL)) {
                switch (status){
                case MONO_IMAGE_ERROR_ERRNO:
@@ -203,6 +203,7 @@
                        g_print ("Minning assembly reference in %s/corlib.dll\n", 
MONO_ASSEMBLIES);
                        break;
                case MONO_IMAGE_OK:
+                       break;
                        /* to suppress compiler warning */
                }
                
@@ -387,13 +388,13 @@
                return NULL;
 
        mono_domain_lock (domain);
-       g_hash_table_insert (domain->assemblies, ass->aname.name, ass);
+       g_hash_table_insert (domain->assemblies, (gpointer)ass->aname.name, ass);
        mono_domain_unlock (domain);
 
        /* FIXME: maybe this must be recursive ? */
        for (i = 0; (tmp = ass->image->references [i]) != NULL; i++) {
                if (!g_hash_table_lookup (domain->assemblies, tmp->aname.name))
-                       g_hash_table_insert (domain->assemblies, tmp->aname.name, tmp);
+                       g_hash_table_insert (domain->assemblies, 
+(gpointer)tmp->aname.name, tmp);
        }
 
        return ass;
Index: metadata/gc.c
===================================================================
RCS file: /mono/mono/mono/metadata/gc.c,v
retrieving revision 1.7
diff -u -b -B -r1.7 gc.c
--- metadata/gc.c       23 May 2002 13:00:19 -0000      1.7
+++ metadata/gc.c       1 Jun 2002 00:03:32 -0000
@@ -7,6 +7,7 @@
  */
 
 #include <config.h>
+#include <string.h>
 #include <glib.h>
 
 #include <mono/metadata/gc.h>
Index: metadata/icall.c
===================================================================
RCS file: /mono/mono/mono/metadata/icall.c,v
retrieving revision 1.155
diff -u -b -B -r1.155 icall.c
--- metadata/icall.c    30 May 2002 15:19:04 -0000      1.155
+++ metadata/icall.c    1 Jun 2002 00:03:33 -0000
@@ -166,7 +166,7 @@
 }G_STMT_END
 
 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
-       if (esize < vsize + ## extra) \
+       if (esize < vsize + extra) \
                mono_raise_exception (mono_get_exception_argument ( \
                        "value", "not a widening conversion")); \
 }G_STMT_END
@@ -236,7 +236,7 @@
        case MONO_TYPE_U8: \
        case MONO_TYPE_CHAR: \
                CHECK_WIDENING_CONVERSION(0); \
-               *(## etype *) ea = (## etype) u64; \
+               *(etype *) ea = (etype) u64; \
                return; \
        /* You can't assign a signed value to an unsigned array. */ \
        case MONO_TYPE_I1: \
@@ -257,7 +257,7 @@
        case MONO_TYPE_I4: \
        case MONO_TYPE_I8: \
                CHECK_WIDENING_CONVERSION(0); \
-               *(## etype *) ea = (## etype) i64; \
+               *(etype *) ea = (etype) i64; \
                return; \
        /* You can assign an unsigned value to a signed array if the array's */ \
        /* element size is larger than the value size. */ \
@@ -267,7 +267,7 @@
        case MONO_TYPE_U8: \
        case MONO_TYPE_CHAR: \
                CHECK_WIDENING_CONVERSION(1); \
-               *(## etype *) ea = (## etype) u64; \
+               *(etype *) ea = (etype) u64; \
                return; \
        /* You can't assign a floating point number to an integer array. */ \
        case MONO_TYPE_R4: \
@@ -281,7 +281,7 @@
        case MONO_TYPE_R4: \
        case MONO_TYPE_R8: \
                CHECK_WIDENING_CONVERSION(0); \
-               *(## etype *) ea = (## etype) r64; \
+               *(etype *) ea = (etype) r64; \
                return; \
        /* All integer values fit into a floating point array, so we don't */ \
        /* need to CHECK_WIDENING_CONVERSION here. */ \
@@ -289,14 +289,14 @@
        case MONO_TYPE_I2: \
        case MONO_TYPE_I4: \
        case MONO_TYPE_I8: \
-               *(## etype *) ea = (## etype) i64; \
+               *(etype *) ea = (etype) i64; \
                return; \
        case MONO_TYPE_U1: \
        case MONO_TYPE_U2: \
        case MONO_TYPE_U4: \
        case MONO_TYPE_U8: \
        case MONO_TYPE_CHAR: \
-               *(## etype *) ea = (## etype) u64; \
+               *(etype *) ea = (etype) u64; \
                return; \
        } \
 }G_STMT_END
@@ -2624,7 +2624,7 @@
        int i = 0;
 
        while ((name = icall_map [i])) {
-               mono_add_internal_call (name, icall_map [i+1]);
+               mono_add_internal_call (name, (gpointer)(icall_map [i+1]));
                i += 2;
        }
        
Index: metadata/loader.c
===================================================================
RCS file: /mono/mono/mono/metadata/loader.c,v
retrieving revision 1.66
diff -u -b -B -r1.66 loader.c
--- metadata/loader.c   31 May 2002 10:14:30 -0000      1.66
+++ metadata/loader.c   1 Jun 2002 00:03:33 -0000
@@ -39,7 +39,7 @@
 static GHashTable *icall_hash = NULL;
 
 void
-mono_add_internal_call (const char *name, gconstpointer method)
+mono_add_internal_call (const char *name, gpointer method)
 {
        if (!icall_hash) {
                dummy_icall = FALSE;
Index: metadata/loader.h
===================================================================
RCS file: /mono/mono/mono/metadata/loader.h,v
retrieving revision 1.29
diff -u -b -B -r1.29 loader.h
--- metadata/loader.h   31 May 2002 07:24:33 -0000      1.29
+++ metadata/loader.h   1 Jun 2002 00:03:33 -0000
@@ -85,7 +85,7 @@
 mono_load_image            (const char *fname, MonoImageOpenStatus *status);
 
 void
-mono_add_internal_call     (const char *name, gconstpointer method);
+mono_add_internal_call     (const char *name, gpointer method);
 
 gpointer
 mono_lookup_internal_call (MonoMethod *method);
Index: metadata/metadata.c
===================================================================
RCS file: /mono/mono/mono/metadata/metadata.c,v
retrieving revision 1.83
diff -u -b -B -r1.83 metadata.c
--- metadata/metadata.c 31 May 2002 09:50:46 -0000      1.83
+++ metadata/metadata.c 1 Jun 2002 00:03:33 -0000
@@ -2182,19 +2182,21 @@
  * Computes an hash value for @t1 to be used in GHashTable.
  */
 guint
-mono_metadata_type_hash (MonoType *t1)
+//mono_metadata_type_hash (const MonoType *t1)
+mono_metadata_type_hash (gconstpointer t1)
 {
-       guint hash = t1->type;
+        const MonoType* tt1 = (const MonoType*) t1;
+       guint hash = tt1->type;
 
-       hash |= t1->byref << 6; /* do not collide with t1->type values */
-       switch (t1->type) {
+       hash |= tt1->byref << 6; /* do not collide with tt1->type values */
+       switch (tt1->type) {
        case MONO_TYPE_VALUETYPE:
        case MONO_TYPE_CLASS:
                /* check if the distribution is good enough */
-               return hash << 7 | g_str_hash (t1->data.klass->name);
+               return hash << 7 | g_str_hash (tt1->data.klass->name);
        case MONO_TYPE_PTR:
        case MONO_TYPE_SZARRAY:
-               return hash << 7 | mono_metadata_type_hash (t1->data.type);
+               return hash << 7 | mono_metadata_type_hash (tt1->data.type);
        }
        return hash;
 }
@@ -2208,13 +2210,16 @@
  * Returns: #TRUE if @t1 and @t2 are equal.
  */
 gboolean
-mono_metadata_type_equal (MonoType *t1, MonoType *t2)
+//mono_metadata_type_equal (const MonoType *t1, const MonoType *t2)
+mono_metadata_type_equal (gconstpointer t1, gconstpointer t2)
 {
-       if (t1->type != t2->type ||
-           t1->byref != t2->byref)
+        const MonoType* tt1 = (const MonoType*) t1;
+       const MonoType* tt2 = (const MonoType*) t2;
+       if (tt1->type != tt2->type ||
+           tt1->byref != tt2->byref)
                return FALSE;
 
-       switch (t1->type) {
+       switch (tt1->type) {
        case MONO_TYPE_VOID:
        case MONO_TYPE_BOOLEAN:
        case MONO_TYPE_CHAR:
@@ -2235,16 +2240,16 @@
                return TRUE;
        case MONO_TYPE_VALUETYPE:
        case MONO_TYPE_CLASS:
-               return t1->data.klass == t2->data.klass;
+               return tt1->data.klass == tt2->data.klass;
        case MONO_TYPE_PTR:
        case MONO_TYPE_SZARRAY:
-               return mono_metadata_type_equal (t1->data.type, t2->data.type);
+               return mono_metadata_type_equal (tt1->data.type, tt2->data.type);
        case MONO_TYPE_ARRAY:
-               if (t1->data.array->rank != t2->data.array->rank)
+               if (tt1->data.array->rank != tt2->data.array->rank)
                        return FALSE;
-               return mono_metadata_type_equal (t1->data.array->type, 
t2->data.array->type);
+               return mono_metadata_type_equal (tt1->data.array->type, 
+tt2->data.array->type);
        default:
-               g_error ("implement type compare for %0x!", t1->type);
+               g_error ("implement type compare for %0x!", tt1->type);
                return FALSE;
        }
 
Index: metadata/metadata.h
===================================================================
RCS file: /mono/mono/mono/metadata/metadata.h,v
retrieving revision 1.56
diff -u -b -B -r1.56 metadata.h
--- metadata/metadata.h 30 May 2002 08:33:27 -0000      1.56
+++ metadata/metadata.h 1 Jun 2002 00:03:33 -0000
@@ -257,8 +257,9 @@
 int            mono_type_stack_size            (MonoType        *type, 
                                                int             *alignment);
 
-guint          mono_metadata_type_hash         (MonoType *t1);
-gboolean       mono_metadata_type_equal        (MonoType *t1, MonoType *t2);
+guint          mono_metadata_type_hash         (gconstpointer t1);
+//gboolean       mono_metadata_type_equal        (const MonoType *t1, const MonoType 
+*t2);
+gboolean       mono_metadata_type_equal        (gconstpointer t1, gconstpointer t2);
 
 MonoMethodSignature  *mono_metadata_parse_signature (MonoImage *image, 
                                                     guint32    token);
Index: metadata/mono-config.c
===================================================================
RCS file: /mono/mono/mono/metadata/mono-config.c,v
retrieving revision 1.1
diff -u -b -B -r1.1 mono-config.c
--- metadata/mono-config.c      31 May 2002 07:24:33 -0000      1.1
+++ metadata/mono-config.c      1 Jun 2002 00:03:33 -0000
@@ -7,7 +7,9 @@
  *
  * (C) 2002 Ximian, Inc.
  */
+#include <config.h>
 #include <glib.h>
+#include <string.h>
 #include "mono/metadata/loader.h"
 #include "mono/metadata/mono-config.h"
 
@@ -188,7 +190,7 @@
        g_free (info);
 }
 
-static const MonoParseHandler
+static MonoParseHandler
 dllmap_handler = {
        "dllmap",
        dllmap_init,
@@ -206,7 +208,7 @@
 {
        inited = 1;
        config_handlers = g_hash_table_new (g_str_hash, g_str_equal);
-       g_hash_table_insert (config_handlers, dllmap_handler.element_name, 
&dllmap_handler);
+       g_hash_table_insert (config_handlers, (gpointer)dllmap_handler.element_name, 
+&dllmap_handler);
 }
 
 /* FIXME: error handling */
Index: metadata/pedump.c
===================================================================
RCS file: /mono/mono/mono/metadata/pedump.c,v
retrieving revision 1.24
diff -u -b -B -r1.24 pedump.c
--- metadata/pedump.c   28 Mar 2002 11:10:56 -0000      1.24
+++ metadata/pedump.c   1 Jun 2002 00:03:33 -0000
@@ -21,6 +21,7 @@
 gboolean dump_data = TRUE;
 gboolean verify_pe = FALSE;
 
+/* not used
 static void
 hex_dump (const char *buffer, int base, int count)
 {
@@ -33,7 +34,7 @@
                printf ("%02x ", (unsigned char) (buffer [i]));
        }
 }
-
+*/
 static void
 hex8 (const char *label, unsigned char x)
 {
Index: os/unix/.cvsignore
===================================================================
RCS file: /mono/mono/mono/os/unix/.cvsignore,v
retrieving revision 1.1
diff -u -b -B -r1.1 .cvsignore
--- os/unix/.cvsignore  18 May 2002 17:32:36 -0000      1.1
+++ os/unix/.cvsignore  1 Jun 2002 00:03:34 -0000
@@ -1,3 +1,4 @@
+.deps
 Makefile
 Makefile.in
 util.o
Index: utils/strtod.c
===================================================================
RCS file: /mono/mono/mono/utils/strtod.c,v
retrieving revision 1.1
diff -u -b -B -r1.1 strtod.c
--- utils/strtod.c      13 May 2002 22:43:03 -0000      1.1
+++ utils/strtod.c      1 Jun 2002 00:03:34 -0000
@@ -1922,9 +1922,9 @@
                *decpt = 9999;
                s =
 #ifdef IEEE_Arith
-                       !word1(d) && !(word0(d) & 0xfffff) ? "Infinity" :
+                       !word1(d) && !(word0(d) & 0xfffff) ? (char*)"Infinity" :
 #endif
-                               "NaN";
+                               (char*)"NaN";
                if (rve)
                        *rve =
 #ifdef IEEE_Arith
@@ -1939,7 +1939,7 @@
 #endif
        if (!d) {
                *decpt = 1;
-               s = "0";
+               s = (char*)"0";
                if (rve)
                        *rve = s + 1;
                return s;

Reply via email to