Module Name:    src
Committed By:   christos
Date:           Wed Oct 16 18:29:49 UTC 2019

Modified Files:
        src/sys/arch/x86/isa: clock.c
        src/sys/arch/xen/xen: clock.c
        src/sys/kern: kern_core.c kern_hook.c kern_sig.c kern_veriexec.c
            subr_ipi.c subr_pool.c subr_vmem.c sys_ptrace_common.c
        src/sys/net: if_ethersubr.c
        src/sys/sys: cdefs.h sdt.h

Log Message:
Add and use __FPTRCAST, requested by uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/isa/clock.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/kern_core.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_hook.c
cvs rdiff -u -r1.374 -r1.375 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/kern_veriexec.c
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_ipi.c
cvs rdiff -u -r1.260 -r1.261 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.98 -r1.99 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.68 -r1.69 src/sys/kern/sys_ptrace_common.c
cvs rdiff -u -r1.279 -r1.280 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.146 -r1.147 src/sys/sys/cdefs.h
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/sdt.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/isa/clock.c
diff -u src/sys/arch/x86/isa/clock.c:1.35 src/sys/arch/x86/isa/clock.c:1.36
--- src/sys/arch/x86/isa/clock.c:1.35	Wed Oct 16 11:01:10 2019
+++ src/sys/arch/x86/isa/clock.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.35 2019/10/16 15:01:10 christos Exp $	*/
+/*	$NetBSD: clock.c,v 1.36 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -121,7 +121,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.35 2019/10/16 15:01:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.36 2019/10/16 18:29:49 christos Exp $");
 
 /* #define CLOCKDEBUG */
 /* #define CLOCK_PARANOIA */
@@ -554,7 +554,7 @@ i8254_initclocks(void)
 	 * want to keep track of clock handlers.
 	 */
 	(void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK,
-	    (int (*)(void *))(void *)clockintr, 0);
+	    __FPTRCAST(int (*)(void *), clockintr), 0);
 }
 
 void

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.79 src/sys/arch/xen/xen/clock.c:1.80
--- src/sys/arch/xen/xen/clock.c:1.79	Wed Oct 16 11:01:10 2019
+++ src/sys/arch/xen/xen/clock.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.79 2019/10/16 15:01:10 christos Exp $	*/
+/*	$NetBSD: clock.c,v 1.80 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.79 2019/10/16 15:01:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.80 2019/10/16 18:29:49 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -765,7 +765,8 @@ xen_resumeclocks(struct cpu_info *ci)
 	/* XXX sketchy function pointer cast -- fix the API, please */
 	ci->ci_xen_timer_intrhand = xen_intr_establish_xname(-1, &xen_pic,
 	    evtch, IST_LEVEL, IPL_CLOCK,
-	    (int (*)(void *))(void *)xen_timer_handler, ci, true, intr_xname);
+	    __FPTRCAST(int (*)(void *), xen_timer_handler),
+	    ci, true, intr_xname);
 	if (ci->ci_xen_timer_intrhand == NULL)
 		panic("failed to establish timer interrupt handler");
 

Index: src/sys/kern/kern_core.c
diff -u src/sys/kern/kern_core.c:1.25 src/sys/kern/kern_core.c:1.26
--- src/sys/kern/kern_core.c:1.25	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/kern_core.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_core.c,v 1.25 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: kern_core.c,v 1.26 2019/10/16 18:29:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.25 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.26 2019/10/16 18:29:49 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/vnode.h>
@@ -78,7 +78,8 @@ coredump_modcmd(modcmd_t cmd, void *arg)
 		 * no references, and so can be unloaded, no user programs
 		 * can be running and so nothing can call *coredump_vec.
 		 */
-		coredump_vec = (int (*)(struct lwp *, const char *))(void *)enosys;
+		coredump_vec = __FPTRCAST(
+		    int (*)(struct lwp *, const char *), enosys);
 		return 0;
 	default:
 		return ENOTTY;

Index: src/sys/kern/kern_hook.c
diff -u src/sys/kern/kern_hook.c:1.7 src/sys/kern/kern_hook.c:1.8
--- src/sys/kern/kern_hook.c:1.7	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/kern_hook.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_hook.c,v 1.7 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: kern_hook.c,v 1.8 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.7 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.8 2019/10/16 18:29:49 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -101,8 +101,10 @@ hook_proc_run(hook_list_t *list, struct 
 {
 	struct hook_desc *hd;
 
-	LIST_FOREACH(hd, list, hk_list)
-		((void (*)(struct proc *, void *))(void *)*hd->hk_fn)(p, hd->hk_arg);
+	LIST_FOREACH(hd, list, hk_list) {
+		__FPTRCAST(void (*)(struct proc *, void *), *hd->hk_fn)(p,
+		    hd->hk_arg);
+	}
 }
 
 /*
@@ -168,7 +170,8 @@ static hook_list_t mountroothook_list=LI
 void *
 mountroothook_establish(void (*fn)(device_t), device_t dev)
 {
-	return hook_establish(&mountroothook_list, (void (*)(void *))fn, dev);
+	return hook_establish(&mountroothook_list, __FPTRCAST(void (*), fn),
+	    dev);
 }
 
 void
@@ -201,7 +204,8 @@ static hook_list_t exechook_list = LIST_
 void *
 exechook_establish(void (*fn)(struct proc *, void *), void *arg)
 {
-	return hook_establish(&exechook_list, (void (*)(void *))(void *)fn, arg);
+	return hook_establish(&exechook_list, __FPTRCAST(void (*)(void *), fn),
+	    arg);
 }
 
 void
@@ -228,7 +232,8 @@ exithook_establish(void (*fn)(struct pro
 	void *rv;
 
 	rw_enter(&exec_lock, RW_WRITER);
-	rv = hook_establish(&exithook_list, (void (*)(void *))(void *)fn, arg);
+	rv = hook_establish(&exithook_list, __FPTRCAST(void (*)(void *), fn),
+	    arg);
 	rw_exit(&exec_lock);
 	return rv;
 }
@@ -256,7 +261,8 @@ static hook_list_t forkhook_list = LIST_
 void *
 forkhook_establish(void (*fn)(struct proc *, struct proc *))
 {
-	return hook_establish(&forkhook_list, (void (*)(void *))(void *)fn, NULL);
+	return hook_establish(&forkhook_list, __FPTRCAST(void (*)(void *), fn),
+	    NULL);
 }
 
 void
@@ -274,7 +280,7 @@ doforkhooks(struct proc *p2, struct proc
 	struct hook_desc *hd;
 
 	LIST_FOREACH(hd, &forkhook_list, hk_list) {
-		((void (*)(struct proc *, struct proc *))(void *)*hd->hk_fn)
+		__FPTRCAST(void (*)(struct proc *, struct proc *), *hd->hk_fn)
 		    (p2, p1);
 	}
 }

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.374 src/sys/kern/kern_sig.c:1.375
--- src/sys/kern/kern_sig.c:1.374	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/kern_sig.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.374 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.375 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.374 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.375 2019/10/16 18:29:49 christos Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -133,7 +133,7 @@ static void	*sigacts_poolpage_alloc(stru
 
 void (*sendsig_sigcontext_vec)(const struct ksiginfo *, const sigset_t *);
 int (*coredump_vec)(struct lwp *, const char *) =
-    (int (*)(struct lwp *, const char *))(void *)enosys;
+    __FPTRCAST(int (*)(struct lwp *, const char *), enosys);
 
 /*
  * DTrace SDT provider definitions

Index: src/sys/kern/kern_veriexec.c
diff -u src/sys/kern/kern_veriexec.c:1.21 src/sys/kern/kern_veriexec.c:1.22
--- src/sys/kern/kern_veriexec.c:1.21	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/kern_veriexec.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_veriexec.c,v 1.21 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: kern_veriexec.c,v 1.22 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat <e...@netbsd.org>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.21 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.22 2019/10/16 18:29:49 christos Exp $");
 
 #include "opt_veriexec.h"
 
@@ -350,9 +350,11 @@ veriexec_init(void)
 
 	rw_init(&veriexec_op_lock);
 
-#define	FPOPS_ADD(a, b, c, d, e, f)	\
-	veriexec_fpops_add(a, b, c, (veriexec_fpop_init_t)(void *)d, \
-	 (veriexec_fpop_update_t)(void *)e, (veriexec_fpop_final_t)(void *)f)
+#define	FPOPS_ADD(a, b, c, d, e, f)			\
+	veriexec_fpops_add(a, b, c,			\
+	    __FPTRCAST(veriexec_fpop_init_t, d),	\
+	    __FPTRCAST(veriexec_fpop_update_t, e),	\
+	    __FPTRCAST(veriexec_fpop_final_t, f))
 
 #ifdef VERIFIED_EXEC_FP_SHA256
 	FPOPS_ADD("SHA256", SHA256_DIGEST_LENGTH, sizeof(SHA256_CTX),

Index: src/sys/kern/subr_ipi.c
diff -u src/sys/kern/subr_ipi.c:1.6 src/sys/kern/subr_ipi.c:1.7
--- src/sys/kern/subr_ipi.c:1.6	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/subr_ipi.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_ipi.c,v 1.6 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: subr_ipi.c,v 1.7 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.6 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.7 2019/10/16 18:29:49 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -150,7 +150,7 @@ ipi_register(ipi_func_t func, void *arg)
 void
 ipi_unregister(u_int ipi_id)
 {
-	ipi_msg_t ipimsg = { .func = (ipi_func_t)(void *)nullop };
+	ipi_msg_t ipimsg = { .func = __FPTRCAST(ipi_func_t, nullop) };
 
 	KASSERT(ipi_id != IPI_SYNCH_ID);
 	KASSERT(ipi_id < IPI_MAXREG);

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.260 src/sys/kern/subr_pool.c:1.261
--- src/sys/kern/subr_pool.c:1.260	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/subr_pool.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.260 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.261 2019/10/16 18:29:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.260 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.261 2019/10/16 18:29:49 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -125,10 +125,13 @@ static bool pool_cache_put_quarantine(po
 #define pool_cache_put_quarantine(a, b, c)	false
 #endif
 
-#define pc_has_ctor(pc) \
-	(pc->pc_ctor != (int (*)(void *, void *, int))nullop)
-#define pc_has_dtor(pc) \
-	(pc->pc_dtor != (void (*)(void *, void *))nullop)
+#define NO_CTOR	__FPTRCAST(int (*)(void *, void *, int), nullop)
+#define NO_DTOR	__FPTRCAST(void (*)(void *, void *), nullop)
+
+#if defined(KASAN) || defined(KLEAK)
+#define pc_has_ctor(pc) ((pc)->pc_ctor != NO_CTOR)
+#define pc_has_dtor(pc) ((pc)->pc_dtor != NO_DTOR)
+#endif
 
 /*
  * Pool backend allocators.
@@ -2063,10 +2066,10 @@ pool_cache_bootstrap(pool_cache_t pc, si
 	mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl);
 
 	if (ctor == NULL) {
-		ctor = (int (*)(void *, void *, int))(void *)nullop;
+		ctor = NO_CTOR;
 	}
 	if (dtor == NULL) {
-		dtor = (void (*)(void *, void *))(void *)nullop;
+		dtor = NO_DTOR;
 	}
 
 	pc->pc_emptygroups = NULL;
@@ -2339,8 +2342,8 @@ pool_cache_invalidate(pool_cache_t pc)
 		 * cache back to the global pool then wait for the xcall to
 		 * complete.
 		 */
-		where = xc_broadcast(0, (xcfunc_t)(void *)pool_cache_transfer,
-		    pc, NULL);
+		where = xc_broadcast(0,
+		    __FPTRCAST(xcfunc_t, pool_cache_transfer), pc, NULL);
 		xc_wait(where);
 	}
 

Index: src/sys/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.98 src/sys/kern/subr_vmem.c:1.99
--- src/sys/kern/subr_vmem.c:1.98	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/subr_vmem.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.98 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.99 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.98 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.99 2019/10/16 18:29:49 christos Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -769,7 +769,7 @@ vmem_import(vmem_t *vm, vmem_size_t size
 	}
 
 	if (vm->vm_flags & VM_XIMPORT) {
-		rc = ((vmem_ximport_t *)(void *)vm->vm_importfn)(vm->vm_arg,
+		rc = __FPTRCAST(vmem_ximport_t *, vm->vm_importfn)(vm->vm_arg,
 		    size, &size, flags, &addr);
 	} else {
 		rc = (vm->vm_importfn)(vm->vm_arg, size, flags, &addr);
@@ -1005,7 +1005,7 @@ vmem_xcreate(const char *name, vmem_addr
 	KASSERT((flags & (VM_XIMPORT)) == 0);
 
 	return vmem_init(NULL, name, base, size, quantum,
-	    (vmem_import_t *)(void *)importfn, releasefn, source,
+	    __FPTRCAST(vmem_import_t *, importfn), releasefn, source,
 	    qcache_max, flags | VM_XIMPORT, ipl);
 }
 

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.68 src/sys/kern/sys_ptrace_common.c:1.69
--- src/sys/kern/sys_ptrace_common.c:1.68	Wed Oct 16 11:27:38 2019
+++ src/sys/kern/sys_ptrace_common.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.68 2019/10/16 15:27:38 christos Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.69 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.68 2019/10/16 15:27:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.69 2019/10/16 18:29:49 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -1505,14 +1505,14 @@ process_doregs(struct lwp *curl /*tracer
 			return EINVAL;
 		}
 		s = sizeof(process_reg32);
-		r = (regrfunc_t)(void *)process_read_regs32;
-		w = (regwfunc_t)(void *)process_write_regs32;
+		r = __FPTRCAST(regrfunc_t, process_read_regs32);
+		w = __FPTRCAST(regwfunc_t, process_write_regs32);
 	} else
 #endif
 	{
 		s = sizeof(struct reg);
-		r = (regrfunc_t)(void *)process_read_regs;
-		w = (regwfunc_t)(void *)process_write_regs;
+		r = __FPTRCAST(regrfunc_t, process_read_regs);
+		w = __FPTRCAST(regwfunc_t, process_write_regs);
 	}
 	return proc_regio(l, uio, s, r, w);
 #else

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.279 src/sys/net/if_ethersubr.c:1.280
--- src/sys/net/if_ethersubr.c:1.279	Wed Oct 16 11:27:39 2019
+++ src/sys/net/if_ethersubr.c	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.279 2019/10/16 15:27:39 christos Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.280 2019/10/16 18:29:49 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.279 2019/10/16 15:27:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.280 2019/10/16 18:29:49 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1035,7 +1035,8 @@ ether_ifdetach(struct ifnet *ifp)
 	 * is in the process of being detached. Return device not configured
 	 * instead.
 	 */
-	ifp->if_ioctl = (int (*)(struct ifnet *, u_long, void *))(void *)enxio;
+	ifp->if_ioctl = __FPTRCAST(int (*)(struct ifnet *, u_long, void *),
+	    enxio);
 
 #if NBRIDGE > 0
 	if (ifp->if_bridge)

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.146 src/sys/sys/cdefs.h:1.147
--- src/sys/sys/cdefs.h:1.146	Sun Sep 22 19:23:12 2019
+++ src/sys/sys/cdefs.h	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.146 2019/09/22 23:23:12 kamil Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.147 2019/10/16 18:29:49 christos Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -199,6 +199,12 @@
 #define __UNVOLATILE(a)	((void *)(unsigned long)(volatile void *)(a))
 
 /*
+ * The following macro is used to remove the the function type cast warnings
+ * from gcc -Wcast-function-type and as above should be used with caution.
+ */
+#define __FPTRCAST(t, f)	((t)(void *)(f))
+
+/*
  * GCC2 provides __extension__ to suppress warnings for various GNU C
  * language extensions under "-ansi -pedantic".
  */

Index: src/sys/sys/sdt.h
diff -u src/sys/sys/sdt.h:1.11 src/sys/sys/sdt.h:1.12
--- src/sys/sys/sdt.h:1.11	Wed Oct 16 11:08:09 2019
+++ src/sys/sys/sdt.h	Wed Oct 16 14:29:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdt.h,v 1.11 2019/10/16 15:08:09 christos Exp $	*/
+/*	$NetBSD: sdt.h,v 1.12 2019/10/16 18:29:49 christos Exp $	*/
 
 /*-
  * Copyright 2006-2008 John Birrell <j...@freebsd.org>
@@ -313,8 +313,8 @@
 #define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)  \
 	do {								       \
 		if (sdt_##prov##_##mod##_##func##_##name->id)		       \
-			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
-			    uintptr_t, uintptr_t, uintptr_t))(void *)	       \
+			__FPTRCAST(void (*)(uint32_t, uintptr_t, uintptr_t,    \
+			    uintptr_t, uintptr_t, uintptr_t, uintptr_t),       \
 			    sdt_probe_func)(  				       \
 			    sdt_##prov##_##mod##_##func##_##name->id,	       \
 			    (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
@@ -324,9 +324,9 @@
     arg6)								       \
 	do {								       \
 		if (sdt_##prov##_##mod##_##func##_##name->id)		       \
-			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
-			    uintptr_t, uintptr_t, uintptr_t, uintptr_t))       \
-			    (void *)sdt_probe_func)(			       \
+			__FPTRCAST(void (*)(uint32_t, uintptr_t, uintptr_t,    \
+			    uintptr_t, uintptr_t, uintptr_t, uintptr_t,	       \
+			    uintptr_t), sdt_probe_func)(		       \
 			    sdt_##prov##_##mod##_##func##_##name->id,	       \
 			    (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
 			    (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \

Reply via email to