annotate lib/libavutil/attributes.h @ 2134:992d2e6f907d

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