On 01/06/2013 04:11 PM, Tom G. Christensen wrote:
depbase=`echo c-strtod.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC
-DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -I../intl -I/usr/tgcw
are/include -D_REENTRANT -g -O2 -MT c-strtod.o -MD -MP -MF $depbase.Tpo
-c -o c-strtod.o c-strtod.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ./locale.h:26,
from c-strtod.c:25:
/usr/tgcware/gcc-4.3.6/lib/gcc/sparc-sun-solaris2.6/4.3.6/include-fixed/locale.h:63:
error: redefinition of 'struct rpl_lconv'
/usr/tgcware/gcc-4.3.6/lib/gcc/sparc-sun-solaris2.6/4.3.6/include-fixed/locale.h:105:
error: conflicting types for 'rpl_localeconv'
./locale.h:449: error: previous declaration of 'rpl_localeconv' was here
I've looked more at this issue and I now know how it happens.
We get this chain of includes on Solaris 2.6 and 7:
c-strtod.c -> gnulib <locale.h> -> system <locale.h> -> gettext
<libintl.h> -> gnulib <locale.h> -> returns to gettext <libintl.h> ->
returns to system <locale.h> which now defines struct lconv and causes
the error.
For Solaris 2.6 additionally the localeconv() prototype is incompatible
with the gnulib replacement so it complains about that aswell.
From what I can tell this only happens because I have installed gettext
and <libintl.h> is the gettext version that unconditionally includes
<locale.h>.
If I take away the #include in <libintl.h> the problem goes away.
On Solaris 8 and later, struct lconv and localeconv() are defined in a
sub header <iso/locale_iso.h> with its own guard and this is included
from system <locale.h> before <libintl.h>. It does ofcourse return to
system <locale.h> after having parsed gnulib <locale.h> and <libintl.h>
but it only contains some C++ visibility stuff and two macros
(_LastCategory and _ValidCategory) that gnulib does not seem to care about.
-tgc