|
Boost : |
From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2004-01-22 14:10:02
Hello,
I investigated the problem with ICC and wchar_t. I'll recap the main points:
- ICC (Win32) defines a preprocessor symbol _WCHAR_T_DEFINED if it's called
with /Zc:wchar_t (that is: if wchar_t is a native type).
- Basic include files under Win32 have code like this:
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
which basically makes _WCHAR_T_DEFINED useless.
- http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864 means that we
cannot rely on wchar_t for ICC before 7.0, so we should always define
BOOST_NO_INTRINSIC_WCHAR_T for it.
- Our current code fails to understand that _WCHAR_T_DEFINED is useless as-is.
We basically have:
#ifndef _WCHAR_T_DEFINED
#define BOOST_NO_INTRINSIC_WCHAR_T
#endif
Net result is that our intel-win32 toolset is totally broken if we don't
specify /Zc:wchar_t. Many people (including myself) have stumbled upon this,
because they try to manually compile code relying on Boost with the default
settings.
The solution is easy: I had to check, but it turns out that _WCHAR_T_DEFINED
expands to "1" (ICC71) or "2" (ICC80) when defined by ICC itself (that is, when
wchar_t is a native type), while the standard libraries always define it with
no value (as shown above). The patch attacched to this mail relies on this
minor difference to understand whether wchar_t is a native type or just a
typedef. Notice that the code will indifferently work when included either
BEFORE or AFTER the standard headers, which is a major pro. I verified that
this lets me compile the uBLAS tests with or without /Zc:wchar_t, and with
different behaviours (that is, the code *does* detect when wchar_t is a native
type and when it is not).
The other hunk of the patch fixes a compatibility issue with STLport. In fact,
there are many versions of STLport which are pre-configured with
_STLP_WCHAR_T_IS_USHORT, even if the compiler was making it a builtin type. The
point is that we (Boost) must acknowledge if STLport was configured without
wchar_t support and disable our support as well. Otherwise, we will fail
because we wouldn't find specializations such as basic_string<wchar_t> and the
likes. Hartmut verified for me that this patch fixes the regression failures in
Spirit in the intel-stlport-win32 toolset.
Does this look OK to everyone else? I'd be willing to commit this to both the
branch and the trunk.
-- Giovanni Bajo begin 666 icc-patch.txt M26YD97_at_Z(&-O;7!I;&5R+VEN=&5L+FAP< H]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]"E)#4R!F:6QE.B O8W9S<F]O="]B;V]S="]B;V]S="]B;V]S="]C;VYF M:6<O8V]M<&EL97(O:6YT96PN:'!P+'8*<F5T<FEE=FEN9R!R979I<VEO;B Q M+C(Y"F1I9F8@+74@+7<@+6(@+7(Q+C(Y(&EN=&5L+FAP< HM+2T_at_8V]M<&EL M97(O:6YT96PN:'!P(#$U($1E8R R,# S(#$R.C,P.C,R("TP,# P(#$N,CD* M*RLK(&-O;7!I;&5R+VEN=&5L+FAP<" R,B!*86X@,C P-" P,3HT-#HS-" M M,# P, I 0" M-C4L.2 K-C4L,34_at_0$ *("-I9B!"3T]35%])3E1%3%]#6%A? M5D524TE/3B \(#<P, H@(R @9&5F:6YE($)/3U-47TY/7TE.5%))3E-)0U]7 M0TA!4E]4"B C96QS90HM+R\@7U=#2$%27U1?1$5&24Y%1"!I<R!T:&4_at_5VEN M,S(@<W!E;&QI;F<*+2\O(%]70TA!4E]4(&ES('1H92!,:6YU>"!S<&5L;&EN M9PHM(R @:68@(61E9FEN960H7U=#2$%27U1?1$5&24Y%1"D@)B8@(61E9FEN M960H7U=#2$%27U0I"BLO+R!792!S:&]U;&0@=&5S="!T:&4@;6%C<F\@7U=# M2$%27U1?1$5&24Y%1"!T;R!C:&5C:R!I9B!T:&4_at_8V]M<&EL97(**R\O('-U M<'!O<G1S('=C:&%R7W0@;F%T:79E;'DN($)55"!T:&5R92!I<R!A('!R;V)L M96T@:&5R93H@=&AE('-T86YD87)D"BLO+R!H96%D97)S(&1E9FEN92!T:&ES M(&UA8W)O(&EF('1H97D@='EP961E9B!W8VAA<E]T+B!!;GEW87DL('=E)W)E M(&QU8VMY"BLO+R!B96-A=7-E('1H97D_at_9&5F:6YE(&ET('=I=&AO=70_at_82!V M86QU92P@=VAI;&4_at_26YT96P@0RLK(&1E9FEN97,@:70**R\O('1O(#$N(%-O M('=E(&-A;B!C:&5C:R!I=',@=F%L=64@=&\@<V5E(&EF('1H92!M86-R;R!W M87,@9&5F:6YE9"!N871I=F5L>0HK+R\@;W(@;F]T+@HK+R\@56YD97(@54Y) M6"P@=&AE('-I='5A=&EO;B!I<R!E>&%C=&QY('1H92!S86UE+"!B=70@=&AE M(&UA8W)O(%]70TA!4E]4"BLO+R!I<R!U<V5D(&EN<W1E860N"BLC("!I9B H M*%]70TA!4E]47T1%1DE.140@*R P*2 ]/2 P*2D@)B8@*"A?5T-(05)?5" K M(# I(#T](# I"B C(" @(&1E9FEN92!"3T]35%].3U])3E1224Y324-?5T-( M05)?5 H@(R @96YD:68*("-E;F1I9_at_I);F1E>#H@<W1D;&EB+W-T;'!O<G0N M:'!P"CT]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T*4D-3(&9I;&4Z("]C=G-R;V]T M+V)O;W-T+V)O;W-T+V)O;W-T+V-O;F9I9R]S=&1L:6(O<W1L<&]R="YH<' L M=@IR971R:65V:6YG(')E=FES:6]N(#$N,C0*9&EF9B M=2 M=R M8B M<C$N M,C0@<W1L<&]R="YH<' *+2TM('-T9&QI8B]S=&QP;W)T+FAP<" Q,R!$96,@ M,C P,R Q,#HP-3HR,2 M,# P," Q+C(T"BLK*R!S=&1L:6(O<W1L<&]R="YH M<' @,C(@2F%N(#(P,#0@,#$Z-#0Z,S0@+3 P,# *0$ @+3$U,"PV("LQ-3 L M,38_at_0$ *("-E;F1I9_at_H*("\O"BLO+R!)9B!35$QP;W)T(&9O<B!S;VUE(')E M87-O;B!W87,@8V]N9FEG=7)E9"!S;R!T:&%T(&ET('1H:6YK<R!T:&%T('=C M:&%R7W0**R\O(&ES(&YO="!A;B!I;G1R:6YS:6,@='EP92P@=&AE;B!W92!H M879E('1O(&1I<V%B;&4@=&AE('-U<'!O<G0_at_9F]R(&ET(&%S"BLO+R!W96QL M("AW92!W;W5L9"!B92!M:7-S:6YG(')E<75I<F5D('-P96-I86QI>F%T:6]N M<R!O=&AE<G=I<V4I+@HK+R\**R-I9B A9&5F:6YE9"@@7U-43%!?2$%37U=# M2$%27U0I('Q\(&1E9FEN960H7U-43%!?5T-(05)?5%])4U]54TA/4E0I"BLC M("!U;F1E9B @0D]/4U1?3D]?24Y44DE.4TE#7U=#2$%27U0**R,@(&1E9FEN M92!"3T]35%].3U])3E1224Y324-?5T-(05)?5 HK(V5N9&EF"BL**R\O"B O M+R!";W)L86YD('-H:7!S(&$@=F5R<VEO;B!O9B!35$QP;W)T('=I=&@@0RLK M($)U:6QD97(@-B!T:&%T(&QA8VMS"B O+R!H87-H=&%B;&5S(&%N9"!T:&4@ *;&EK93H*("\O"@`` ` end
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk