Re: [PATCH] intel-iommu: fix build with CONFIG_BRANCH_TRACER=y

Linus Torvalds
2009-04-07T14:55:17Z

On Tue, 7 Apr 2009, Ingo Molnar wrote:
>
> Switch it to a braced group statement.

No, the way to do that is to just clean it up (or in the worst case just
add another set of parenthesis, not a statement expression).

That said, whoever made "if()" a macro should be shot. That
PROFILE_ALL_BRANCHES thing is crazy, crazy.

Anyway, in this case, I think

> #define for_each_active_iommu(i, drhd) \
> list_for_each_entry(drhd, &dmar_drhd_units, list) \
> - if (i=drhd->iommu, drhd->ignored) {} else
> + if (({i=drhd->iommu, drhd->ignored;})) {} else

Just do it like

if ( (i=drhd->iommu, drhd->ignored) ) {} else

is still not pretty, but better than using ({..}) I think. And just a
single set of parenthesis will protect the macro expansion.

But that '#define if(cond)' for the branch profiling is really the core
problem there. Wow. I never realized quite _how_ ugly tricks it played.

Linus