checkpatch: recognize json_array_for_each 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
This commit is contained in:
Oliver Smith 2024-03-28 08:55:07 +01:00
parent b5a1b009b7
commit ba8e261639
1 changed files with 2 additions and 1 deletions

View File

@ -4888,6 +4888,7 @@ sub process {
# 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 @@ sub process {
}
# 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) {