Go to the documentation of this file.
34#ifdef SDL_begin_code_h
35#error Nested inclusion of SDL_begin_code.h
37#define SDL_begin_code_h
40# if defined(__GNUC__) && (__GNUC__ >= 4)
41# define SDL_DEPRECATED __attribute__((deprecated))
42# elif defined(_MSC_VER)
43# define SDL_DEPRECATED __declspec(deprecated)
45# define SDL_DEPRECATED
51# define SDL_UNUSED __attribute__((unused))
59# if defined(SDL_PLATFORM_WINDOWS)
61# define SDL_DECLSPEC __declspec(dllexport)
66# if defined(__GNUC__) && __GNUC__ >= 4
67# define SDL_DECLSPEC __attribute__ ((visibility("default")))
76#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
77#define SDLCALL __cdecl
88#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
90#pragma warning(disable: 4103)
93#pragma clang diagnostic ignored "-Wpragma-pack"
108#define SDL_INLINE __inline__
109#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
110 defined(__DMC__) || defined(__SC__) || \
111 defined(__WATCOMC__) || defined(__LCC__) || \
112 defined(__DECC) || defined(__CC_ARM)
113#define SDL_INLINE __inline
115#define __inline__ __inline
118#define SDL_INLINE inline
120#define __inline__ inline
125#ifndef SDL_FORCE_INLINE
127#define SDL_FORCE_INLINE __forceinline
128#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
129#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
131#define SDL_FORCE_INLINE static SDL_INLINE
137#define SDL_NORETURN __attribute__((noreturn))
138#elif defined(_MSC_VER)
139#define SDL_NORETURN __declspec(noreturn)
146#if __has_feature(attribute_analyzer_noreturn)
147#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
151#ifndef SDL_ANALYZER_NORETURN
152#define SDL_ANALYZER_NORETURN
161#define NULL ((void *)0)
166#ifndef SDL_FALLTHROUGH
167#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
168 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
169#define SDL_FALLTHROUGH [[fallthrough]]
171#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
172#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
174#define SDL_HAS_FALLTHROUGH 0
176#if SDL_HAS_FALLTHROUGH && \
177 ((defined(__GNUC__) && __GNUC__ >= 7) || \
178 (defined(__clang_major__) && __clang_major__ >= 10))
179#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
181#define SDL_FALLTHROUGH do {} while (0)
183#undef SDL_HAS_FALLTHROUGH
188#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
189 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
190#define SDL_NODISCARD [[nodiscard]]
191#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
192#define SDL_NODISCARD __attribute__((warn_unused_result))
193#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
194#define SDL_NODISCARD _Check_return_
201#if defined(__GNUC__) && (__GNUC__ >= 3)
202#define SDL_MALLOC __attribute__((malloc))
212#ifndef SDL_ALLOC_SIZE
213#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
214#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
215#elif defined(_MSC_VER)
216#define SDL_ALLOC_SIZE(p)
218#define SDL_ALLOC_SIZE(p)
222#ifndef SDL_ALLOC_SIZE2
223#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
224#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
225#elif defined(_MSC_VER)
226#define SDL_ALLOC_SIZE2(p1, p2)
228#define SDL_ALLOC_SIZE2(p1, p2)