yading@11: /* yading@11: * copyright (c) 2006 Michael Niedermayer yading@11: * yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: yading@11: /** yading@11: * @file yading@11: * Macro definitions for various function/variable attributes yading@11: */ yading@11: yading@11: #ifndef AVUTIL_ATTRIBUTES_H yading@11: #define AVUTIL_ATTRIBUTES_H yading@11: yading@11: #ifdef __GNUC__ yading@11: # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) yading@11: #else yading@11: # define AV_GCC_VERSION_AT_LEAST(x,y) 0 yading@11: #endif yading@11: yading@11: #ifndef av_always_inline yading@11: #if AV_GCC_VERSION_AT_LEAST(3,1) yading@11: # define av_always_inline __attribute__((always_inline)) inline yading@11: #elif defined(_MSC_VER) yading@11: # define av_always_inline __forceinline yading@11: #else yading@11: # define av_always_inline inline yading@11: #endif yading@11: #endif yading@11: yading@11: #ifndef av_extern_inline yading@11: #if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) yading@11: # define av_extern_inline extern inline yading@11: #else yading@11: # define av_extern_inline inline yading@11: #endif yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(3,1) yading@11: # define av_noinline __attribute__((noinline)) yading@11: #else yading@11: # define av_noinline yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(3,1) yading@11: # define av_pure __attribute__((pure)) yading@11: #else yading@11: # define av_pure yading@11: #endif yading@11: yading@11: #ifndef av_restrict yading@11: #define av_restrict restrict yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(2,6) yading@11: # define av_const __attribute__((const)) yading@11: #else yading@11: # define av_const yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(4,3) yading@11: # define av_cold __attribute__((cold)) yading@11: #else yading@11: # define av_cold yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(4,1) yading@11: # define av_flatten __attribute__((flatten)) yading@11: #else yading@11: # define av_flatten yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(3,1) yading@11: # define attribute_deprecated __attribute__((deprecated)) yading@11: #else yading@11: # define attribute_deprecated yading@11: #endif yading@11: yading@11: /** yading@11: * Disable warnings about deprecated features yading@11: * This is useful for sections of code kept for backward compatibility and yading@11: * scheduled for removal. yading@11: */ yading@11: #ifndef AV_NOWARN_DEPRECATED yading@11: #if AV_GCC_VERSION_AT_LEAST(4,6) yading@11: # define AV_NOWARN_DEPRECATED(code) \ yading@11: _Pragma("GCC diagnostic push") \ yading@11: _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ yading@11: code \ yading@11: _Pragma("GCC diagnostic pop") yading@11: #else yading@11: # define AV_NOWARN_DEPRECATED(code) code yading@11: #endif yading@11: #endif yading@11: yading@11: yading@11: #if defined(__GNUC__) yading@11: # define av_unused __attribute__((unused)) yading@11: #else yading@11: # define av_unused yading@11: #endif yading@11: yading@11: /** yading@11: * Mark a variable as used and prevent the compiler from optimizing it yading@11: * away. This is useful for variables accessed only from inline yading@11: * assembler without the compiler being aware. yading@11: */ yading@11: #if AV_GCC_VERSION_AT_LEAST(3,1) yading@11: # define av_used __attribute__((used)) yading@11: #else yading@11: # define av_used yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(3,3) yading@11: # define av_alias __attribute__((may_alias)) yading@11: #else yading@11: # define av_alias yading@11: #endif yading@11: yading@11: #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) yading@11: # define av_uninit(x) x=x yading@11: #else yading@11: # define av_uninit(x) x yading@11: #endif yading@11: yading@11: #ifdef __GNUC__ yading@11: # define av_builtin_constant_p __builtin_constant_p yading@11: # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) yading@11: #else yading@11: # define av_builtin_constant_p(x) 0 yading@11: # define av_printf_format(fmtpos, attrpos) yading@11: #endif yading@11: yading@11: #if AV_GCC_VERSION_AT_LEAST(2,5) yading@11: # define av_noreturn __attribute__((noreturn)) yading@11: #else yading@11: # define av_noreturn yading@11: #endif yading@11: yading@11: #endif /* AVUTIL_ATTRIBUTES_H */