GNOME Bugzilla – Bug 739466
HTMLparser.c: missing field initializer
Last modified: 2017-06-17 11:00:53 UTC
Building libxml2-2.9.2 on OS X 10.8 via fink, I get a warning that did not appear in 2.9.1: /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I./include -I./include -I/sw/include -I/sw/include -D_REENTRANT -I/sw/include -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -MT HTMLparser.lo -MD -MP -MF .deps/HTMLparser.Tpo -c -o HTMLparser.lo HTMLparser.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./include -I./include -I/sw/include -I/sw/include -D_REENTRANT -I/sw/include -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wno-long-long -MT HTMLparser.lo -MD -MP -MF .deps/HTMLparser.Tpo -c HTMLparser.c -fno-common -DPIC -o .libs/HTMLparser.o HTMLparser.c:4369:41: warning: missing field 'begin_pos' initializer [-Wmissing-field-initializers] htmlParserNodeInfo node_info = { 0, }; ^ According to parser.h, htmlParserNodeInfo is a 5-field struct, but here in the htmlParseElementInternal function, only the first field is initialized. Presumably the codeblock knows not to use the other fields before setting them (Bug #731990 only flagged the first field as susceptible to being used before being set), but clang apparently wants you to set them all anyway if you're going to set any of them.
*** Bug 739720 has been marked as a duplicate of this bug. ***
Fixed with: https://git.gnome.org/browse/libxml2/commit/?id=9a366a3748389fb62a49c3e9d24458274fb426f3