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 <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17861
This commit is contained in:
Rob Norris 2025-10-19 14:41:38 +11:00 committed by Brian Behlendorf
parent a43edeefaf
commit 292438295d
2 changed files with 18 additions and 8 deletions

View File

@ -133,14 +133,6 @@ extern "C" {
#include <sys/zfs_context_os.h>
/*
* 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

View File

@ -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