From a976f7f71bbf9d7b851faeaeba9197e60e9bb1d0 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 16 Oct 2024 21:24:56 +0300
Subject: [PATCH] SDL_stdinc.h: provide a prototype for strdup for
__clang_analyzer__ case
Because strdup is not ANSI but POSIX, and its prototype might be hidden..
Reference issue: https://github.com/libsdl-org/SDL/issues/11219.
(cherry picked from commit 3ebfdb04be8d543321524113951f817e0e2c56c4)
---
include/SDL_stdinc.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index 3f01d56a5513e..9fa348826a26d 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -749,6 +749,9 @@ 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
+/* strdup is not ANSI but POSIX, and its prototype might be hidden... */
+char *strdup(const char *str);
+
/* Starting LLVM 16, the analyser errors out if these functions do not have
their prototype defined (clang-diagnostic-implicit-function-declaration) */
#include <stdlib.h>