Skip to content

Commit 2924382

Browse files
robnbehlendorf
authored andcommitted
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
1 parent a43edee commit 2924382

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

include/sys/zfs_context.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,6 @@ extern "C" {
133133

134134
#include <sys/zfs_context_os.h>
135135

136-
/*
137-
* Stack
138-
*/
139-
140-
#define noinline __attribute__((noinline))
141-
#define likely(x) __builtin_expect((x), 1)
142-
#define unlikely(x) __builtin_expect((x), 0)
143-
144136
#ifdef __FreeBSD__
145137
typedef off_t loff_t;
146138
#endif

lib/libspl/include/sys/debug.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2525
* Use is subject to license terms.
2626
*/
27+
/*
28+
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
29+
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
30+
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
31+
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
32+
*/
2733

2834
#ifndef _LIBSPL_SYS_DEBUG_H
2935
#define _LIBSPL_SYS_DEBUG_H
@@ -42,4 +48,16 @@
4248
#define __must_check __attribute__((warn_unused_result))
4349
#endif
4450

51+
#ifndef noinline
52+
#define noinline __attribute__((noinline))
53+
#endif
54+
55+
#ifndef likely
56+
#define likely(x) __builtin_expect((x), 1)
57+
#endif
58+
59+
#ifndef unlikely
60+
#define unlikely(x) __builtin_expect((x), 0)
61+
#endif
62+
4563
#endif

0 commit comments

Comments
 (0)