Designated initializers for fields in anonymous structs and unions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GCC 4.6 and newer support initializing designated initializers for fields in
anonymous structs and unions.  However, sparse does not.  Test case:

union U {
    int a;
    struct {
        int b;
        int c;
    };
};

static union U u = {
    .b = 0,
    .c = 0,
};

struct S {
    int a;
    union {
        int b;
        int c;
    };
};

static struct S s = {
    .a = 0,
    .b = 0,
};



GCC handles this just fine; sparse says:

test.c:10:6: error: unknown field name in initializer
test.c:11:6: error: unknown field name in initializer
test.c:24:6: error: unknown field name in initializer

Sparse needs to handle this, and we should add the above as a test case.

(We also need an appropriate extension to the test for
__attribute__((designated_init)).)

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux