Go to the documentation of this file.
37#ifdef SDL_begin_code_h
38#error Nested inclusion of SDL_begin_code.h
40#define SDL_begin_code_h
42#ifdef SDL_WIKI_DOCUMENTATION_SECTION
67#define SDL_DEPRECATED __attribute__((deprecated))
81#define SDL_DECLSPEC __attribute__ ((visibility("default")))
102#define SDLCALL __cdecl
113#define SDL_INLINE __inline
128#define SDL_FORCE_INLINE __forceinline
145#define SDL_NORETURN __attribute__((noreturn))
165#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
193#define SDL_FALLTHROUGH [[fallthrough]]
220#define SDL_NODISCARD [[nodiscard]]
237#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
253#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
266#define SDL_RESTRICT __restrict
282#define SDL_HAS_BUILTIN(x) __has_builtin(x)
298#define SDL_HAS_EXTENSION(x) __has_extension(x)
339#define SDL_ALIGNED(x) __attribute__((aligned(x)))
346# if defined(restrict) || ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
347# define SDL_RESTRICT restrict
348# elif defined(_MSC_VER) || defined(__GNUC__) || defined(__clang__)
349# define SDL_RESTRICT __restrict
355#ifndef SDL_HAS_BUILTIN
357#define SDL_HAS_BUILTIN(x) __has_builtin(x)
359#define SDL_HAS_BUILTIN(x) 0
363#ifndef SDL_HAS_EXTENSION
364#ifdef __has_extension
365#define SDL_HAS_EXTENSION(x) __has_extension(x)
367#define SDL_HAS_EXTENSION(x) 0
371#ifndef SDL_DEPRECATED
372# if defined(__GNUC__) && (__GNUC__ >= 4)
373# define SDL_DEPRECATED __attribute__((deprecated))
374# elif defined(_MSC_VER)
375# define SDL_DEPRECATED __declspec(deprecated)
377# define SDL_DEPRECATED
383# define SDL_UNUSED __attribute__((unused))
391# if defined(SDL_PLATFORM_WINDOWS)
393# define SDL_DECLSPEC __declspec(dllexport)
398# if defined(__GNUC__) && __GNUC__ >= 4
399# define SDL_DECLSPEC __attribute__ ((visibility("default")))
408#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
409#define SDLCALL __cdecl
420#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
422#pragma warning(disable: 4103)
425#pragma clang diagnostic ignored "-Wpragma-pack"
440#define SDL_INLINE __inline__
441#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
442 defined(__DMC__) || defined(__SC__) || \
443 defined(__WATCOMC__) || defined(__LCC__) || \
444 defined(__DECC) || defined(__CC_ARM)
445#define SDL_INLINE __inline
447#define __inline__ __inline
450#define SDL_INLINE inline
452#define __inline__ inline
457#ifndef SDL_FORCE_INLINE
458#if defined(_MSC_VER) && (_MSC_VER >= 1200)
459#define SDL_FORCE_INLINE __forceinline
460#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
461#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
463#define SDL_FORCE_INLINE static SDL_INLINE
469#define SDL_NORETURN __attribute__((noreturn))
470#elif defined(_MSC_VER)
471#define SDL_NORETURN __declspec(noreturn)
478#if __has_feature(attribute_analyzer_noreturn)
479#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
483#ifndef SDL_ANALYZER_NORETURN
484#define SDL_ANALYZER_NORETURN
493#define NULL ((void *)0)
498#ifndef SDL_FALLTHROUGH
499#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
500 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
501#define SDL_FALLTHROUGH [[fallthrough]]
503#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
504#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
506#define SDL_HAS_FALLTHROUGH 0
508#if SDL_HAS_FALLTHROUGH && \
509 ((defined(__GNUC__) && __GNUC__ >= 7) || \
510 (defined(__clang_major__) && __clang_major__ >= 10))
511#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
513#define SDL_FALLTHROUGH do {} while (0)
515#undef SDL_HAS_FALLTHROUGH
520#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
521 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
522#define SDL_NODISCARD [[nodiscard]]
523#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
524#define SDL_NODISCARD __attribute__((warn_unused_result))
525#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
526#define SDL_NODISCARD _Check_return_
533#if defined(__GNUC__) && (__GNUC__ >= 3)
534#define SDL_MALLOC __attribute__((malloc))
544#ifndef SDL_ALLOC_SIZE
545#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
546#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
547#elif defined(_MSC_VER)
548#define SDL_ALLOC_SIZE(p)
550#define SDL_ALLOC_SIZE(p)
554#ifndef SDL_ALLOC_SIZE2
555#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
556#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
557#elif defined(_MSC_VER)
558#define SDL_ALLOC_SIZE2(p1, p2)
560#define SDL_ALLOC_SIZE2(p1, p2)
565#if defined(__clang__) || defined(__GNUC__)
566#define SDL_ALIGNED(x) __attribute__((aligned(x)))
567#elif defined(_MSC_VER)
568#define SDL_ALIGNED(x) __declspec(align(x))
569#elif defined(__cplusplus) && (__cplusplus >= 201103L)
570#define SDL_ALIGNED(x) alignas(x)
571#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
572#define SDL_ALIGNED(x) _Alignas(x)
574#define SDL_ALIGNED(x) PLEASE_DEFINE_SDL_ALIGNED