Browse Source

include: add SDL_RESTRICT for restricted pointer aliasing

Anonymous Maarten 11 months ago
parent
commit
55934bc85e
2 changed files with 11 additions and 0 deletions
  1. 10 0
      include/SDL3/SDL_begin_code.h
  2. 1 0
      src/dynapi/gendynapi.py

+ 10 - 0
include/SDL3/SDL_begin_code.h

@@ -225,3 +225,13 @@
 #define SDL_ALLOC_SIZE2(p1, p2)
 #endif
 #endif /* SDL_ALLOC_SIZE2 not defined */
+
+#ifndef SDL_RESTRICT
+#if defined(__GNUC__)
+#define SDL_RESTRICT __restrict__
+#elif defined(_MSC_VER)
+#define SDL_RESTRICT __restrict
+#else
+#define SDL_RESTRICT
+#endif
+#endif

+ 1 - 0
src/dynapi/gendynapi.py

@@ -180,6 +180,7 @@ def main():
             func = re.sub(r" SDL_RELEASE\(.*\)", "", func);
             func = re.sub(r" SDL_RELEASE_SHARED\(.*\)", "", func);
             func = re.sub(r" SDL_RELEASE_GENERIC\(.*\)", "", func);
+            func = func.replace(" SDL_RESTRICT", "");
 
             # Should be a valid function here
             match = reg_parsing_function.match(func)