osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/36487?usp=email )
Change subject: checkpatch: recognize json_array_foreach etc. ......................................................................
checkpatch: recognize json_array_foreach etc.
Treat json_array_foreach, json_object_foreach, json_object_foreach_safe etc. the same as if, while, for, switch, and require exactly one space after using it:
json_array_foreach (nftables, i, item) { … }
Related: osmo-hnbgw Id4e7fa017c31945388a010d8581715d71482116b Change-Id: I0b58c6d70a961c7d0ba93a2f0d6a5a4afa321fa9 --- M lint/checkpatch/checkpatch.pl 1 file changed, 20 insertions(+), 1 deletion(-)
Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl index eada2a9..ff6eea1 100755 --- a/lint/checkpatch/checkpatch.pl +++ b/lint/checkpatch/checkpatch.pl @@ -4888,6 +4888,7 @@ # Ignore those directives where spaces _are_ permitted. if ($name =~ /^(?: if|for|while|switch|return|case| + [a-z_]*for[_]?each[a-z_]*| volatile|__volatile__| __attribute__|format|__extension__| asm|__asm__)$/x) @@ -5513,7 +5514,7 @@ }
# Need a space before open parenthesis after if, while etc - if ($line =~ /\b(if|while|for|switch)(/) { + if ($line =~ /\b(if|while|for|switch|[a-z_]*for[_]?each[a-z_]*)(/) { if (ERROR("SPACING", "space required before the open parenthesis '('\n" . $herecurr) && $fix) {