attributes.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. /**
  21. * @file
  22. * Macro definitions for various function/variable attributes
  23. */
  24. #ifndef AVUTIL_ATTRIBUTES_H
  25. #define AVUTIL_ATTRIBUTES_H
  26. #ifdef __GNUC__
  27. # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
  28. #else
  29. # define AV_GCC_VERSION_AT_LEAST(x,y) 0
  30. #endif
  31. #ifndef av_always_inline
  32. #if AV_GCC_VERSION_AT_LEAST(3,1)
  33. # define av_always_inline __attribute__((always_inline)) inline
  34. #else
  35. # define av_always_inline inline
  36. #endif
  37. #endif
  38. #ifndef av_noinline
  39. #if AV_GCC_VERSION_AT_LEAST(3,1)
  40. # define av_noinline __attribute__((noinline))
  41. #else
  42. # define av_noinline
  43. #endif
  44. #endif
  45. #ifndef av_pure
  46. #if AV_GCC_VERSION_AT_LEAST(3,1)
  47. # define av_pure __attribute__((pure))
  48. #else
  49. # define av_pure
  50. #endif
  51. #endif
  52. #ifndef av_const
  53. #if AV_GCC_VERSION_AT_LEAST(2,6)
  54. # define av_const __attribute__((const))
  55. #else
  56. # define av_const
  57. #endif
  58. #endif
  59. #ifndef av_cold
  60. #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
  61. # define av_cold __attribute__((cold))
  62. #else
  63. # define av_cold
  64. #endif
  65. #endif
  66. #ifndef av_flatten
  67. #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
  68. # define av_flatten __attribute__((flatten))
  69. #else
  70. # define av_flatten
  71. #endif
  72. #endif
  73. #ifndef attribute_deprecated
  74. #if AV_GCC_VERSION_AT_LEAST(3,1)
  75. # define attribute_deprecated __attribute__((deprecated))
  76. #else
  77. # define attribute_deprecated
  78. #endif
  79. #endif
  80. #ifndef av_unused
  81. #if defined(__GNUC__)
  82. # define av_unused __attribute__((unused))
  83. #else
  84. # define av_unused
  85. #endif
  86. #endif
  87. #ifndef av_alias
  88. #if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
  89. # define av_alias __attribute__((may_alias))
  90. #else
  91. # define av_alias
  92. #endif
  93. #endif
  94. #ifndef av_uninit
  95. #if defined(__GNUC__) && !defined(__ICC)
  96. # define av_uninit(x) x=x
  97. #else
  98. # define av_uninit(x) x
  99. #endif
  100. #endif
  101. #ifdef __GNUC__
  102. # define av_builtin_constant_p __builtin_constant_p
  103. #else
  104. # define av_builtin_constant_p(x) 0
  105. #endif
  106. #endif /* AVUTIL_ATTRIBUTES_H */