#pragma once
#if !defined(__clang__) && !defined(_MSC_VER) && defined(__GNUC__) && \
__GNUC__ < 7
#error \
"You're trying to build ExecuTorch with a too old version of GCC. We need GCC 7 or later."
#endif
#if defined(__clang__) && __clang_major__ < 5
#error \
"You're trying to build ExecuTorch with a too old version of Clang. We need Clang 5 or later."
#endif
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \
(!defined(_MSC_VER) && __cplusplus < 201703L)
#error "You need C++17 to compile ExecuTorch"
#endif
#if defined(_MSC_VER) && (defined(min) || defined(max))
#error \
"Macro clash with min and max -- define NOMINMAX when compiling your program on Windows"
#endif
#define ET_NORETURN [[noreturn]]
#if defined(_MSC_VER)
#define ET_NOINLINE __declspec(noinline)
#define ET_INLINE __forceinline
#else
#define ET_NOINLINE __attribute__((noinline))
#define ET_INLINE __attribute__((always_inline)) inline
#endif
#if defined(_MSC_VER)
#define ET_RESTRICT __restrict
#else
#define ET_RESTRICT __restrict__
#endif
#if defined(__GNUC__)
#define ET_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
#define ET_UNREACHABLE() __assume(0)
#else
#define ET_UNREACHABLE() \
while (1) \
;
#endif
#define ET_DEPRECATED [[deprecated]]
#define ET_EXPERIMENTAL \
[[deprecated("This API is experimental and may change without notice.")]]
#define ET_FALLTHROUGH [[fallthrough]]
#define ET_NODISCARD [[nodiscard]]
#define ET_UNUSED [[maybe_unused]]
#if (__cplusplus) >= 202002L
#define ET_LIKELY(expr) (expr) [[likely]]
#define ET_UNLIKELY(expr) (expr) [[unlikely]]
#else
#define ET_LIKELY(expr) (expr)
#define ET_UNLIKELY(expr) (expr)
#endif
#ifdef _MSC_VER
#define ET_WEAK
#else
#define ET_WEAK __attribute__((weak))
#endif
#ifdef _MSC_VER
#include <sal.h>
#define ET_PRINTFLIKE(_string_index, _va_index) _Printf_format_string_
#else
#define ET_PRINTFLIKE(_string_index, _va_index) \
__attribute__((format(printf, _string_index, _va_index)))
#endif
#ifndef __has_builtin
#define __has_builtin(x) (0)
#endif
#if defined(__FILE_NAME__)
#define ET_SHORT_FILENAME __FILE_NAME__
#elif __has_builtin(__builtin_strrchr)
#define ET_SHORT_FILENAME (__builtin_strrchr("/" __FILE__, '/') + 1)
#else
#define ET_SHORT_FILENAME __FILE__
#endif
#if __has_builtin(__builtin_LINE)
#define ET_LINE __builtin_LINE()
#else
#define ET_LINE __LINE__
#endif
#if defined(ET_USE_BUILTIN_FUNCTION_NAME) && ET_USE_BUILTIN_FUNCTION_NAME == 0
#define ET_FUNCTION __FUNCTION__
#elif __has_builtin(__builtin_FUNCTION)
#define ET_FUNCTION __builtin_FUNCTION()
#else
#define ET_FUNCTION __FUNCTION__
#endif
#if defined(__XTENSA__)
#define ET_PRIsize_t "u"
#define ET_PRIssize_t "d"
#else
#define ET_PRIsize_t "zu"
#define ET_PRIssize_t "zd"
#endif
#ifndef ET_HAVE_GNU_STATEMENT_EXPRESSIONS
#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__clang__)
#define ET_HAVE_GNU_STATEMENT_EXPRESSIONS 1
#else
#define ET_HAVE_GNU_STATEMENT_EXPRESSIONS 0
#endif
#endif
#ifndef _MSC_VER
#include <sys/types.h>
#else
#include <stddef.h>
using ssize_t = ptrdiff_t;
#endif
#ifdef __EXCEPTIONS
#define ET_HAS_EXCEPTIONS 1
#elif defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
#define ET_HAS_EXCEPTIONS 1
#else
#define ET_HAS_EXCEPTIONS 0
#endif
#define __ET_DEPRECATED ET_DEPRECATED
#define __ET_FALLTHROUGH ET_FALLTHROUGH
#define __ET_FUNCTION ET_FUNCTION
#define __ET_HAVE_GNU_STATEMENT_EXPRESSIONS ET_HAVE_GNU_STATEMENT_EXPRESSIONS
#define __ET_INLINE ET_INLINE
#define __ET_LIKELY ET_LIKELY
#define __ET_LINE ET_LINE
#define __ET_NODISCARD ET_NODISCARD
#define __ET_NOINLINE ET_NOINLINE
#define __ET_NORETURN ET_NORETURN
#define __ET_PRINTFLIKE ET_PRINTFLIKE
#define __ET_SHORT_FILENAME ET_SHORT_FILENAME
#define __ET_UNLIKELY ET_UNLIKELY
#define __ET_UNREACHABLE ET_UNREACHABLE
#define __ET_UNUSED ET_UNUSED
#define __ET_WEAK ET_WEAK