API Reference Manual  1.45.0
spec/hints.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2013-2018 Linaro Limited
3  */
4 
11 #ifndef ODP_API_SPEC_HINTS_H_
12 #define ODP_API_SPEC_HINTS_H_
13 #include <odp/visibility_begin.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
24 #ifdef __GNUC__
25 
28 #define ODP_NORETURN __attribute__((__noreturn__))
29 
34 #define ODP_WEAK_SYMBOL __attribute__((__weak__))
35 
39 #define ODP_HOT_CODE __attribute__((__hot__))
40 
44 #define ODP_COLD_CODE __attribute__((__cold__))
45 
49 #define ODP_PRINTF_FORMAT(x, y) __attribute__((format(printf, (x), (y))))
50 
54 #define ODP_UNUSED __attribute__((__unused__))
55 
59 #define odp_likely(x) __builtin_expect(!!(x), 1)
60 
64 #define odp_unlikely(x) __builtin_expect(!!(x), 0)
65 
66 #else
67 
68 #define ODP_WEAK_SYMBOL
69 #define ODP_HOT_CODE
70 #define ODP_COLD_CODE
71 #define ODP_UNUSED
72 #define odp_likely(x)
73 #define odp_unlikely(x)
74 
75 #endif
76 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #include <odp/visibility_end.h>
86 #endif