aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/compiler.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/compiler.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 323a583860b4..948396144ad6 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -26,8 +26,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#ifndef _LINUXKPI_LINUX_COMPILER_H_
#define _LINUXKPI_LINUX_COMPILER_H_
@@ -50,7 +48,9 @@
#define __cond_lock(x,c) (c)
#define __bitwise
#define __devinitdata
+#ifndef __deprecated
#define __deprecated
+#endif
#define __init
#define __initconst
#define __devinit
@@ -69,6 +69,17 @@
#define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE)
#define fallthrough /* FALLTHROUGH */ do { } while(0)
+#if __has_attribute(__nonstring__)
+#define __nonstring __attribute__((__nonstring__))
+#else
+#define __nonstring
+#endif
+#if __has_attribute(__counted_by__)
+#define __counted_by(_x) __attribute__((__counted_by__(_x)))
+#else
+#define __counted_by(_x)
+#endif
+
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define typeof(x) __typeof(x)
@@ -80,6 +91,10 @@
#define __printf(a,b) __printflike(a,b)
+#define __diag_push()
+#define __diag_pop()
+#define __diag_ignore_all(...)
+
#define barrier() __asm__ __volatile__("": : :"memory")
#define lower_32_bits(n) ((u32)(n))
@@ -112,4 +127,13 @@
#define sizeof_field(_s, _m) sizeof(((_s *)0)->_m)
+#define is_signed_type(t) ((t)-1 < (t)1)
+#define is_unsigned_type(t) ((t)-1 > (t)1)
+
+#if __has_builtin(__builtin_dynamic_object_size)
+#define __struct_size(_s) __builtin_dynamic_object_size(_s, 0)
+#else
+#define __struct_size(_s) __builtin_object_size(_s, 0)
+#endif
+
#endif /* _LINUXKPI_LINUX_COMPILER_H_ */