#ifndef WH_AVUTIL_ATTRIBUTES_H_8960ee56_ #define WH_AVUTIL_ATTRIBUTES_H_8960ee56_ /* * This file was stolen from ffmpeg and modified for usability here. * The original is * * copyright (c) 2006 Michael Niedermayer * * This version is a derivative work of that version. It is not free * software; it is licensed under the GNU Lesser General Public * License version 2.1, which places nontrivial restrictions on what * may be done with it. (I'm not terribly happy about that, but for * my purposes accepting LGPL-infected code is a lower price than * reimplementing it all myself.) * * The LGPL v2.1 as distributed with ffmpeg is in the accompanying file * `LGPL-v2.1'. */ #ifdef __GNUC__ # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) #else # define AV_GCC_VERSION_AT_LEAST(x,y) 0 #endif #ifndef av_always_inline #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_always_inline __attribute__((__always_inline__)) inline #else # define av_always_inline inline #endif #endif #ifndef av_noreturn #if AV_GCC_VERSION_AT_LEAST(2,5) # define av_noreturn __attribute__((__noreturn__)) #else # define av_noreturn #endif #endif #ifndef av_noinline #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_noinline __attribute__((__noinline__)) #else # define av_noinline #endif #endif #ifndef av_pure #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_pure __attribute__((__pure__)) #else # define av_pure #endif #endif #ifndef av_const #if AV_GCC_VERSION_AT_LEAST(2,6) # define av_const __attribute__((__const__)) #else # define av_const #endif #endif #ifndef av_cold #if AV_GCC_VERSION_AT_LEAST(4,3) # define av_cold __attribute__((__cold__)) #else # define av_cold #endif #endif #ifndef av_flatten #if AV_GCC_VERSION_AT_LEAST(4,1) # define av_flatten __attribute__((__flatten__)) #else # define av_flatten #endif #endif #ifndef attribute_deprecated //#if AV_GCC_VERSION_AT_LEAST(3,1) //# define attribute_deprecated __attribute__((__deprecated__)) //#else # define attribute_deprecated //#endif #endif /** * Disable warnings about deprecated features * This is useful for sections of code kept for backward compatibility and * scheduled for removal. */ #ifndef AV_NOWARN_DEPRECATED #if AV_GCC_VERSION_AT_LEAST(4,6) # define AV_NOWARN_DEPRECATED(code) \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ code \ _Pragma("GCC diagnostic pop") #else # define AV_NOWARN_DEPRECATED(code) code #endif #endif #ifndef av_unused #if defined(__GNUC__) # define av_unused __attribute__((__unused__)) #else # define av_unused #endif #endif /** * Mark a variable as used and prevent the compiler from optimizing it * away. This is useful for variables accessed only from inline * assembler without the compiler being aware. */ #ifndef av_used #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_used __attribute__((__used__)) #else # define av_used #endif #endif #ifndef av_alias #if AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((__may_alias__)) #else # define av_alias #endif #endif #ifndef av_uninit #if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define av_uninit(x) x=x #else # define av_uninit(x) x #endif #endif #ifdef __GNUC__ # define av_builtin_constant_p __builtin_constant_p # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) #else # define av_builtin_constant_p(x) 0 # define av_printf_format(fmtpos, attrpos) #endif #endif