From 292438295daedf76b58a83319ca68ac541702312 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sun, 19 Oct 2025 14:41:38 +1100 Subject: [PATCH] libspl: move compiler attribute macros from zfs_context.h sys/debug.h is not really the right place for them, but we already have some there for libspl, so it is at least convenient. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #17861 --- include/sys/zfs_context.h | 8 -------- lib/libspl/include/sys/debug.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index d010b4eb3..7c410dc23 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -133,14 +133,6 @@ extern "C" { #include -/* - * Stack - */ - -#define noinline __attribute__((noinline)) -#define likely(x) __builtin_expect((x), 1) -#define unlikely(x) __builtin_expect((x), 0) - #ifdef __FreeBSD__ typedef off_t loff_t; #endif diff --git a/lib/libspl/include/sys/debug.h b/lib/libspl/include/sys/debug.h index 02f33a68b..6ce8c88f6 100644 --- a/lib/libspl/include/sys/debug.h +++ b/lib/libspl/include/sys/debug.h @@ -24,6 +24,12 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ #ifndef _LIBSPL_SYS_DEBUG_H #define _LIBSPL_SYS_DEBUG_H @@ -42,4 +48,16 @@ #define __must_check __attribute__((warn_unused_result)) #endif +#ifndef noinline +#define noinline __attribute__((noinline)) +#endif + +#ifndef likely +#define likely(x) __builtin_expect((x), 1) +#endif + +#ifndef unlikely +#define unlikely(x) __builtin_expect((x), 0) +#endif + #endif