Re: ppcfix.diff

From: Al Viro
Date: Mon Nov 29 2004 - 12:24:30 EST


On Mon, Nov 29, 2004 at 11:40:41PM +0800, hugang@xxxxxxxxxxxx wrote:
> if (!cpus_empty(keepmask)) {
> - cpumask_t irqdest = { .bits[0] = openpic_read(&ISR[irq]->Destination) };
> + cpumask_t irqdest;
> + irqdest.bits[0] = openpic_read(&ISR[irq]->Destination);

Not an equivalent replacement. The former means "set irqdest.bits[0] to
<expression> and set the rest of fields/array elements in them to zero/null".
The latter leaves everything except irqdest.bits[0] undefined.

Short version of the story: out of
a) cpumask_t irqdest = { .bits[0] = foo() };
b) cpumask_t irqdest = { .bits = {[0] = foo()} };
c) cpumask_t irqdest;
irqdest.bits[0] = foo();
we have
valid C89 OK for 2.95 OK for 3.x valid C99 initializes everything
(a) no no yes yes yes
(b) no yes yes yes yes
(c) yes yes yes yes no

IOW, 2.95 implements only a precursor to C99 initializer syntax and that's
why (a) gives an error. Proper fix is (b) - replace the line in question
with
cpumask_t irqdest = { .bits = {[0] = openpic_read(&ISR[irq]->Destination)} };
-
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/