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

Reference Issue #9557.

This lets SDL_AudioFormat have the `#if byteorder == lilendian` section.
This commit is contained in:
Ryan C. Gordon 2024-04-25 16:42:44 -04:00
parent a13bdeee8a
commit 6b1a98e664
No known key found for this signature in database
GPG key ID: FA148B892AB48044
3 changed files with 14 additions and 15 deletions

View file

@ -860,6 +860,7 @@ while (my $d = readdir(DH)) {
}
# 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 @@ while (my $d = readdir(DH)) {
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";