From c5245320b8045642a283554a0f3007a8f9c8c040 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 4 May 2025 20:01:24 +0300 Subject: [PATCH] don't prototype strdup() for __clang_analyzer__ case in windows builds. Fixes: https://github.com/libsdl-org/SDL/issues/12948. --- include/SDL3/SDL_stdinc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index fd80d729d3333..2a23ad5086cc8 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -5974,8 +5974,12 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size); size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); #endif +#ifndef _WIN32 /* strdup is not ANSI but POSIX, and its prototype might be hidden... */ +/* not for windows: might conflict with string.h where strdup may have + * dllimport attribute: https://github.com/libsdl-org/SDL/issues/12948 */ char *strdup(const char *str); +#endif /* Starting LLVM 16, the analyser errors out if these functions do not have their prototype defined (clang-diagnostic-implicit-function-declaration) */