NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/39266: NetBSD/amd64 doesn't build with -Wextra
>Number: 39266
>Category: kern
>Synopsis: NetBSD/amd64 doesn't build with -Wextra
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 01 18:10:00 +0000 2008
>Originator: Juan RP
>Release: Latest and greatest
>Organization:
Not NetBSD
>Environment:
NetBSD sasha 4.99.71 NetBSD 4.99.71 (MASTER) #5: Thu Jul 31 22:05:45 CEST 2008
juan@sasha:/home/juan/build/obj/sys/arch/amd64/compile/MASTER amd64
>Description:
After looking at Makefile.kern.inc more deeply, I've found the following:
. if ${MACHINE} == "i386" || ...
CWARNFLAGS+= -Wextra -Wno-unused-parameter
. endif
. endif
.endif
Only i386, sparc64 and prep are built with -Wextra. Therefore I've made a set
of patches to allow building all the amd64 kernels with -Wextra.
INSTALL, GENERIC, XEN2_DOM{0,U} and INSTALL_XEN3_DOMU are compile tested.
>How-To-Repeat:
>Fix:
Apply the following patch:
-----------------
START OF PATCHES
-----------------
Index: arch/amd64/amd64/db_trace.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/db_trace.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 db_trace.c
--- arch/amd64/amd64/db_trace.c 2 Jul 2008 19:49:58 -0000 1.13
+++ arch/amd64/amd64/db_trace.c 1 Aug 2008 17:44:56 -0000
@@ -52,30 +52,30 @@ static int db_x86_64_regop(const struct
* Machine register set.
*/
const struct db_variable db_regs[] = {
- { "ds", dbreg(ds), db_x86_64_regop },
- { "es", dbreg(es), db_x86_64_regop },
- { "fs", dbreg(fs), db_x86_64_regop },
- { "gs", dbreg(gs), db_x86_64_regop },
- { "rdi", dbreg(rdi), db_x86_64_regop },
- { "rsi", dbreg(rsi), db_x86_64_regop },
- { "rbp", dbreg(rbp), db_x86_64_regop },
- { "rbx", dbreg(rbx), db_x86_64_regop },
- { "rdx", dbreg(rdx), db_x86_64_regop },
- { "rcx", dbreg(rcx), db_x86_64_regop },
- { "rax", dbreg(rax), db_x86_64_regop },
- { "r8", dbreg(r8), db_x86_64_regop },
- { "r9", dbreg(r9), db_x86_64_regop },
- { "r10", dbreg(r10), db_x86_64_regop },
- { "r11", dbreg(r11), db_x86_64_regop },
- { "r12", dbreg(r12), db_x86_64_regop },
- { "r13", dbreg(r13), db_x86_64_regop },
- { "r14", dbreg(r14), db_x86_64_regop },
- { "r15", dbreg(r15), db_x86_64_regop },
- { "rip", dbreg(rip), db_x86_64_regop },
- { "cs", dbreg(cs), db_x86_64_regop },
- { "rflags", dbreg(rflags), db_x86_64_regop },
- { "rsp", dbreg(rsp), db_x86_64_regop },
- { "ss", dbreg(ss), db_x86_64_regop },
+ { "ds", dbreg(ds), db_x86_64_regop, NULL },
+ { "es", dbreg(es), db_x86_64_regop, NULL },
+ { "fs", dbreg(fs), db_x86_64_regop, NULL },
+ { "gs", dbreg(gs), db_x86_64_regop, NULL },
+ { "rdi", dbreg(rdi), db_x86_64_regop, NULL },
+ { "rsi", dbreg(rsi), db_x86_64_regop, NULL },
+ { "rbp", dbreg(rbp), db_x86_64_regop, NULL },
+ { "rbx", dbreg(rbx), db_x86_64_regop, NULL },
+ { "rdx", dbreg(rdx), db_x86_64_regop, NULL },
+ { "rcx", dbreg(rcx), db_x86_64_regop, NULL },
+ { "rax", dbreg(rax), db_x86_64_regop, NULL },
+ { "r8", dbreg(r8), db_x86_64_regop, NULL },
+ { "r9", dbreg(r9), db_x86_64_regop, NULL },
+ { "r10", dbreg(r10), db_x86_64_regop, NULL },
+ { "r11", dbreg(r11), db_x86_64_regop, NULL },
+ { "r12", dbreg(r12), db_x86_64_regop, NULL },
+ { "r13", dbreg(r13), db_x86_64_regop, NULL },
+ { "r14", dbreg(r14), db_x86_64_regop, NULL },
+ { "r15", dbreg(r15), db_x86_64_regop, NULL },
+ { "rip", dbreg(rip), db_x86_64_regop, NULL },
+ { "cs", dbreg(cs), db_x86_64_regop, NULL },
+ { "rflags", dbreg(rflags), db_x86_64_regop, NULL },
+ { "rsp", dbreg(rsp), db_x86_64_regop, NULL },
+ { "ss", dbreg(ss), db_x86_64_regop, NULL },
};
const struct db_variable * const db_eregs =
db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
Index: arch/amd64/amd64/mem.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/mem.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 mem.c
--- arch/amd64/amd64/mem.c 13 Feb 2008 12:48:11 -0000 1.13
+++ arch/amd64/amd64/mem.c 1 Aug 2008 17:44:56 -0000
@@ -108,7 +108,7 @@ dev_type_mmap(mmmmap);
const struct cdevsw mem_cdevsw = {
nullopen, nullclose, mmrw, mmrw, mmioctl,
- nostop, notty, nopoll, mmmmap, nokqfilter
+ nostop, notty, nopoll, mmmmap, nokqfilter, D_OTHER
};
int check_pa_acc(paddr_t, vm_prot_t);
Index: arch/xen/include/hypervisor.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/hypervisor.h,v
retrieving revision 1.25
diff -b -u -p -r1.25 hypervisor.h
--- arch/xen/include/hypervisor.h 14 Apr 2008 13:38:03 -0000 1.25
+++ arch/xen/include/hypervisor.h 1 Aug 2008 17:45:12 -0000
@@ -128,7 +128,7 @@ extern union start_info_union start_info
#define xen_start_info (start_info_union.start_info)
/* For use in guest OSes. */
-volatile extern shared_info_t *HYPERVISOR_shared_info;
+extern volatile shared_info_t *HYPERVISOR_shared_info;
/* hypervisor.c */
struct intrframe;
Index: arch/xen/x86/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/intr.c,v
retrieving revision 1.20
diff -b -u -p -r1.20 intr.c
--- arch/xen/x86/intr.c 3 Jul 2008 14:02:25 -0000 1.20
+++ arch/xen/x86/intr.c 1 Aug 2008 17:45:13 -0000
@@ -131,11 +131,11 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
#include "ioapic.h"
#include "opt_mpbios.h"
/* for x86/i8259.c */
-struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0}};
+struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0,0}};
#if NIOAPIC > 0
/* for x86/ioapic.c */
-struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0}};
-struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0}};
+struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
+struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
#include <machine/i82093var.h>
int irq2vect[256] = {0};
Index: arch/xen/x86/x86_xpmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/x86_xpmap.c,v
retrieving revision 1.8
diff -b -u -p -r1.8 x86_xpmap.c
--- arch/xen/x86/x86_xpmap.c 14 Apr 2008 13:38:03 -0000 1.8
+++ arch/xen/x86/x86_xpmap.c 1 Aug 2008 17:45:13 -0000
@@ -819,11 +819,13 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
pte[pl1_pi(page)] |= PG_RW;
}
- if ((page >= old_pgd && page < old_pgd + (old_count *
PAGE_SIZE)) || page >= new_pgd)
+ if ((page >= old_pgd && page < old_pgd + (old_count *
PAGE_SIZE))
+ || page >= new_pgd) {
__PRINTK(("va 0x%lx pa 0x%lx "
"entry 0x%" PRIx64 " -> L1[0x%x]\n",
page, page - KERNBASE,
(int64_t)pte[pl1_pi(page)], pl1_pi(page)));
+ }
page += PAGE_SIZE;
}
Index: arch/xen/xen/xenevt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xenevt.c,v
retrieving revision 1.28
diff -b -u -p -r1.28 xenevt.c
--- arch/xen/xen/xenevt.c 7 Jun 2008 20:07:42 -0000 1.28
+++ arch/xen/xen/xenevt.c 1 Aug 2008 17:45:14 -0000
@@ -95,7 +95,7 @@ dev_type_read(xenevtread);
dev_type_mmap(xenevtmmap);
const struct cdevsw xenevt_cdevsw = {
xenevtopen, nullclose, xenevtread, nowrite, noioctl,
- nostop, notty, nopoll, xenevtmmap, nokqfilter,
+ nostop, notty, nopoll, xenevtmmap, nokqfilter, D_OTHER
};
/* minor numbers */
@@ -387,7 +387,7 @@ xenevt_fclose(struct file *fp)
for (i = 0; i < NR_EVENT_CHANNELS; i++ ) {
if (devevent[i] == d) {
#ifdef XEN3
- evtchn_op_t op = { 0 };
+ evtchn_op_t op = { .cmd = 0 };
int error;
#endif
hypervisor_mask_event(i);
@@ -519,7 +519,7 @@ xenevt_fioctl(struct file *fp, u_long cm
{
struct xenevt_d *d = fp->f_data;
#ifdef XEN3
- evtchn_op_t op = { 0 };
+ evtchn_op_t op = { .cmd = 0 };
int error;
#else
u_int *arg = addr;
Index: arch/xen/xen/xengnt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xengnt.c,v
retrieving revision 1.7
diff -b -u -p -r1.7 xengnt.c
--- arch/xen/xen/xengnt.c 27 Apr 2008 19:28:45 -0000 1.7
+++ arch/xen/xen/xengnt.c 1 Aug 2008 17:45:14 -0000
@@ -171,7 +171,7 @@ xengnt_get_entry()
grant_ref_t entry;
int s = splvm();
static struct timeval xengnt_nonmemtime;
- const static struct timeval xengnt_nonmemintvl = {5,0};
+ static const struct timeval xengnt_nonmemintvl = {5,0};
if (last_gnt_entry == 0) {
if (xengnt_more_entries()) {
Index: arch/xen/xenbus/xenbus_client.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_client.c,v
retrieving revision 1.8
diff -b -u -p -r1.8 xenbus_client.c
--- arch/xen/xenbus/xenbus_client.c 15 Dec 2007 00:39:24 -0000 1.8
+++ arch/xen/xenbus/xenbus_client.c 1 Aug 2008 17:45:15 -0000
@@ -241,8 +241,12 @@ xenbus_alloc_evtchn(struct xenbus_device
{
evtchn_op_t op = {
.cmd = EVTCHNOP_alloc_unbound,
- .u.alloc_unbound.dom = DOMID_SELF,
- .u.alloc_unbound.remote_dom = dev->xbusd_otherend_id };
+ .u.alloc_unbound = {
+ .dom = DOMID_SELF,
+ .remote_dom = dev->xbusd_otherend_id,
+ .port = 0
+ }
+ };
int err = HYPERVISOR_event_channel_op(&op);
if (err)
Index: arch/xen/xenbus/xenbus_probe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_probe.c,v
retrieving revision 1.21
diff -b -u -p -r1.21 xenbus_probe.c
--- arch/xen/xenbus/xenbus_probe.c 2 Jun 2008 20:54:59 -0000 1.21
+++ arch/xen/xenbus/xenbus_probe.c 1 Aug 2008 17:45:15 -0000
@@ -525,7 +525,7 @@ xenbus_probe_init(void *unused)
#if defined(DOM0OPS)
vaddr_t page;
paddr_t ma;
- evtchn_op_t op = { 0 };
+ evtchn_op_t op = { .cmd = 0 };
int ret;
/* Allocate page. */
Index: compat/linux/arch/amd64/linux_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_machdep.c,v
retrieving revision 1.30
diff -b -u -p -r1.30 linux_machdep.c
--- compat/linux/arch/amd64/linux_machdep.c 11 May 2008 17:13:43 -0000
1.30
+++ compat/linux/arch/amd64/linux_machdep.c 1 Aug 2008 17:45:16 -0000
@@ -473,10 +473,10 @@ linux_sys_rt_sigreturn(struct lwp *l, co
* And the stack
*/
uctx.uc_stack.ss_flags = 0;
- if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK);
+ if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK)
uctx.uc_stack.ss_flags = SS_ONSTACK;
- if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE);
+ if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE)
uctx.uc_stack.ss_flags = SS_DISABLE;
uctx.uc_stack.ss_sp = luctx->luc_stack.ss_sp;
Index: compat/linux32/common/linux32_exec.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_exec.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 linux32_exec.c
--- compat/linux32/common/linux32_exec.c 28 Apr 2008 20:23:44 -0000
1.13
+++ compat/linux32/common/linux32_exec.c 1 Aug 2008 17:45:17 -0000
@@ -116,6 +116,9 @@ const struct emul emul_linux32 = {
NULL,
NULL,
netbsd32_vm_default_addr,
+ NULL,
+ 0,
+ NULL
};
static void
---------------
END OF PATCHES
---------------
Don't forget to match "x86_64" into the if conditional on Makefile.kern.inc
after applying the patch!
Home |
Main Index |
Thread Index |
Old Index