00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef AVUTIL_ATTRIBUTES_H
00027 #define AVUTIL_ATTRIBUTES_H
00028
00029 #ifdef __GNUC__
00030 # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
00031 #else
00032 # define AV_GCC_VERSION_AT_LEAST(x,y) 0
00033 #endif
00034
00035 #ifndef av_always_inline
00036 #if AV_GCC_VERSION_AT_LEAST(3,1)
00037 # define av_always_inline __attribute__((always_inline)) inline
00038 #elif defined(_MSC_VER)
00039 # define av_always_inline __forceinline
00040 #else
00041 # define av_always_inline inline
00042 #endif
00043 #endif
00044
00045 #ifndef av_extern_inline
00046 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
00047 # define av_extern_inline extern inline
00048 #else
00049 # define av_extern_inline inline
00050 #endif
00051 #endif
00052
00053 #if AV_GCC_VERSION_AT_LEAST(3,1)
00054 # define av_noinline __attribute__((noinline))
00055 #else
00056 # define av_noinline
00057 #endif
00058
00059 #if AV_GCC_VERSION_AT_LEAST(3,1)
00060 # define av_pure __attribute__((pure))
00061 #else
00062 # define av_pure
00063 #endif
00064
00065 #ifndef av_restrict
00066 #define av_restrict restrict
00067 #endif
00068
00069 #if AV_GCC_VERSION_AT_LEAST(2,6)
00070 # define av_const __attribute__((const))
00071 #else
00072 # define av_const
00073 #endif
00074
00075 #if AV_GCC_VERSION_AT_LEAST(4,3)
00076 # define av_cold __attribute__((cold))
00077 #else
00078 # define av_cold
00079 #endif
00080
00081 #if AV_GCC_VERSION_AT_LEAST(4,1)
00082 # define av_flatten __attribute__((flatten))
00083 #else
00084 # define av_flatten
00085 #endif
00086
00087 #if AV_GCC_VERSION_AT_LEAST(3,1)
00088 # define attribute_deprecated __attribute__((deprecated))
00089 #else
00090 # define attribute_deprecated
00091 #endif
00092
00098 #ifndef AV_NOWARN_DEPRECATED
00099 #if AV_GCC_VERSION_AT_LEAST(4,6)
00100 # define AV_NOWARN_DEPRECATED(code) \
00101 _Pragma("GCC diagnostic push") \
00102 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
00103 code \
00104 _Pragma("GCC diagnostic pop")
00105 #else
00106 # define AV_NOWARN_DEPRECATED(code) code
00107 #endif
00108 #endif
00109
00110
00111 #if defined(__GNUC__)
00112 # define av_unused __attribute__((unused))
00113 #else
00114 # define av_unused
00115 #endif
00116
00122 #if AV_GCC_VERSION_AT_LEAST(3,1)
00123 # define av_used __attribute__((used))
00124 #else
00125 # define av_used
00126 #endif
00127
00128 #if AV_GCC_VERSION_AT_LEAST(3,3)
00129 # define av_alias __attribute__((may_alias))
00130 #else
00131 # define av_alias
00132 #endif
00133
00134 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
00135 # define av_uninit(x) x=x
00136 #else
00137 # define av_uninit(x) x
00138 #endif
00139
00140 #ifdef __GNUC__
00141 # define av_builtin_constant_p __builtin_constant_p
00142 # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
00143 #else
00144 # define av_builtin_constant_p(x) 0
00145 # define av_printf_format(fmtpos, attrpos)
00146 #endif
00147
00148 #if AV_GCC_VERSION_AT_LEAST(2,5)
00149 # define av_noreturn __attribute__((noreturn))
00150 #else
00151 # define av_noreturn
00152 #endif
00153
00154 #endif