[3/7] make do_each_task_pid()/while_each_task_pid() parenthesize their arguments

From: William Lee Irwin III
Date: Wed Sep 01 2004 - 12:39:59 EST


On Wed, Sep 01, 2004 at 10:28:39AM -0700, William Lee Irwin III wrote:
> do { ... } while () -like constructs require semicolons to follow them.
> This patch arranges for do_each_task_pid() { ... } while_each_task_pid()
> to do likewise.

Macros must parenthesize their arguments when they appear as
expressions not surrounded by other bracketing symbols. This patch
parenthesizes the task argument to do_each_task_pid() and
while_each_task_pid() where needed. This kind of iteration macro
doesn't need multiple evaluation fixes.


Index: kirill-2.6.9-rc1-mm2/include/linux/pid.h
===================================================================
--- kirill-2.6.9-rc1-mm2.orig/include/linux/pid.h 2004-09-01 09:01:13.653422464 -0700
+++ kirill-2.6.9-rc1-mm2/include/linux/pid.h 2004-09-01 09:07:48.266432168 -0700
@@ -43,14 +43,14 @@
#define do_each_task_pid(who, type, task) \
do { \
if ((task = find_task_by_pid_type(type, who))) { \
- prefetch(task->pids[type].pid_list.next); \
+ prefetch((task)->pids[type].pid_list.next); \
do {

#define while_each_task_pid(who, type, task) \
- task = pid_task(task->pids[type].pid_list.next, \
+ task = pid_task((task)->pids[type].pid_list.next,\
type); \
- prefetch(task->pids[type].pid_list.next); \
- } while (task->pids[type].hash_list.next); \
+ prefetch((task)->pids[type].pid_list.next); \
+ } while ((task)->pids[type].hash_list.next); \
} \
} while (0)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/