[PATCH] Fix a warning when initializing symbol_flags
Alan Modra
amodra@gmail.com
Sat Sep 26 13:06:56 GMT 2020
On Fri, Sep 25, 2020 at 05:42:24PM -0700, Saagar Jha wrote:
> Clang on certain platforms (such as arm64) will warn if a struct is
> partially initialized:
>
> symbols.c:199:35: error: missing field 'written' initializer [-Werror,-Wmissing-field-initializers]
> 2895 symbol_entry_t needle = { { { 0 }, hash, name, 0, 0, 0 } };
>
> If we use empty braces we have the same effect but avoid the warning.
But on gcc-4.9 this results in:
symbols.c: In function ‘symbol_entry_find’:
symbols.c:199:3: error: missing initializer for field ‘local_symbol’ of ‘struct symbol_flags’ [-Werror=missing-field-initializers]
symbol_entry_t needle = { { { }, hash, name, 0, 0, 0 } };
^
symbols.c:39:16: note: ‘local_symbol’ declared here
unsigned int local_symbol : 1;
^
So I don't think we should apply your patch.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list