1414 * character literals. C++11's char16_t is a distinct builtin type. C11's
1515 * char16_t is a typedef for uint_least16_t. Technically, char16_t is a 16-bit
1616 * code unit of a Unicode code point, not a "character".
17+ *
18+ * For now, Char16.h only supports C++ because we don't want mix different C
19+ * and C++ definitions of char16_t in the same code base.
1720 */
1821
1922#ifdef _MSC_VER
3639 * typedef from wchar_t.
3740 */
3841# define MOZ_CHAR16_IS_NOT_WCHAR
39- #elif !defined(__cplusplus)
40- # if defined(WIN32)
41- # include < yvals.h>
42- typedef wchar_t char16_t ;
43- # else
44- /* *
45- * We can't use the stdint.h uint16_t type here because including
46- * stdint.h will break building some of our C libraries, such as
47- * sqlite.
48- */
49- typedef unsigned short char16_t ;
50- # endif
5142#else
5243# error "Char16.h requires C++11 (or something like it) for UTF-16 support."
5344#endif
5445
55- /* This is a temporary hack until bug 927728 is fixed. */
56- #define __PRUNICHAR__
57- typedef char16_t PRUnichar;
58-
5946/*
6047 * Macro arguments used in concatenation or stringification won't be expanded.
6148 * Therefore, in order for |MOZ_UTF16(FOO)| to work as expected (which is to
@@ -66,12 +53,9 @@ typedef char16_t PRUnichar;
6653 */
6754#define MOZ_UTF16 (s ) MOZ_UTF16_HELPER (s)
6855
69- #if defined(__cplusplus) && \
70- (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__))
7156static_assert (sizeof (char16_t ) == 2 , " Is char16_t type 16 bits?" );
7257static_assert (char16_t (-1 ) > char16_t (0 ), "Is char16_t type unsigned?");
7358static_assert (sizeof (MOZ_UTF16 (' A' )) == 2 , " Is char literal 16 bits?" );
7459static_assert (sizeof (MOZ_UTF16 (" " )[0 ]) == 2 , " Is string char 16 bits?" );
75- #endif
7660
7761#endif /* mozilla_Char16_h */
0 commit comments