checksrc: detect and warn for (void)!

It's plain weird. Don't do it.

Closes #22023
This commit is contained in:
Daniel Stenberg 2026-06-15 13:51:52 +02:00
parent b0d733e143
commit 9f25dcea55
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -202,6 +202,7 @@ my %warnings = (
'TYPEDEFSTRUCT' => 'typedefed struct',
'UNUSEDIGNORE' => 'a warning ignore was not used',
'USESAFEFREE' => 'replace curlx_free() + NULL assignment with curlx_safefree()',
'VOIDEXCL' => '(void)! is not something we like',
);
sub readskiplist {
@ -1165,6 +1166,12 @@ sub scanfile {
"space after exclamation mark");
}
if($nostr =~ /(.*)\(void\)\!/) {
checkwarn("VOIDEXCL",
$line, length($1)+1, $file, $ol,
"exclamation after (void) is weird");
}
if($nostr =~ /(.*)\b(EACCES|EADDRINUSE|EADDRNOTAVAIL|EAFNOSUPPORT|EBADF|ECONNREFUSED|ECONNRESET|EINPROGRESS|EINTR|EINVAL|EISCONN|EMSGSIZE|ENOMEM|ETIMEDOUT|EWOULDBLOCK)\b/) {
checkwarn("ERRNOVAR",
$line, length($1), $file, $ol,