Module Name:    src
Committed By:   riastradh
Date:           Tue Feb  8 12:59:17 UTC 2022

Modified Files:
        src/sys/kern: subr_pcu.c subr_psref.c subr_thmap.c

Log Message:
kern: Mark some functions __diagused to pacify clang.

These functions are called only in KASSERT.  This shouldn't be a
problem since the recent change to make KASSERT compile (but not run)
the expression, via sizeof, so the functions are referenced -- which
I did in order to avoid having #ifdefs and regular build breakage
because someone forgot to build with or without DIAGNOSTIC.  But
apparently clang decided to make it a problem.

Maybe we should just set -Wno-unneeded-internal-declaration -- not
clear it flags any real problems, but it takes effort to research
because apparently clang has no documentation about what else it does
or why anyone decided this is objectionable enough to turn it on by
default.  (The only documentation it seems to have, two example
warning messages with no elaboration at
<https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wunneeded-internal-declaration>,
seems to indicate it is mixed up with warning about static non-inline
functions in header files.)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/subr_pcu.c
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/subr_psref.c
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_thmap.c

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

Modified files:

Index: src/sys/kern/subr_pcu.c
diff -u src/sys/kern/subr_pcu.c:1.25 src/sys/kern/subr_pcu.c:1.26
--- src/sys/kern/subr_pcu.c:1.25	Sat Jan  1 15:10:53 2022
+++ src/sys/kern/subr_pcu.c	Tue Feb  8 12:59:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pcu.c,v 1.25 2022/01/01 15:10:53 christos Exp $	*/
+/*	$NetBSD: subr_pcu.c,v 1.26 2022/02/08 12:59:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2011, 2014 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.25 2022/01/01 15:10:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.26 2022/02/08 12:59:16 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -91,7 +91,7 @@ extern const pcu_ops_t * const pcu_ops_m
 /*
  * pcu_available_p: true if lwp is allowed to use PCU state.
  */
-static inline bool
+static inline bool __diagused
 pcu_available_p(struct lwp *l)
 {
 

Index: src/sys/kern/subr_psref.c
diff -u src/sys/kern/subr_psref.c:1.16 src/sys/kern/subr_psref.c:1.17
--- src/sys/kern/subr_psref.c:1.16	Fri Dec 31 14:19:57 2021
+++ src/sys/kern/subr_psref.c	Tue Feb  8 12:59:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_psref.c,v 1.16 2021/12/31 14:19:57 riastradh Exp $	*/
+/*	$NetBSD: subr_psref.c,v 1.17 2022/02/08 12:59:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.16 2021/12/31 14:19:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.17 2022/02/08 12:59:16 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -170,7 +170,7 @@ psref_class_create(const char *name, int
 	return class;
 }
 
-static void
+static void __diagused
 psref_cpu_drained_p(void *p, void *cookie, struct cpu_info *ci __unused)
 {
 	const struct psref_cpu *pcpu = p;

Index: src/sys/kern/subr_thmap.c
diff -u src/sys/kern/subr_thmap.c:1.8 src/sys/kern/subr_thmap.c:1.9
--- src/sys/kern/subr_thmap.c:1.8	Fri Dec 31 14:19:57 2021
+++ src/sys/kern/subr_thmap.c	Tue Feb  8 12:59:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_thmap.c,v 1.8 2021/12/31 14:19:57 riastradh Exp $	*/
+/*	$NetBSD: subr_thmap.c,v 1.9 2022/02/08 12:59:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 Mindaugas Rasiukevicius <rmind at noxt eu>
@@ -112,7 +112,7 @@
 #include "utils.h"
 #endif
 
-THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.8 2021/12/31 14:19:57 riastradh Exp $");
+THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.9 2022/02/08 12:59:16 riastradh Exp $");
 
 #include <crypto/blake2/blake2s.h>
 
@@ -256,7 +256,7 @@ static const thmap_ops_t thmap_default_o
  * NODE LOCKING.
  */
 
-static inline bool
+static inline bool __diagused
 node_locked_p(thmap_inode_t *node)
 {
 	return (atomic_load_relaxed(&node->state) & NODE_LOCKED) != 0;

Reply via email to