소스 검색

begin_code.h: add gcc version checks to the alloc_size attributes.

Ozkan Sezer 2 년 전
부모
커밋
14b902faca
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      include/SDL3/begin_code.h

+ 6 - 5
include/SDL3/begin_code.h

@@ -172,16 +172,17 @@
 #ifndef SDL_MALLOC
 #if defined(__GNUC__)
 #define SDL_MALLOC __attribute__((malloc))
-// FIXME
-//#elif defined(_MSC_VER)
-//#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
+/* FIXME
+#elif defined(_MSC_VER)
+#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
+*/
 #else
 #define SDL_MALLOC
 #endif
 #endif /* SDL_MALLOC not defined */
 
 #ifndef SDL_ALLOC_SIZE
-#if defined(__GNUC__)
+#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
 #define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
 #elif defined(_MSC_VER)
 #define SDL_ALLOC_SIZE(p)
@@ -191,7 +192,7 @@
 #endif /* SDL_ALLOC_SIZE not defined */
 
 #ifndef SDL_ALLOC_SIZE2
-#if defined(__GNUC__)
+#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
 #define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
 #elif defined(_MSC_VER)
 #define SDL_ALLOC_SIZE2(p1, p2)