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)
287#ifndef SDL_HAS_BUILTIN
289#define SDL_HAS_BUILTIN(x) __has_builtin(x)
291#define SDL_HAS_BUILTIN(x) 0
295#ifndef SDL_DEPRECATED
296# if defined(__GNUC__) && (__GNUC__ >= 4)
297# define SDL_DEPRECATED __attribute__((deprecated))
298# elif defined(_MSC_VER)
299# define SDL_DEPRECATED __declspec(deprecated)
301# define SDL_DEPRECATED
307# define SDL_UNUSED __attribute__((unused))
315# if defined(SDL_PLATFORM_WINDOWS)
317# define SDL_DECLSPEC __declspec(dllexport)
322# if defined(__GNUC__) && __GNUC__ >= 4
323# define SDL_DECLSPEC __attribute__ ((visibility("default")))
332#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
333#define SDLCALL __cdecl
344#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
346#pragma warning(disable: 4103)
349#pragma clang diagnostic ignored "-Wpragma-pack"
364#define SDL_INLINE __inline__
365#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
366 defined(__DMC__) || defined(__SC__) || \
367 defined(__WATCOMC__) || defined(__LCC__) || \
368 defined(__DECC) || defined(__CC_ARM)
369#define SDL_INLINE __inline
371#define __inline__ __inline
374#define SDL_INLINE inline
376#define __inline__ inline
381#ifndef SDL_FORCE_INLINE
383#define SDL_FORCE_INLINE __forceinline
384#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
385#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
387#define SDL_FORCE_INLINE static SDL_INLINE
393#define SDL_NORETURN __attribute__((noreturn))
394#elif defined(_MSC_VER)
395#define SDL_NORETURN __declspec(noreturn)
402#if __has_feature(attribute_analyzer_noreturn)
403#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
407#ifndef SDL_ANALYZER_NORETURN
408#define SDL_ANALYZER_NORETURN
417#define NULL ((void *)0)
422#ifndef SDL_FALLTHROUGH
423#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
424 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
425#define SDL_FALLTHROUGH [[fallthrough]]
427#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
428#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
430#define SDL_HAS_FALLTHROUGH 0
432#if SDL_HAS_FALLTHROUGH && \
433 ((defined(__GNUC__) && __GNUC__ >= 7) || \
434 (defined(__clang_major__) && __clang_major__ >= 10))
435#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
437#define SDL_FALLTHROUGH do {} while (0)
439#undef SDL_HAS_FALLTHROUGH
444#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
445 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
446#define SDL_NODISCARD [[nodiscard]]
447#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
448#define SDL_NODISCARD __attribute__((warn_unused_result))
449#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
450#define SDL_NODISCARD _Check_return_
457#if defined(__GNUC__) && (__GNUC__ >= 3)
458#define SDL_MALLOC __attribute__((malloc))
468#ifndef SDL_ALLOC_SIZE
469#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
470#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
471#elif defined(_MSC_VER)
472#define SDL_ALLOC_SIZE(p)
474#define SDL_ALLOC_SIZE(p)
478#ifndef SDL_ALLOC_SIZE2
479#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
480#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
481#elif defined(_MSC_VER)
482#define SDL_ALLOC_SIZE2(p1, p2)
484#define SDL_ALLOC_SIZE2(p1, p2)