checkpatch: exclude lib/posix/*.c from negative errno rule

The `USE_NEGATIVE_ERRNO` rule consistently generates false
positives when working with certain areas of POSIX.

It makes sense to disable this check for the POSIX API
rather than requiring merge superpowers constantly. That
way, we can merge as per usual after sufficient approvals
rather than waiting for someone with merge superpowers to
override / manually merge.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
Christopher Friedt 2023-07-05 17:36:49 -04:00 committed by Chris Friedt
parent 1f8d2e492e
commit 6e27b7d566

View file

@ -5014,10 +5014,13 @@ sub process {
if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
my $name = $1;
if ($name ne 'EOF' && $name ne 'ERROR') {
# only print this warning if not dealing with 'lib/posix/*.c'
if ($realfile =~ /.*\/lib\/posix\/*.c/) {
WARN("USE_NEGATIVE_ERRNO",
"return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
}
}
}
# Need a space before open parenthesis after if, while etc
if ($line =~ /\b(if|while|for|switch)\(/) {