Ticket #6487 (new enhancement)

SVN Diffs for #6487

 

Opened 3 weeks ago

Last modified 2 weeks ago

Add support for UTF-16 string literals in gcc 4.4

Reported by: grhoten Assigned to: srl
Priority: minor Milestone: 4.1.1
Component: strings Version: 4.0
Keywords: Cc:
Load: Xref:
Java Version: Operating System:
Project (C/J): ICU4C Weeks:
Review:

Description

The development version of gcc 4.4 recently added support for UTF-16 literals.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20410

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33979

I recommend adding support for this new feature when it becomes available.

Probably only the configure script and platform.h.in will need to be changed. The U_CHECK_UTF16_STRING check in platform.h might need to also check for __CHAR16_TYPE__, __STDC_UTF_16__ or something like that.

http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02137.html

Once feature this is implemented in ICU, this will mean that all ICU reference platforms (plus a few others) can declare a UTF-16 string without invariant conversion.

Attachments

Change History

08/06/08 18:10:54 changed by grhoten

-std=gnu99 and -std=gnu++99 options might be required to enable this feature, which is incompatible with ICU's --enable-strict configure option. A more specific gcc option might be available in the future.

The platform.h probably needs something like the following:

#if @U_CHECK_UTF16_STRING@ || defined(U_CHECK_UTF16_STRING)
#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
    || (defined(__HP_aCC) && __HP_aCC >= 035000) \
    || (defined(__HP_cc) && __HP_cc >= 111106) \
    || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4) && !defined(__STRICT_ANSI__))
#define U_DECLARE_UTF16(string) u ## string
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
/* Sun's C compiler has issues with this notation, and it's unreliable. */
#define U_DECLARE_UTF16(string) U ## string
#endif
#if U_SIZEOF_WCHAR_T == 2 \
    && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
#define U_DECLARE_UTF16(string) L ## string
#endif

Then the configure script check for U_CHECK_UTF16_STRING would change to check the appropriate compiler options and define U_CHECK_UTF16_STRING accordingly. It will probably be similar to the check for Solaris.

08/13/08 11:14:34 changed by srl

  • owner changed from somebody to srl.
  • weeks changed.
  • xref changed.
  • revw changed.
  • milestone changed from UNSCH to 4.1.1.

Add/Change #6487 (Add support for UTF-16 string literals in gcc 4.4)




Anti spam check: