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
37 #ifndef av_always_inline
38 #if AV_GCC_VERSION_AT_LEAST(3,1)
39 # define av_always_inline __attribute__((always_inline)) inline
40 #elif defined(_MSC_VER)
41 # define av_always_inline __forceinline
43 # define av_always_inline inline
47 #ifndef av_extern_inline
48 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
49 # define av_extern_inline extern inline
51 # define av_extern_inline inline
55 #if AV_GCC_VERSION_AT_LEAST(3,4)
56 # define av_warn_unused_result __attribute__((warn_unused_result))
58 # define av_warn_unused_result
61 #if AV_GCC_VERSION_AT_LEAST(3,1)
62 # define av_noinline __attribute__((noinline))
63 #elif defined(_MSC_VER)
64 # define av_noinline __declspec(noinline)
69 #if AV_GCC_VERSION_AT_LEAST(3,1)
70 # define av_pure __attribute__((pure))
75 #if AV_GCC_VERSION_AT_LEAST(2,6)
76 # define av_const __attribute__((const))
81 #if AV_GCC_VERSION_AT_LEAST(4,3)
82 # define av_cold __attribute__((cold))
87 #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
88 # define av_flatten __attribute__((flatten))
93 #if AV_GCC_VERSION_AT_LEAST(3,1)
94 # define attribute_deprecated __attribute__((deprecated))
95 #elif defined(_MSC_VER)
96 # define attribute_deprecated __declspec(deprecated)
98 # define attribute_deprecated
106 #ifndef AV_NOWARN_DEPRECATED
107 #if AV_GCC_VERSION_AT_LEAST(4,6)
108 # define AV_NOWARN_DEPRECATED(code) \
109 _Pragma("GCC diagnostic push") \
110 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
112 _Pragma("GCC diagnostic pop")
113 #elif defined(_MSC_VER)
114 # define AV_NOWARN_DEPRECATED(code) \
115 __pragma(warning(push)) \
116 __pragma(warning(disable : 4996)) \
118 __pragma(warning(pop))
120 # define AV_NOWARN_DEPRECATED(code) code
124 #if defined(__GNUC__) || defined(__clang__)
125 # define av_unused __attribute__((unused))
135 #if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
136 # define av_used __attribute__((used))
141 #if AV_GCC_VERSION_AT_LEAST(3,3)
142 # define av_alias __attribute__((may_alias))
147 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
148 # define av_uninit(x) x=x
150 # define av_uninit(x) x
154 # define av_builtin_constant_p __builtin_constant_p
155 # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
157 # define av_builtin_constant_p(x) 0
158 # define av_printf_format(fmtpos, attrpos)
161 #if AV_GCC_VERSION_AT_LEAST(2,5)
162 # define av_noreturn __attribute__((noreturn))