Go to the documentation of this file.
31#ifdef SDL_begin_code_h
32#error Nested inclusion of SDL_begin_code.h
34#define SDL_begin_code_h
37# if defined(__GNUC__) && (__GNUC__ >= 4)
38# define SDL_DEPRECATED __attribute__((deprecated))
39# elif defined(_MSC_VER)
40# define SDL_DEPRECATED __declspec(deprecated)
42# define SDL_DEPRECATED
48# define SDL_UNUSED __attribute__((unused))
56# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
58# define SDL_DECLSPEC __declspec(dllexport)
63# if defined(__GNUC__) && __GNUC__ >= 4
64# define SDL_DECLSPEC __attribute__ ((visibility("default")))
73#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
74#define SDLCALL __cdecl
85#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
87#pragma warning(disable: 4103)
90#pragma clang diagnostic ignored "-Wpragma-pack"
105#define SDL_INLINE __inline__
106#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
107 defined(__DMC__) || defined(__SC__) || \
108 defined(__WATCOMC__) || defined(__LCC__) || \
109 defined(__DECC) || defined(__CC_ARM)
110#define SDL_INLINE __inline
112#define __inline__ __inline
115#define SDL_INLINE inline
117#define __inline__ inline
122#ifndef SDL_FORCE_INLINE
124#define SDL_FORCE_INLINE __forceinline
125#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
126#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
128#define SDL_FORCE_INLINE static SDL_INLINE
134#define SDL_NORETURN __attribute__((noreturn))
135#elif defined(_MSC_VER)
136#define SDL_NORETURN __declspec(noreturn)
143#if __has_feature(attribute_analyzer_noreturn)
144#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
148#ifndef SDL_ANALYZER_NORETURN
149#define SDL_ANALYZER_NORETURN
158#define NULL ((void *)0)
163#ifndef SDL_FALLTHROUGH
164#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
165 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
166#define SDL_FALLTHROUGH [[fallthrough]]
168#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
169#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
171#define SDL_HAS_FALLTHROUGH 0
173#if SDL_HAS_FALLTHROUGH && \
174 ((defined(__GNUC__) && __GNUC__ >= 7) || \
175 (defined(__clang_major__) && __clang_major__ >= 10))
176#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
178#define SDL_FALLTHROUGH do {} while (0)
180#undef SDL_HAS_FALLTHROUGH
185#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
186 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
187#define SDL_NODISCARD [[nodiscard]]
188#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
189#define SDL_NODISCARD __attribute__((warn_unused_result))
190#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
191#define SDL_NODISCARD _Check_return_
198#if defined(__GNUC__) && (__GNUC__ >= 3)
199#define SDL_MALLOC __attribute__((malloc))
209#ifndef SDL_ALLOC_SIZE
210#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
211#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
212#elif defined(_MSC_VER)
213#define SDL_ALLOC_SIZE(p)
215#define SDL_ALLOC_SIZE(p)
219#ifndef SDL_ALLOC_SIZE2
220#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
221#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
222#elif defined(_MSC_VER)
223#define SDL_ALLOC_SIZE2(p1, p2)
225#define SDL_ALLOC_SIZE2(p1, p2)