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))
32 # define AV_GCC_VERSION_AT_LEAST(x,y) 0
35 #ifndef av_always_inline
36 #if AV_GCC_VERSION_AT_LEAST(3,1)
37 # define av_always_inline __attribute__((always_inline)) inline
38 #elif defined(_MSC_VER)
39 # define av_always_inline __forceinline
41 # define av_always_inline inline
45 #ifndef av_extern_inline
46 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
47 # define av_extern_inline extern inline
49 # define av_extern_inline inline
53 #if AV_GCC_VERSION_AT_LEAST(3,1)
54 # define av_noinline __attribute__((noinline))
55 #elif defined(_MSC_VER)
56 # define av_noinline __declspec(noinline)
61 #if AV_GCC_VERSION_AT_LEAST(3,1)
62 # define av_pure __attribute__((pure))
67 #if AV_GCC_VERSION_AT_LEAST(2,6)
68 # define av_const __attribute__((const))
73 #if AV_GCC_VERSION_AT_LEAST(4,3)
74 # define av_cold __attribute__((cold))
79 #if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
80 # define av_flatten __attribute__((flatten))
85 #if AV_GCC_VERSION_AT_LEAST(3,1)
86 # define attribute_deprecated __attribute__((deprecated))
87 #elif defined(_MSC_VER)
88 # define attribute_deprecated __declspec(deprecated)
90 # define attribute_deprecated
98 #ifndef AV_NOWARN_DEPRECATED
99 #if AV_GCC_VERSION_AT_LEAST(4,6)
100 # define AV_NOWARN_DEPRECATED(code) \
101 _Pragma("GCC diagnostic push") \
102 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
104 _Pragma("GCC diagnostic pop")
105 #elif defined(_MSC_VER)
106 # define AV_NOWARN_DEPRECATED(code) \
107 __pragma(warning(push)) \
108 __pragma(warning(disable : 4996)) \
110 __pragma(warning(pop))
112 # define AV_NOWARN_DEPRECATED(code) code
117 #if defined(__GNUC__)
118 # define av_unused __attribute__((unused))
128 #if AV_GCC_VERSION_AT_LEAST(3,1)
129 # define av_used __attribute__((used))
134 #if AV_GCC_VERSION_AT_LEAST(3,3)
135 # define av_alias __attribute__((may_alias))
140 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
141 # define av_uninit(x) x=x
143 # define av_uninit(x) x
147 # define av_builtin_constant_p __builtin_constant_p
148 # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
150 # define av_builtin_constant_p(x) 0
151 # define av_printf_format(fmtpos, attrpos)
154 #if AV_GCC_VERSION_AT_LEAST(2,5)
155 # define av_noreturn __attribute__((noreturn))