Closed Bug 502298 Opened 15 years ago Closed 15 years ago

NS_LITERAL_STRING should use u"" when available

Categories

(Core :: XPCOM, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

Attachments

(2 files)

Attached patch patchSplinter Review
Right now NS_LITERAL_STRING's only option for compiler support for wide strings is with L"". However, C++0x has u"", u'', and char16_t, which are UTF-16 strings. (It also has U"", U'', and char32_t for UTF-32.) This is probably a better option for us, once it's available, since it doesn't require us to use -fshort-wchar. So I'm attaching a patch that makes us use char16_t in preference to wchar_t when char16_t is available. If char16_t is available, we still do the configure test for whether wchar_t is 2-byte by default, but we don't try -fshort-wchar if it's not. I tested this using gcc 4.4 with -std=gnu++0x in CXXFLAGS, and it produces a working Firefox that uses u"" strings for NS_LITERAL_STRING. (I also needed some fixes for one new compiler error that that flag enables.) For more information on char16_t, see: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm and for gcc support see: http://gcc.gnu.org/gcc-4.4/cxx0x_status.html
Attachment #386781 - Flags: review?(benjamin)
(In reply to comment #0) > (I also needed > some fixes for one new compiler error that that flag enables.) ... which are now in bug 502301.
Comment on attachment 386781 [details] [diff] [review] patch >diff --git a/js/src/configure.in b/js/src/configure.in We don't need any of these wide-string configure checks in the JS configure... please either leave it alone or remove them entirely.
Attachment #386781 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/aa85b2f55960 (removed the checks from the JS configure.in)
Status: NEW → RESOLVED
Closed: 15 years ago
Priority: -- → P4
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Attachment #428005 - Flags: review?(bugspam.Callek) → review+
Attachment #428005 - Attachment description: (Bv1-CC) Copy it to comm-central → (Bv1-CC) Copy it to comm-central [Checkin: Comment 5]
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: