diff -r b703c6e2ac3f xpcom/base/nscore.h --- a/xpcom/base/nscore.h Wed Apr 07 01:58:59 2010 -0500 +++ b/xpcom/base/nscore.h Wed Apr 14 10:14:18 2010 +0200 @@ -396,6 +396,28 @@ #define HAVE_CPP_2BYTE_WCHAR_T #endif +#ifdef __GNUC__ +/* char16_t is only available in gcc 4.4+ with experimental c++0x support + * (-std=c++0x or -std=gnu++0x) */ +#if defined(HAVE_CPP_CHAR16_T) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__)) +#warning libxul SDK was configured with char16_t support, but now building without +#undef HAVE_CPP_CHAR16_T +#elif ! defined(HAVE_CPP_CHAR16_T) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && defined(__GXX_EXPERIMENTAL_CXX0X__) +#warning libxul SDK was configured without char16_t support, but now building with +#define HAVE_CPP_CHAR16_T +#endif + +/* When gcc is not given -fshort-wchar, wchar_t is not 2-bytes wide */ +#if defined(HAVE_CPP_2BYTE_WCHAR_T) && (__SIZEOF_WCHAR_T__ != 2) +#warning libxul SDK was configured with 2-byte wchar_t, but now building without +#undef HAVE_CPP_2BYTE_WCHAR_T +#elif ! defined(HAVE_CPP_2BYTE_WCHAR_T) && (__SIZEOF_WCHAR_T__ == 2) +#warning libxul SDK was configured without 2-byte wchar_t, but now building with +#define HAVE_CPP_2BYTE_WCHAR_T +#endif + +#endif + #ifndef __PRUNICHAR__ #define __PRUNICHAR__ /* For now, don't use wchar_t on Unix because it breaks the Netscape diff -r b703c6e2ac3f xpcom/glue/nsStringAPI.h --- a/xpcom/glue/nsStringAPI.h Wed Apr 07 01:58:59 2010 -0500 +++ b/xpcom/glue/nsStringAPI.h Wed Apr 14 10:14:18 2010 +0200 @@ -1063,6 +1063,7 @@ #define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const nsDependentString n(reinterpret_cast<const nsAString::char_type*>(s), PRUint32((sizeof(s)/2)-1)) typedef nsDependentString nsLiteralString; #else + #warning Using conversions for literal strings. Please consider using 2-bytes wchar_t or char16_t instead #define NS_LL(s) s #define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUTF16(s, PRUint32(sizeof(s)-1)) #define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(s, PRUint32(sizeof(s)-1)) diff -r b703c6e2ac3f xpcom/string/public/nsLiteralString.h --- a/xpcom/string/public/nsLiteralString.h Wed Apr 07 01:58:59 2010 -0500 +++ b/xpcom/string/public/nsLiteralString.h Wed Apr 14 10:14:18 2010 +0200 @@ -91,6 +91,7 @@ #define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const nsDependentString n(reinterpret_cast<const nsAString::char_type*>(s), PRUint32((sizeof(s)/2)-1)) typedef nsDependentString nsLiteralString; #else + #warning Using conversions for literal strings. Please consider using 2-bytes wchar_t or char16_t instead #define NS_LL(s) s #define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUTF16(s, PRUint32(sizeof(s)-1)) #define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(s, PRUint32(sizeof(s)-1))