From e9b5f6749e47388c9283c78102f2b088bb39d829 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 22 Oct 2024 10:47:51 -0400
Subject: [PATCH] wikiheaders: add (disabled) code to check for missing
`\threadsafety` tags.
Reference Issue #7140.
---
build-scripts/wikiheaders.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 071e4695d1e7d..510ee39722531 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -1860,6 +1860,7 @@ sub sanitize_c_typename {
my @paramsorder = ();
my $fnsigparams = $headersymsparaminfo{$sym};
my $has_returns = 0;
+ my $has_threadsafety = 0;
while (@doxygenlines) {
my $l = shift @doxygenlines;
@@ -1998,6 +1999,7 @@ sub sanitize_c_typename {
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Thread Safety'} = wordwrap(wikify($wikitype, $desc)) . "\n";
+ $has_threadsafety = 1;
} elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
my $sa = $1;
$sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
@@ -2014,6 +2016,11 @@ sub sanitize_c_typename {
print STDERR "WARNING: Function '$sym' has a non-void return type but no '\\returns' declaration\n";
}
+ # !!! FIXME: uncomment this when we're trying to clean this up in the headers.
+ #if (($symtype == 1) && !$has_threadsafety) {
+ # print STDERR "WARNING: Function '$sym' doesn't have a '\\threadsafety' declaration\n";
+ #}
+
# Make sure %params is in the same order as the actual function signature and add C datatypes...
my $params_has_c_datatype = 0;
my @final_params = ();