clang-format: bring back ForeachMacros (#3948)

* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
This commit is contained in:
xzfc
2020-02-19 10:31:09 +00:00
committed by GitHub
parent e3f120c0b6
commit 1f0c628cde
37 changed files with 363 additions and 329 deletions

View File

@ -28,15 +28,15 @@
#define NODES_FOREACH(head) \
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
TAILQ_FOREACH(child, &((head)->nodes_head), nodes)
TAILQ_FOREACH (child, &((head)->nodes_head), nodes)
#define NODES_FOREACH_REVERSE(head) \
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
TAILQ_FOREACH_REVERSE(child, &((head)->nodes_head), nodes_head, nodes)
TAILQ_FOREACH_REVERSE (child, &((head)->nodes_head), nodes_head, nodes)
/* greps the ->nodes of the given head and returns the first node that matches the given condition */
#define GREP_FIRST(dest, head, condition) \
NODES_FOREACH(head) { \
NODES_FOREACH (head) { \
if (!(condition)) \
continue; \
\