From 3ebfdb04be8d543321524113951f817e0e2c56c4 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..
... and re-enable clang-tidy in CI for LoongArch64.
Fixes: https://github.com/libsdl-org/SDL/issues/11219.
---
.github/workflows/create-test-plan.py | 1 -
include/SDL3/SDL_stdinc.h | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py
index 52691d4acb31a..cea7997d0ad48 100755
--- a/.github/workflows/create-test-plan.py
+++ b/.github/workflows/create-test-plan.py
@@ -632,7 +632,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
))
job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A
- job.clang_tidy = False
case SdlPlatform.N3ds:
job.shared = False
job.apt_packages = ["ninja-build", "binutils"]
diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h
index 28b0147d95154..a2c91caf8690e 100644
--- a/include/SDL3/SDL_stdinc.h
+++ b/include/SDL3/SDL_stdinc.h
@@ -4244,6 +4244,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 <stdio.h>