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

From: Linus Torvalds
Date: Tue Apr 07 2009 - 10:55:18 EST




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
--
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/