From 8ab3ae98f0b4ab13363d4970a8d1b394b096c5ce Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 10 May 2022 09:44:23 +0100 Subject: [PATCH] stdinc: Add a comment to clarify why inline functions are needed here Signed-off-by: Simon McVittie --- include/SDL_stdinc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 59958ca08..3196172ec 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -752,6 +752,9 @@ SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a, } #if _SDL_HAS_BUILTIN(__builtin_mul_overflow) +/* This needs to be wrapped in an inline rather than being a direct #define, + * because __builtin_mul_overflow() is type-generic, but we want to be + * consistent about interpreting a and b as size_t. */ SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a, size_t b, size_t *ret) @@ -779,6 +782,8 @@ SDL_FORCE_INLINE int SDL_size_add_overflow (size_t a, } #if _SDL_HAS_BUILTIN(__builtin_add_overflow) +/* This needs to be wrapped in an inline rather than being a direct #define, + * the same as the call to __builtin_mul_overflow() above. */ SDL_FORCE_INLINE int _SDL_size_add_overflow_builtin (size_t a, size_t b, size_t *ret)