Skip to content

Commit e348288

Browse files
committed
zfs_context: move compiler attribute macros to sys/debug.h
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/ Signed-off-by: Rob Norris <[email protected]>
1 parent 15e0de3 commit e348288

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
@@ -130,14 +130,6 @@ extern "C" {
130130

131131
#include <sys/zfs_context_os.h>
132132

133-
/*
134-
* Stack
135-
*/
136-
137-
#define noinline __attribute__((noinline))
138-
#define likely(x) __builtin_expect((x), 1)
139-
#define unlikely(x) __builtin_expect((x), 0)
140-
141133
#ifdef __FreeBSD__
142134
typedef off_t loff_t;
143135
#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)