Re: Commit fcd8843c40 breaks old compilers
From: Trond Myklebust
Date: Sat Nov 18 2017 - 12:40:05 EST
On Sat, 2017-11-18 at 12:19 -0500, Boris Ostrovsky wrote:
> Commit fcd8843c406b46433857ae45e5e9d84b01a7d20b breaks on older
> compilers which cannot process initializers for anonymous structures:
>
> +const nfs4_stateid invalid_stateid = {
> + {
> + .seqid = cpu_to_be32(0xffffffffU),
> + .other = { 0 },
> + },
> + .type = NFS4_INVALID_STATEID_TYPE,
> +};
>
>
> /home/build/linux-linus/fs/nfs/nfs4state.c:74: error: unknown field
> âseqidâ specified in initializer
> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: missing
> braces
> around initializer
> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: (near
> initialization for âinvalid_stateid.<anonymous>.dataâ)
> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: overflow in
> implicit constant conversion
> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: unknown field
> âotherâ specified in initializer
> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: extra brace
> group
> at end of initializer
> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: (near
> initialization for âinvalid_stateid.<anonymous>â)
> /home/build/linux-linus/fs/nfs/nfs4state.c:75: warning: excess
> elements
> in union initializer
> /home/build/linux-linus/fs/nfs/nfs4state.c:75: warning: (near
> initialization for âinvalid_stateid.<anonymous>â)
> make[4]: *** [fs/nfs/nfs4state.o] Error 1
> make[3]: *** [fs/nfs] Error 2
>
>
> FC-64 <build@build-mk2:~> gcc --version
> gcc (GCC) 4.4.4 20100503 (Red Hat 4.4.4-2)
>
>
> A similar bug was fixed by e0714ec4f9efe7b86828b0dcc077fd8f5d8e5e91
> but
> I don't think the same approach can work here.
I don't have any setups with gcc 4.4.4. What is it expecting here? Is
it expecting an extra set of braces due to the anonymous "struct"?
--
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@xxxxxxxxxxxxxxx