From 0204c7d78833358195175f110b09b18e491f5b13 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 21 Aug 2025 12:56:20 +1000 Subject: [PATCH] Fix a compatibility error with va_copy(). --- miniaudio.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 0fb9918c..53dbe92d 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -13256,8 +13256,12 @@ Logging **************************************************************************************************************************************************************/ #ifndef ma_va_copy #if !defined(_MSC_VER) || _MSC_VER >= 1800 - #if (defined(__GNUC__) && __GNUC__ < 3) - #define ma_va_copy(dst, src) ((dst) = (src)) /* This is untested. Not sure if this is correct for old GCC. */ + #if !defined(__STDC_VERSION__) || (defined(__GNUC__) && __GNUC__ < 3) /* <-- va_copy() is not available when using `-std=c89`. The `!defined(__STDC_VERSION__)` parts is what checks for this. */ + #if defined(__va_copy) + #define ma_va_copy(dst, src) __va_copy(dst, src) + #else + #define ma_va_copy(dst, src) ((dst) = (src)) /* This is untested. Not sure if this is correct for old GCC. */ + #endif #else #define ma_va_copy(dst, src) va_copy((dst), (src)) #endif