]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools: add iterators to checkpatch
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 12 Oct 2021 22:00:03 +0000 (00:00 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 19 Oct 2021 12:58:51 +0000 (14:58 +0200)
For the purpose of allowing the space in `frr_each (`, copy the list of
iterators from .clang-format and wire it up appropriately.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tools/checkpatch.pl

index cf15d007965ded1635b87efec17e882795896122..984112de051d232b9d3f8a59c617f3a9b1b6e12e 100755 (executable)
@@ -409,6 +409,25 @@ our $Operators     = qr{
                  }x;
 
 our $c90_Keywords = qr{do|for|while|if|else|return|goto|continue|switch|default|case|break}x;
+our $Iterators = qr{
+                       frr_each|frr_each_safe|frr_each_from|
+                       frr_with_mutex|frr_with_privs|
+                       LIST_FOREACH|LIST_FOREACH_SAFE|
+                       SLIST_FOREACH|SLIST_FOREACH_SAFE|SLIST_FOREACH_PREVPTR|
+                       STAILQ_FOREACH|STAILQ_FOREACH_SAFE|
+                       TAILQ_FOREACH|TAILQ_FOREACH_SAFE|TAILQ_FOREACH_REVERSE|TAILQ_FOREACH_REVERSE_SAFE|
+                       RB_FOREACH|RB_FOREACH_SAFE|RB_FOREACH_REVERSE|RB_FOREACH_REVERSE_SAFE|
+                       SPLAY_FOREACH|
+                       FOR_ALL_INTERFACES|FOR_ALL_INTERFACES_ADDRESSES|JSON_FOREACH|
+                       LY_FOR_KEYS|LY_LIST_FOR|LY_TREE_FOR|LY_TREE_DFS_BEGIN|LYD_TREE_DFS_BEGIN|
+                       RE_DEST_FOREACH_ROUTE|RE_DEST_FOREACH_ROUTE_SAFE|
+                       RNODE_FOREACH_RE|RNODE_FOREACH_RE_SAFE|
+                       UPDGRP_FOREACH_SUBGRP|UPDGRP_FOREACH_SUBGRP_SAFE|
+                       SUBGRP_FOREACH_PEER|SUBGRP_FOREACH_PEER_SAFE|
+                       SUBGRP_FOREACH_ADJ|SUBGRP_FOREACH_ADJ_SAFE|
+                       AF_FOREACH|FOREACH_AFI_SAFI|FOREACH_SAFI|
+                       LSDB_LOOP
+                 }x;
 
 our $BasicType;
 our $NonptrType;
@@ -4028,7 +4047,8 @@ sub process {
                                if|for|while|switch|return|case|
                                volatile|__volatile__|
                                __attribute__|format|__extension__|
-                               asm|__asm__)$/x)
+                               asm|__asm__|
+                               $Iterators)$/x)
                        {
                        # cpp #define statements have non-optional spaces, ie
                        # if there is a space between the name and the open