tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

attributes.h (4889B)


      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 /**
     22 * @file
     23 * Macro definitions for various function/variable attributes
     24 */
     25 
     26 #ifndef AVUTIL_ATTRIBUTES_H
     27 #define AVUTIL_ATTRIBUTES_H
     28 
     29 #ifdef __GNUC__
     30 #  define AV_GCC_VERSION_AT_LEAST(x, y) \
     31    (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
     32 #  define AV_GCC_VERSION_AT_MOST(x, y) \
     33    (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
     34 #else
     35 #  define AV_GCC_VERSION_AT_LEAST(x, y) 0
     36 #  define AV_GCC_VERSION_AT_MOST(x, y) 0
     37 #endif
     38 
     39 #ifdef __has_builtin
     40 #  define AV_HAS_BUILTIN(x) __has_builtin(x)
     41 #else
     42 #  define AV_HAS_BUILTIN(x) 0
     43 #endif
     44 
     45 #ifndef av_always_inline
     46 #  if AV_GCC_VERSION_AT_LEAST(3, 1)
     47 #    define av_always_inline __attribute__((always_inline)) inline
     48 #  elif defined(_MSC_VER)
     49 #    define av_always_inline __forceinline
     50 #  else
     51 #    define av_always_inline inline
     52 #  endif
     53 #endif
     54 
     55 #ifndef av_extern_inline
     56 #  if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
     57 #    define av_extern_inline extern inline
     58 #  else
     59 #    define av_extern_inline inline
     60 #  endif
     61 #endif
     62 
     63 #if AV_GCC_VERSION_AT_LEAST(3, 4)
     64 #  define av_warn_unused_result __attribute__((warn_unused_result))
     65 #else
     66 #  define av_warn_unused_result
     67 #endif
     68 
     69 #if AV_GCC_VERSION_AT_LEAST(3, 1)
     70 #  define av_noinline __attribute__((noinline))
     71 #elif defined(_MSC_VER)
     72 #  define av_noinline __declspec(noinline)
     73 #else
     74 #  define av_noinline
     75 #endif
     76 
     77 #if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
     78 #  define av_pure __attribute__((pure))
     79 #else
     80 #  define av_pure
     81 #endif
     82 
     83 #if AV_GCC_VERSION_AT_LEAST(2, 6) || defined(__clang__)
     84 #  define av_const __attribute__((const))
     85 #else
     86 #  define av_const
     87 #endif
     88 
     89 #if AV_GCC_VERSION_AT_LEAST(4, 3) || defined(__clang__)
     90 #  define av_cold __attribute__((cold))
     91 #else
     92 #  define av_cold
     93 #endif
     94 
     95 #if AV_GCC_VERSION_AT_LEAST(4, 1) && !defined(__llvm__)
     96 #  define av_flatten __attribute__((flatten))
     97 #else
     98 #  define av_flatten
     99 #endif
    100 
    101 #if AV_GCC_VERSION_AT_LEAST(3, 1)
    102 #  define attribute_deprecated __attribute__((deprecated))
    103 #elif defined(_MSC_VER)
    104 #  define attribute_deprecated __declspec(deprecated)
    105 #else
    106 #  define attribute_deprecated
    107 #endif
    108 
    109 /**
    110 * Disable warnings about deprecated features
    111 * This is useful for sections of code kept for backward compatibility and
    112 * scheduled for removal.
    113 */
    114 #ifndef AV_NOWARN_DEPRECATED
    115 #  if AV_GCC_VERSION_AT_LEAST(4, 6)
    116 #    define AV_NOWARN_DEPRECATED(code)                                    \
    117      _Pragma("GCC diagnostic push")                                      \
    118          _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
    119              code _Pragma("GCC diagnostic pop")
    120 #  elif defined(_MSC_VER)
    121 #    define AV_NOWARN_DEPRECATED(code)                                \
    122      __pragma(warning(push)) __pragma(warning(disable : 4996)) code; \
    123      __pragma(warning(pop))
    124 #  else
    125 #    define AV_NOWARN_DEPRECATED(code) code
    126 #  endif
    127 #endif
    128 
    129 #if defined(__GNUC__) || defined(__clang__)
    130 #  define av_unused __attribute__((unused))
    131 #else
    132 #  define av_unused
    133 #endif
    134 
    135 /**
    136 * Mark a variable as used and prevent the compiler from optimizing it
    137 * away.  This is useful for variables accessed only from inline
    138 * assembler without the compiler being aware.
    139 */
    140 #if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
    141 #  define av_used __attribute__((used))
    142 #else
    143 #  define av_used
    144 #endif
    145 
    146 #if AV_GCC_VERSION_AT_LEAST(3, 3) || defined(__clang__)
    147 #  define av_alias __attribute__((may_alias))
    148 #else
    149 #  define av_alias
    150 #endif
    151 
    152 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
    153 #  define av_uninit(x) x = x
    154 #else
    155 #  define av_uninit(x) x
    156 #endif
    157 
    158 #if defined(__GNUC__) || defined(__clang__)
    159 #  define av_builtin_constant_p __builtin_constant_p
    160 #  define av_printf_format(fmtpos, attrpos) \
    161    __attribute__((__format__(__printf__, fmtpos, attrpos)))
    162 #else
    163 #  define av_builtin_constant_p(x) 0
    164 #  define av_printf_format(fmtpos, attrpos)
    165 #endif
    166 
    167 #if AV_GCC_VERSION_AT_LEAST(2, 5) || defined(__clang__)
    168 #  define av_noreturn __attribute__((noreturn))
    169 #else
    170 #  define av_noreturn
    171 #endif
    172 
    173 #endif /* AVUTIL_ATTRIBUTES_H */