bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix some compiler warnings in gnumach


From: Flavio Cruz
Subject: [PATCH] fix some compiler warnings in gnumach
Date: Thu, 31 Dec 2015 19:08:19 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Fix some compiler warnings.

* linux/dev/glue/block.c (out): Cast to device_t.
* linux/dev/glue/block.c (device_get_status): Cast to struct disk_params *.
* linux/dev/init/main.c (alloc_contig_mem): Initialize addr and cast return 
value to void *.
* i386/i386/phys.c (pmap_copy_page): Initialize src_map.
* i386/i386at/lpr.c (lpropen): Define caddr to avoid warnings.
* i386/intel/pmap.c: Include i386at/model_dep.h.
* kern/mach_clock.c (mapable_time_init): Cast to void *.
* kern/slab.c: Define wrapper to db_printf that returns an int.

---
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c
index da4ef38..4060e65 100644
--- a/linux/dev/glue/block.c
+++ b/linux/dev/glue/block.c
@@ -1157,7 +1157,7 @@ out:
            {
              ipc_kobject_set (bd->port, IKO_NULL, IKOT_NONE);
              ipc_port_dealloc_kernel (bd->port);
-             *devp = IP_NULL;
+             *devp = (device_t) IP_NULL;
            }
          kfree ((vm_offset_t) bd, sizeof (struct block_data));
          bd = NULL;
@@ -1666,7 +1666,7 @@ device_get_status (void *d, dev_flavor_t flavor, 
dev_status_t status,
        return D_INVALID_OPERATION;
       else
        {
-         struct disk_parms *dp = status;
+         struct disk_parms *dp = (struct disk_parms *) status;
          struct hd_geometry hg;
          DECL_DATA;
 
diff --git a/linux/dev/init/main.c b/linux/dev/init/main.c
index ecbd0b6..8737b62 100644
--- a/linux/dev/init/main.c
+++ b/linux/dev/init/main.c
@@ -193,7 +193,7 @@ alloc_contig_mem (unsigned size, unsigned limit,
   unsigned *bits, len;
   void *m;
   vm_page_t p, page_list, tail, prev;
-  vm_offset_t addr, max_addr;
+  vm_offset_t addr = 0, max_addr;
 
   if (size == 0)
     return (NULL);
@@ -296,7 +296,7 @@ alloc_contig_mem (unsigned size, unsigned limit,
   kfree ((vm_offset_t) bits, bits_len);
   if (pages)
     *pages = page_list;
-  return phystokv(m);
+  return (void *) phystokv(m);
 }
 
 /*

diff --git a/i386/i386/phys.c b/i386/i386/phys.c
index d55bdd9..8681fba 100644
--- a/i386/i386/phys.c
+++ b/i386/i386/phys.c
@@ -77,7 +77,8 @@ pmap_copy_page(
        vm_offset_t dst)
 {
        vm_offset_t src_addr_v, dst_addr_v;
-       pmap_mapwindow_t *src_map, *dst_map;
+       pmap_mapwindow_t *src_map = NULL;
+       pmap_mapwindow_t *dst_map;
        boolean_t src_mapped = src >= phys_last_addr;
        boolean_t dst_mapped = dst >= phys_last_addr;
        assert(src != vm_page_fictitious_addr);
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index edeef9f..6842052 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -114,13 +114,14 @@ int unit = minor(dev);
 struct bus_device *isai;
 struct tty *tp;
 u_short addr;
-  
+caddr_t *caddr = (caddr_t *) &addr;
+
        if (unit >= NLPR || (isai = lprinfo[unit]) == 0 || isai->alive == 0)
                return (D_NO_SUCH_DEVICE);
        tp = &lpr_tty[unit];
        addr = (u_short) isai->address;
        tp->t_dev = dev;
-       tp->t_addr = *(caddr_t *)&addr;
+       tp->t_addr = *caddr;
        tp->t_oproc = lprstart;
        tp->t_state |= TS_WOPEN;
        tp->t_stop = lprstop;
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index cf7a736..22e20c9 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -83,6 +83,7 @@
 #include <i386/proc_reg.h>
 #include <i386/locore.h>
 #include <i386/model_dep.h>
+#include <i386at/model_dep.h>
 
 #ifdef MACH_PSEUDO_PHYS
 #define        WRITE_PTE(pte_p, pte_entry)             *(pte_p) = 
pte_entry?pa_to_ma(pte_entry):0;
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index c6e2d9d..3789571 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -539,7 +539,7 @@ void mapable_time_init(void)
        if (kmem_alloc_wired(kernel_map, (vm_offset_t *) &mtime, PAGE_SIZE)
                                                != KERN_SUCCESS)
                panic("mapable_time_init");
-       memset(mtime, 0, PAGE_SIZE);
+       memset((void *) mtime, 0, PAGE_SIZE);
        update_mapped_time(&time);
 }
 
diff --git a/kern/slab.c b/kern/slab.c
index 4f32c8e..99d7c78 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -1480,9 +1480,21 @@ void slab_info(void)
 #if MACH_KDB
 #include <ddb/db_output.h>
 
- void db_show_slab_info(void)
+static int
+db_printf_wrapper(const char* fmt, ...)
 {
-    _slab_info(db_printf);
+    va_list    listp;
+
+    va_start(listp, fmt);
+    db_printf(fmt, listp);
+    va_end(listp);
+
+    return 0;
+}
+
+void db_show_slab_info(void)
+{
+    _slab_info(db_printf_wrapper);
 }
 
 #endif /* MACH_KDB */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]