Go to the documentation of this file.
26 #ifndef AVUTIL_ATTRIBUTES_H
27 #define AVUTIL_ATTRIBUTES_H
30 # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
31 # define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
33 # define AV_GCC_VERSION_AT_LEAST(x,y) 0
34 # define AV_GCC_VERSION_AT_MOST(x,y) 0
38 # define AV_HAS_BUILTIN(x) __has_builtin(x)
40 # define AV_HAS_BUILTIN(x) 0
43 #ifndef av_always_inline
44 #if AV_GCC_VERSION_AT_LEAST(3,1)
45 # define av_always_inline __attribute__((always_inline)) inline
46 #elif defined(_MSC_VER)
47 # define av_always_inline __forceinline
49 # define av_always_inline inline
53 #ifndef av_extern_inline
54 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
55 # define av_extern_inline extern inline
57 # define av_extern_inline inline
61 #if AV_GCC_VERSION_AT_LEAST(3,4)
62 # define av_warn_unused_result __attribute__((warn_unused_result))
64 # define av_warn_unused_result
67 #if AV_GCC_VERSION_AT_LEAST(3,1)
68 # define av_noinline __attribute__((noinline))
69 #elif defined(_MSC_VER)
70 # define av_noinline __declspec(noinline)
75 #if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
76 # define av_pure __attribute__((pure))
81 #if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
82 # define av_const __attribute__((const))
87 #if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
88 # define av_cold __attribute__((cold))
93 #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
94 # define av_flatten __attribute__((flatten))
99 #if AV_GCC_VERSION_AT_LEAST(3,1)
100 # define attribute_deprecated __attribute__((deprecated))
101 #elif defined(_MSC_VER)
102 # define attribute_deprecated __declspec(deprecated)
104 # define attribute_deprecated
112 #ifndef AV_NOWARN_DEPRECATED
113 #if AV_GCC_VERSION_AT_LEAST(4,6) || defined(__clang__)
114 # define AV_NOWARN_DEPRECATED(code) \
115 _Pragma("GCC diagnostic push") \
116 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
118 _Pragma("GCC diagnostic pop")
119 #elif defined(_MSC_VER)
120 # define AV_NOWARN_DEPRECATED(code) \
121 __pragma(warning(push)) \
122 __pragma(warning(disable : 4996)) \
124 __pragma(warning(pop))
126 # define AV_NOWARN_DEPRECATED(code) code
130 #if defined(__GNUC__) || defined(__clang__)
131 # define av_unused __attribute__((unused))
141 #if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
142 # define av_used __attribute__((used))
147 #if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
148 # define av_alias __attribute__((may_alias))
153 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
154 # define av_uninit(x) x=x
156 # define av_uninit(x) x
159 #if defined(__GNUC__) || defined(__clang__)
160 # define av_builtin_constant_p __builtin_constant_p
161 # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
163 # define av_builtin_constant_p(x) 0
164 # define av_printf_format(fmtpos, attrpos)
167 #if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
168 # define av_noreturn __attribute__((noreturn))