linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] take sched_debug.c out of nasal demon territory
@ 2007-08-06  3:26 Al Viro
  2007-08-06 15:51 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2007-08-06  3:26 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: mingo, linux-kernel

	C99 6.10.3[11]: preprocessing directive within the argument list
of macro invocation => undefined behaviour.  Don't do that...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 1c61e53..8421b93 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -36,24 +36,24 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p, u64 now)
 	else
 		SEQ_printf(m, " ");
 
-	SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d "
-		      "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
+	SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d ",
 		p->comm, p->pid,
 		(long long)p->se.fair_key,
 		(long long)(p->se.fair_key - rq->cfs.fair_clock),
 		(long long)p->se.wait_runtime,
 		(long long)(p->nvcsw + p->nivcsw),
-		p->prio,
+		p->prio);
 #ifdef CONFIG_SCHEDSTATS
+	SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
 		(long long)p->se.sum_exec_runtime,
 		(long long)p->se.sum_wait_runtime,
 		(long long)p->se.sum_sleep_runtime,
 		(long long)p->se.wait_runtime_overruns,
-		(long long)p->se.wait_runtime_underruns
+		(long long)p->se.wait_runtime_underruns);
 #else
-		0LL, 0LL, 0LL, 0LL, 0LL
+	SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
+		0LL, 0LL, 0LL, 0LL, 0LL);
 #endif
-	);
 }
 
 static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] take sched_debug.c out of nasal demon territory
  2007-08-06  3:26 [PATCH] take sched_debug.c out of nasal demon territory Al Viro
@ 2007-08-06 15:51 ` Jan Engelhardt
  2007-08-06 17:05   ` Al Viro
  2007-08-08  9:17   ` WANG Cong
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Engelhardt @ 2007-08-06 15:51 UTC (permalink / raw)
  To: Al Viro; +Cc: Linus Torvalds, mingo, linux-kernel


On Aug 6 2007 04:26, Al Viro wrote:
>
>	C99 6.10.3[11]: preprocessing directive within the argument list
>of macro invocation => undefined behaviour.  Don't do that...

String concatenation ("a" "b") is not a preprocessing directive.

$ gcc -E test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
printf("a" "b");

(If it was, the "a" "b" would have already been joined.)


	Jan
-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] take sched_debug.c out of nasal demon territory
  2007-08-06 15:51 ` Jan Engelhardt
@ 2007-08-06 17:05   ` Al Viro
  2007-08-08  9:17   ` WANG Cong
  1 sibling, 0 replies; 4+ messages in thread
From: Al Viro @ 2007-08-06 17:05 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Linus Torvalds, mingo, linux-kernel

On Mon, Aug 06, 2007 at 05:51:29PM +0200, Jan Engelhardt wrote:
> 
> On Aug 6 2007 04:26, Al Viro wrote:
> >
> >	C99 6.10.3[11]: preprocessing directive within the argument list
> >of macro invocation => undefined behaviour.  Don't do that...
> 
> String concatenation ("a" "b") is not a preprocessing directive.

It is not, but #ifdef definitely is.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] take sched_debug.c out of nasal demon territory
  2007-08-06 15:51 ` Jan Engelhardt
  2007-08-06 17:05   ` Al Viro
@ 2007-08-08  9:17   ` WANG Cong
  1 sibling, 0 replies; 4+ messages in thread
From: WANG Cong @ 2007-08-08  9:17 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Al Viro, Linus Torvalds, mingo, linux-kernel

On Mon, Aug 06, 2007 at 05:51:29PM +0200, Jan Engelhardt wrote:
>
>On Aug 6 2007 04:26, Al Viro wrote:
>>
>>	C99 6.10.3[11]: preprocessing directive within the argument list
>>of macro invocation => undefined behaviour.  Don't do that...
>
>String concatenation ("a" "b") is not a preprocessing directive.
>
>$ gcc -E test.c
># 1 "test.c"
># 1 "<built-in>"
># 1 "<command line>"
># 1 "test.c"
>printf("a" "b");
>
>(If it was, the "a" "b" would have already been joined.)
>

Yes. According to C99 5.1.1.2, string concatenation is done in Phase 6,
that's after preprocessing.

Regards.

-- 
_   /|
\'o.O'
=(___)=
   U    ack!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-08  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06  3:26 [PATCH] take sched_debug.c out of nasal demon territory Al Viro
2007-08-06 15:51 ` Jan Engelhardt
2007-08-06 17:05   ` Al Viro
2007-08-08  9:17   ` WANG Cong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).