GNOME Bugzilla – Bug 560730
pango 1.22.2 build failure on Solaris 10, too many array initializers in pango-language.c
Last modified: 2008-11-19 19:52:21 UTC
Please describe the problem: x86_64-sun-solaris2.10, Sun Studio 12 or Sun Studio Express July 2008 compiler chain. When building pango-1.22.2, the compile fails in pango-language.c: cc -xipo=2 -DHAVE_CONFIG_H -I. -I.. -DG_LOG_DOMAIN=\"Pango\" -DPANGO_ENABLE_BACKEND -DPANGO_ENABLE_ENGINE -DSYSCONFDIR=\"/etc/local/gnu\" -DLIBDIR=\"/local/gnu/lib/64\" -I.. -DG_DISABLE_CAST_CHECKS -D_REENTRANT -D_PTHREADS -I/local/gnu/include/glib-2.0 -I/local/gnu/lib/64/glib-2.0/include -DXTHREADS -I/local/include -I/usr/openwin/include -I/local/include/freetype2 -I/local/include/cairo -I/local/include/freetype2 -I/local/include -I/local/include -I/usr/openwin/include -I/local/gnu/include -I/local/gnu/include -I/local/include -Xa -xO4 -xstrconst -KPIC -mt -xtarget=native -m64 -xarch=native -I/local/gnu/include -I/local/gnu/include -I/local/include -c pango-language.c -KPIC -DPIC -o .libs/pango-language.o "pango-language.c", line 485: warning: unnamed union member "pango-language.c", line 493: too many array initializers "pango-language-sample-table.h", line 52: improper member use: str52 "pango-language-sample-table.h", line 58: improper member use: str58 "pango-language-sample-table.h", line 64: improper member use: str64 "pango-language-sample-table.h", line 70: improper member use: str70 "pango-language-sample-table.h", line 76: improper member use: str76 "pango-language-sample-table.h", line 82: improper member use: str82 "pango-language-sample-table.h", line 88: improper member use: str88 "pango-language-sample-table.h", line 94: improper member use: str94 "pango-language-sample-table.h", line 100: improper member use: str100 "pango-language-sample-table.h", line 106: improper member use: str106 "pango-language-sample-table.h", line 112: improper member use: str112 "pango-language-sample-table.h", line 118: improper member use: str118 "pango-language-sample-table.h", line 124: improper member use: str124 "pango-language-sample-table.h", line 130: improper member use: str130 "pango-language-sample-table.h", line 136: improper member use: str136 "pango-language-sample-table.h", line 142: improper member use: str142 "pango-language-sample-table.h", line 148: improper member use: str148 "pango-language-sample-table.h", line 153: improper member use: str153 "pango-language-sample-table.h", line 159: improper member use: str159 "pango-language-sample-table.h", line 165: improper member use: str165 "pango-language-sample-table.h", line 171: improper member use: str171 "pango-language-sample-table.h", line 177: improper member use: str177 "pango-language-sample-table.h", line 183: improper member use: str183 "pango-language-sample-table.h", line 188: improper member use: str188 "pango-language-sample-table.h", line 194: improper member use: str194 "pango-language-sample-table.h", line 200: improper member use: str200 "pango-language-sample-table.h", line 206: improper member use: str206 "pango-language-sample-table.h", line 212: improper member use: str212 "pango-language-sample-table.h", line 218: improper member use: str218 "pango-language-sample-table.h", line 224: improper member use: str224 etc. Steps to reproduce: configure pango 1.22.2 on Solaris 10 with the Sun Studio compilers. Actual results: compile fails with the messages above (and more) Expected results: compile succeeds. Does this happen every time? Yes. Other information: The first two go away if I give the union a name, e.g: static const union _LangPool { struct { char str0[1]; #define LANGUAGE(id, source, sample) char POOLSTRFIELD(__LINE__)[sizeof(sample)]; #include "pango-language-sample-table.h" #undef LANGUAGE } str_union ; const char str[1]; } All of the remaining errors are coming (I think) from this: static const LangInfo lang_texts[] = { #define LANGUAGE(id, source, sample) {G_STRINGIFY(id), G_STRUCT_OFFSET(union _LangPool, POOLSTRFIELD(__LINE__))}, #include "pango-language-sample-table.h" #undef LANGUAGE /* One extra entry with no final comma, to make it C89-happy */ {"~~", 0} }; I think the code that's generated by G_STRUCT_OFFSET is what the compiler is actually complaining about: static const LangInfo lang_texts[] = { # 1 "pango-language-sample-table.h" # 52 { "af" , ( ( glong ) ( ( guint8 * ) & ( ( union _LangPool * ) 0 ) -> str52 ) ) } , # 58 { "ar" , ( ( glong ) ( ( guint8 * ) & ( ( union _LangPool * ) 0 ) -> str58 ) ) } , # 64 { "arn" , ( ( glong ) ( ( guint8 * ) & ( ( union _LangPool * ) 0 ) -> str64 ) ) } , etc. Once the struct inside the _LangPool union is given a name, I don't think that the complication of G_STRUCT_OFFSET is even needed. Shouldn't it be possible to get to each str##[] structure member just using something like lang_pool.str_union.str52 ?
Thanks. 2008-11-19 Behdad Esfahbod <behdad@gnome.org> Bug 560730 – pango 1.22.2 build failure on Solaris 10, too many array initializers in pango-language.c * pango/pango-language.c: Don't use anonymous struct.