Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/gen rbtree: Add a define to mark function ar...



details:   https://anonhg.NetBSD.org/src/rev/6c6fe5cac73b
branches:  trunk
changeset: 449489:6c6fe5cac73b
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Mar 08 09:14:54 2019 +0000

description:
rbtree: Add a define to mark function arguments as unused for non debug

This allows rbtree to be used outside of NetBSD without any compile
warnings and removes the need for the lint comment.

diffstat:

 common/lib/libc/gen/rb.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 9d250331ec7a -r 6c6fe5cac73b common/lib/libc/gen/rb.c
--- a/common/lib/libc/gen/rb.c  Fri Mar 08 08:47:17 2019 +0000
+++ b/common/lib/libc/gen/rb.c  Fri Mar 08 09:14:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $     */
+/*     $NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,13 +36,20 @@
 #include <stdbool.h>
 #ifdef RBDEBUG
 #define        KASSERT(s)      assert(s)
+#define        __rbt_unused
 #else
 #define KASSERT(s)     do { } while (/*CONSTCOND*/ 0)
+#define        __rbt_unused    __unused
 #endif
-__RCSID("$NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $");
+__RCSID("$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $");
 #else
 #include <lib/libkern/libkern.h>
-__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $");
+#ifndef DIAGNOSTIC
+#define        __rbt_unused    __unused
+#else
+#define        __rbt_unused
+#endif
 #endif
 
 #ifdef _LIBC
@@ -313,10 +320,9 @@
  * removal since rotation almost always involves the exchanging of colors
  * as a separate step.
  */
-/*ARGSUSED*/
 static void
-rb_tree_reparent_nodes(struct rb_tree *rbt, struct rb_node *old_father,
-       const unsigned int which)
+rb_tree_reparent_nodes(__rbt_unused struct rb_tree *rbt,
+       struct rb_node *old_father, const unsigned int which)
 {
        const unsigned int other = which ^ RB_DIR_OTHER;
        struct rb_node * const grandpa = RB_FATHER(old_father);



Home | Main Index | Thread Index | Old Index