yading@11
|
1 /*
|
yading@11
|
2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
yading@11
|
3 *
|
yading@11
|
4 * This file is part of FFmpeg.
|
yading@11
|
5 *
|
yading@11
|
6 * FFmpeg is free software; you can redistribute it and/or
|
yading@11
|
7 * modify it under the terms of the GNU Lesser General Public
|
yading@11
|
8 * License as published by the Free Software Foundation; either
|
yading@11
|
9 * version 2.1 of the License, or (at your option) any later version.
|
yading@11
|
10 *
|
yading@11
|
11 * FFmpeg is distributed in the hope that it will be useful,
|
yading@11
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@11
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@11
|
14 * Lesser General Public License for more details.
|
yading@11
|
15 *
|
yading@11
|
16 * You should have received a copy of the GNU Lesser General Public
|
yading@11
|
17 * License along with FFmpeg; if not, write to the Free Software
|
yading@11
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@11
|
19 */
|
yading@11
|
20
|
yading@11
|
21 /**
|
yading@11
|
22 * @file
|
yading@11
|
23 * Macro definitions for various function/variable attributes
|
yading@11
|
24 */
|
yading@11
|
25
|
yading@11
|
26 #ifndef AVUTIL_ATTRIBUTES_H
|
yading@11
|
27 #define AVUTIL_ATTRIBUTES_H
|
yading@11
|
28
|
yading@11
|
29 #ifdef __GNUC__
|
yading@11
|
30 # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
|
yading@11
|
31 #else
|
yading@11
|
32 # define AV_GCC_VERSION_AT_LEAST(x,y) 0
|
yading@11
|
33 #endif
|
yading@11
|
34
|
yading@11
|
35 #ifndef av_always_inline
|
yading@11
|
36 #if AV_GCC_VERSION_AT_LEAST(3,1)
|
yading@11
|
37 # define av_always_inline __attribute__((always_inline)) inline
|
yading@11
|
38 #elif defined(_MSC_VER)
|
yading@11
|
39 # define av_always_inline __forceinline
|
yading@11
|
40 #else
|
yading@11
|
41 # define av_always_inline inline
|
yading@11
|
42 #endif
|
yading@11
|
43 #endif
|
yading@11
|
44
|
yading@11
|
45 #ifndef av_extern_inline
|
yading@11
|
46 #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
|
yading@11
|
47 # define av_extern_inline extern inline
|
yading@11
|
48 #else
|
yading@11
|
49 # define av_extern_inline inline
|
yading@11
|
50 #endif
|
yading@11
|
51 #endif
|
yading@11
|
52
|
yading@11
|
53 #if AV_GCC_VERSION_AT_LEAST(3,1)
|
yading@11
|
54 # define av_noinline __attribute__((noinline))
|
yading@11
|
55 #else
|
yading@11
|
56 # define av_noinline
|
yading@11
|
57 #endif
|
yading@11
|
58
|
yading@11
|
59 #if AV_GCC_VERSION_AT_LEAST(3,1)
|
yading@11
|
60 # define av_pure __attribute__((pure))
|
yading@11
|
61 #else
|
yading@11
|
62 # define av_pure
|
yading@11
|
63 #endif
|
yading@11
|
64
|
yading@11
|
65 #ifndef av_restrict
|
yading@11
|
66 #define av_restrict restrict
|
yading@11
|
67 #endif
|
yading@11
|
68
|
yading@11
|
69 #if AV_GCC_VERSION_AT_LEAST(2,6)
|
yading@11
|
70 # define av_const __attribute__((const))
|
yading@11
|
71 #else
|
yading@11
|
72 # define av_const
|
yading@11
|
73 #endif
|
yading@11
|
74
|
yading@11
|
75 #if AV_GCC_VERSION_AT_LEAST(4,3)
|
yading@11
|
76 # define av_cold __attribute__((cold))
|
yading@11
|
77 #else
|
yading@11
|
78 # define av_cold
|
yading@11
|
79 #endif
|
yading@11
|
80
|
yading@11
|
81 #if AV_GCC_VERSION_AT_LEAST(4,1)
|
yading@11
|
82 # define av_flatten __attribute__((flatten))
|
yading@11
|
83 #else
|
yading@11
|
84 # define av_flatten
|
yading@11
|
85 #endif
|
yading@11
|
86
|
yading@11
|
87 #if AV_GCC_VERSION_AT_LEAST(3,1)
|
yading@11
|
88 # define attribute_deprecated __attribute__((deprecated))
|
yading@11
|
89 #else
|
yading@11
|
90 # define attribute_deprecated
|
yading@11
|
91 #endif
|
yading@11
|
92
|
yading@11
|
93 /**
|
yading@11
|
94 * Disable warnings about deprecated features
|
yading@11
|
95 * This is useful for sections of code kept for backward compatibility and
|
yading@11
|
96 * scheduled for removal.
|
yading@11
|
97 */
|
yading@11
|
98 #ifndef AV_NOWARN_DEPRECATED
|
yading@11
|
99 #if AV_GCC_VERSION_AT_LEAST(4,6)
|
yading@11
|
100 # define AV_NOWARN_DEPRECATED(code) \
|
yading@11
|
101 _Pragma("GCC diagnostic push") \
|
yading@11
|
102 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
|
yading@11
|
103 code \
|
yading@11
|
104 _Pragma("GCC diagnostic pop")
|
yading@11
|
105 #else
|
yading@11
|
106 # define AV_NOWARN_DEPRECATED(code) code
|
yading@11
|
107 #endif
|
yading@11
|
108 #endif
|
yading@11
|
109
|
yading@11
|
110
|
yading@11
|
111 #if defined(__GNUC__)
|
yading@11
|
112 # define av_unused __attribute__((unused))
|
yading@11
|
113 #else
|
yading@11
|
114 # define av_unused
|
yading@11
|
115 #endif
|
yading@11
|
116
|
yading@11
|
117 /**
|
yading@11
|
118 * Mark a variable as used and prevent the compiler from optimizing it
|
yading@11
|
119 * away. This is useful for variables accessed only from inline
|
yading@11
|
120 * assembler without the compiler being aware.
|
yading@11
|
121 */
|
yading@11
|
122 #if AV_GCC_VERSION_AT_LEAST(3,1)
|
yading@11
|
123 # define av_used __attribute__((used))
|
yading@11
|
124 #else
|
yading@11
|
125 # define av_used
|
yading@11
|
126 #endif
|
yading@11
|
127
|
yading@11
|
128 #if AV_GCC_VERSION_AT_LEAST(3,3)
|
yading@11
|
129 # define av_alias __attribute__((may_alias))
|
yading@11
|
130 #else
|
yading@11
|
131 # define av_alias
|
yading@11
|
132 #endif
|
yading@11
|
133
|
yading@11
|
134 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
yading@11
|
135 # define av_uninit(x) x=x
|
yading@11
|
136 #else
|
yading@11
|
137 # define av_uninit(x) x
|
yading@11
|
138 #endif
|
yading@11
|
139
|
yading@11
|
140 #ifdef __GNUC__
|
yading@11
|
141 # define av_builtin_constant_p __builtin_constant_p
|
yading@11
|
142 # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
|
yading@11
|
143 #else
|
yading@11
|
144 # define av_builtin_constant_p(x) 0
|
yading@11
|
145 # define av_printf_format(fmtpos, attrpos)
|
yading@11
|
146 #endif
|
yading@11
|
147
|
yading@11
|
148 #if AV_GCC_VERSION_AT_LEAST(2,5)
|
yading@11
|
149 # define av_noreturn __attribute__((noreturn))
|
yading@11
|
150 #else
|
yading@11
|
151 # define av_noreturn
|
yading@11
|
152 #endif
|
yading@11
|
153
|
yading@11
|
154 #endif /* AVUTIL_ATTRIBUTES_H */
|