comparison common.h @ 590:e9d89a89561a libavutil

Use AV_GCC_VERSION_AT_LEAST() to simplify gcc version checks.
author cehoyos
date Sat, 20 Dec 2008 17:33:35 +0000
parents fddfdadb477f
children 5fe37f8a1017
comparison
equal deleted inserted replaced
589:9dd4312d8a4d 590:e9d89a89561a
39 # include <limits.h> 39 # include <limits.h>
40 # include <errno.h> 40 # include <errno.h>
41 # include <math.h> 41 # include <math.h>
42 #endif /* HAVE_AV_CONFIG_H */ 42 #endif /* HAVE_AV_CONFIG_H */
43 43
44 #define AV_GCC_VERSION_AT_LEAST(x,y) (defined(__GNUC__) && (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y))
45
44 #ifndef av_always_inline 46 #ifndef av_always_inline
45 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) 47 #if AV_GCC_VERSION_AT_LEAST(3,1)
46 # define av_always_inline __attribute__((always_inline)) inline 48 # define av_always_inline __attribute__((always_inline)) inline
47 #else 49 #else
48 # define av_always_inline inline 50 # define av_always_inline inline
49 #endif 51 #endif
50 #endif 52 #endif
51 53
52 #ifndef av_noinline 54 #ifndef av_noinline
53 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) 55 #if AV_GCC_VERSION_AT_LEAST(3,1)
54 # define av_noinline __attribute__((noinline)) 56 # define av_noinline __attribute__((noinline))
55 #else 57 #else
56 # define av_noinline 58 # define av_noinline
57 #endif 59 #endif
58 #endif 60 #endif
59 61
60 #ifndef av_pure 62 #ifndef av_pure
61 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) 63 #if AV_GCC_VERSION_AT_LEAST(3,1)
62 # define av_pure __attribute__((pure)) 64 # define av_pure __attribute__((pure))
63 #else 65 #else
64 # define av_pure 66 # define av_pure
65 #endif 67 #endif
66 #endif 68 #endif
67 69
68 #ifndef av_const 70 #ifndef av_const
69 #if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 5) 71 #if AV_GCC_VERSION_AT_LEAST(2,6)
70 # define av_const __attribute__((const)) 72 # define av_const __attribute__((const))
71 #else 73 #else
72 # define av_const 74 # define av_const
73 #endif 75 #endif
74 #endif 76 #endif
75 77
76 #ifndef av_cold 78 #ifndef av_cold
77 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2) 79 #if AV_GCC_VERSION_AT_LEAST(4,3)
78 # define av_cold __attribute__((cold)) 80 # define av_cold __attribute__((cold))
79 #else 81 #else
80 # define av_cold 82 # define av_cold
81 #endif 83 #endif
82 #endif 84 #endif
84 #ifdef HAVE_AV_CONFIG_H 86 #ifdef HAVE_AV_CONFIG_H
85 # include "internal.h" 87 # include "internal.h"
86 #endif /* HAVE_AV_CONFIG_H */ 88 #endif /* HAVE_AV_CONFIG_H */
87 89
88 #ifndef attribute_deprecated 90 #ifndef attribute_deprecated
89 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) 91 #if AV_GCC_VERSION_AT_LEAST(3,1)
90 # define attribute_deprecated __attribute__((deprecated)) 92 # define attribute_deprecated __attribute__((deprecated))
91 #else 93 #else
92 # define attribute_deprecated 94 # define attribute_deprecated
93 #endif 95 #endif
94 #endif 96 #endif