]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Fix build errors due to CONFIG_BRANCH_TRACER=y
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2009 14:59:41 +0000 (07:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2009 16:05:35 +0000 (09:05 -0700)
The code that enables branch tracing for all (non-constant) branches
plays games with the preprocessor and #define's the C 'if ()' construct
to do tracing.

That's all fine, but it fails for some unusual but valid C code that is
sometimes used in macros, notably by the intel-iommu code:

if (i=drhd->iommu, drhd->ignored) ..

because now the preprocessor complains about multiple arguments to the
'if' macro.

So make the macro expansion of this particularly horrid trick use
varargs, and handle the case of comma-expressions in if-statements.  Use
another macro to do it cleanly in just one place.

This replaces a patch by David (and acked by Steven) that did this all
inside that one already-too-horrid macro.

Tested-by: Ingo Molnar <mingo@elte.hu>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/compiler.h

index 6faa7e549de4c28c120a924bfb8015f26abb37ff..cebfdcd3dbddc3e7715b637f58452332586cdfa3 100644 (file)
@@ -114,7 +114,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
  * "Define 'is'", Bill Clinton
  * "Define 'if'", Steven Rostedt
  */
-#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) :         \
+#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
+#define __trace_if(cond) \
+       if (__builtin_constant_p((cond)) ? !!(cond) :                   \
        ({                                                              \
                int ______r;                                            \
                static struct ftrace_branch_data                        \