Browse Source

The alloc_size attribute isn't supported in clang 3.x

Sam Lantinga 2 years ago
parent
commit
5dd07a5773
1 changed files with 2 additions and 2 deletions
  1. 2 2
      include/SDL3/SDL_begin_code.h

+ 2 - 2
include/SDL3/SDL_begin_code.h

@@ -182,7 +182,7 @@
 #endif /* SDL_MALLOC not defined */
 
 #ifndef SDL_ALLOC_SIZE
-#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#if (defined(__clang__) && __clang_major__ >= 4) || (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)
@@ -192,7 +192,7 @@
 #endif /* SDL_ALLOC_SIZE not defined */
 
 #ifndef SDL_ALLOC_SIZE2
-#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#if (defined(__clang__) && __clang_major__ >= 4) || (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)