Skip to content

Commit

Permalink
SDL_stdinc.h: provide a prototype for strdup for __clang_analyzer__ case
Browse files Browse the repository at this point in the history
Because strdup is not ANSI but POSIX, and its prototype might be hidden..

Reference issue: #11219.

(cherry picked from commit 3ebfdb0)
  • Loading branch information
sezero committed Oct 16, 2024
1 parent 3782344 commit a976f7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit a976f7f

Please sign in to comment.