NS_LITERAL_STRING should use u"" when available

RESOLVED FIXED in mozilla1.9.2a1

Status

()

Core
String
P4
normal
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

Trunk
mozilla1.9.2a1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

9 years ago
Created attachment 386781 [details] [diff] [review]
patch

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)
(Assignee)

Comment 1

9 years ago
(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 2

9 years ago
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+
(Assignee)

Comment 3

9 years ago
http://hg.mozilla.org/mozilla-central/rev/aa85b2f55960

(removed the checks from the JS configure.in)
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Priority: -- → P4
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Created attachment 428005 [details] [diff] [review]
(Bv1-CC) Copy it to comm-central
[Checkin: Comment 5]
Attachment #428005 - Flags: review?(bugspam.Callek)

Updated

8 years ago
Attachment #428005 - Flags: review?(bugspam.Callek) → review+
Comment on attachment 428005 [details] [diff] [review]
(Bv1-CC) Copy it to comm-central
[Checkin: Comment 5]


http://hg.mozilla.org/comm-central/rev/5bfd87c74187
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.