SDL: wikiheaders: Allow basic typedefs to pull in some preprocessor logic.

From 6b1a98e6645955179669c59c3bfbd94d59d87d92 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 25 Apr 2024 16:42:44 -0400
Subject: [PATCH] wikiheaders: Allow basic typedefs to pull in some
 preprocessor logic.

Reference Issue #9557.

This lets SDL_AudioFormat have the `#if byteorder == lilendian` section.
---
 build-scripts/wikiheaders.pl |  3 ++-
 include/SDL3/SDL_audio.h     | 19 ++++++++++---------
 include/SDL3/SDL_thread.h    |  7 ++-----
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 96d04edf43256..799aeb03dd94f 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -860,6 +860,7 @@ sub print_undocumented_section {
             }
 
             # We assume any `#define`s directly after the typedef are related to it: probably bitflags for an integer typedef.
+            # We'll also allow lines that start with `#if` or `#else` or `#elif`
             # Blank lines are allowed, anything else, even comments, are not.
             my $blank_lines = 0;
             my $lastpos = tell(FH);
@@ -869,7 +870,7 @@ sub print_undocumented_section {
 
                 if (/\A\s*\Z/) {
                     $blank_lines++;
-                } elsif (/\A\s*\#define\s+/) {
+                } elsif (/\A\s*\#(define|if|else|elif)(\s+|\Z)/) {
                     if ($blank_lines > 0) {
                         while ($blank_lines > 0) {
                             $additional_decl .= "\n";
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 323e1f3604411..dd5296fd53a9a 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -98,6 +98,16 @@ typedef Uint16 SDL_AudioFormat;
 #define SDL_AUDIO_F32LE     0x8120  /**< 32-bit floating point samples */
 #define SDL_AUDIO_F32BE     0x9120  /**< As above, but big-endian byte order */
 
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define SDL_AUDIO_S16    SDL_AUDIO_S16LE
+#define SDL_AUDIO_S32    SDL_AUDIO_S32LE
+#define SDL_AUDIO_F32    SDL_AUDIO_F32LE
+#else
+#define SDL_AUDIO_S16    SDL_AUDIO_S16BE
+#define SDL_AUDIO_S32    SDL_AUDIO_S32BE
+#define SDL_AUDIO_F32    SDL_AUDIO_F32BE
+#endif
+
 
 /* masks for different parts of SDL_AudioFormat. */
 #define SDL_AUDIO_MASK_BITSIZE       (0xFF)
@@ -218,15 +228,6 @@ typedef Uint16 SDL_AudioFormat;
  */
 #define SDL_AUDIO_ISUNSIGNED(x)      (!SDL_AUDIO_ISSIGNED(x))
 
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_AUDIO_S16    SDL_AUDIO_S16LE
-#define SDL_AUDIO_S32    SDL_AUDIO_S32LE
-#define SDL_AUDIO_F32    SDL_AUDIO_F32LE
-#else
-#define SDL_AUDIO_S16    SDL_AUDIO_S16BE
-#define SDL_AUDIO_S32    SDL_AUDIO_S32BE
-#define SDL_AUDIO_F32    SDL_AUDIO_F32BE
-#endif
 
 /**
  * SDL Audio Device instance IDs.
diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h
index 2213adfd4cad6..5aa7766c9ba77 100644
--- a/include/SDL3/SDL_thread.h
+++ b/include/SDL3/SDL_thread.h
@@ -83,11 +83,7 @@ typedef enum SDL_ThreadPriority {
  */
 typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
 
-
-#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_WINRT)
-/**
- *  \file SDL_thread.h
- *
+/*
  *  We compile SDL into a DLL. This means, that it's the DLL which
  *  creates a new thread for the calling process with the SDL_CreateThread()
  *  API. There is a problem with this, that only the RTL of the SDL3.DLL will
@@ -105,6 +101,7 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *  Always use the _beginthread() and _endthread() of the calling runtime
  *  library!
  */
+#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_WINRT)
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
 
 typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread)