Closed Bug 502298 Opened 11 years ago Closed 11 years ago

NS_LITERAL_STRING should use u"" when available


(Core :: String, defect, P4)






(Reporter: dbaron, Assigned: dbaron)




(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:
and for gcc support see:
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]

>diff --git a/js/src/ b/js/src/

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+

(removed the checks from the JS
Closed: 11 years ago
Priority: -- → P4
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Attachment #428005 - Flags: review?(bugspam.Callek) → review+
Comment on attachment 428005 [details] [diff] [review]
(Bv1-CC) Copy it to comm-central
[Checkin: Comment 5]
Attachment #428005 - Attachment description: (Bv1-CC) Copy it to comm-central → (Bv1-CC) Copy it to comm-central [Checkin: Comment 5]
You need to log in before you can comment on or make changes to this bug.