зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1377351 - Part 5: Add a workaround for gcc 4.9 compiler bug, r=froydnj
MozReview-Commit-ID: CHywpZ4fvXf
This commit is contained in:
Родитель
c234875cd6
Коммит
2e20b0d128
|
@ -26,7 +26,16 @@ class nsTLiteralString : public mozilla::detail::nsTStringRepr<T>
|
|||
public:
|
||||
|
||||
typedef nsTLiteralString<T> self_type;
|
||||
|
||||
#ifdef __clang__
|
||||
// bindgen w/ clang 3.9 at least chokes on a typedef, but using is okay.
|
||||
using typename mozilla::detail::nsTStringRepr<T>::base_string_type;
|
||||
#else
|
||||
// On the other hand msvc chokes on the using statement. It seems others
|
||||
// don't care either way so we lump them in here.
|
||||
typedef typename mozilla::detail::nsTStringRepr<T>::base_string_type base_string_type;
|
||||
#endif
|
||||
|
||||
typedef typename base_string_type::char_type char_type;
|
||||
typedef typename base_string_type::size_type size_type;
|
||||
typedef typename base_string_type::DataFlags DataFlags;
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
typedef typename nsTSubstring<T>::substring_type substring_type;
|
||||
#endif
|
||||
|
||||
typedef typename substring_type::literalstring_type literalstring_type;
|
||||
|
||||
typedef typename substring_type::fallible_t fallible_t;
|
||||
|
||||
typedef typename substring_type::char_type char_type;
|
||||
|
@ -124,6 +126,14 @@ public:
|
|||
this->Assign(mozilla::Move(aReadable));
|
||||
}
|
||||
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
explicit
|
||||
nsTString(const literalstring_type& aReadable)
|
||||
: substring_type(ClassFlags::NULL_TERMINATED)
|
||||
{
|
||||
this->Assign(aReadable);
|
||||
}
|
||||
|
||||
|
||||
// |operator=| does not inherit, so we must define our own
|
||||
self_type& operator=(char_type aChar)
|
||||
|
@ -164,6 +174,12 @@ public:
|
|||
this->Assign(mozilla::Move(aStr));
|
||||
return *this;
|
||||
}
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
self_type& operator=(const literalstring_type& aStr)
|
||||
{
|
||||
this->Assign(aStr);
|
||||
return *this;
|
||||
}
|
||||
self_type& operator=(const substring_tuple_type& aTuple)
|
||||
{
|
||||
this->Assign(aTuple);
|
||||
|
@ -574,6 +590,7 @@ public:
|
|||
typedef typename base_string_type::substring_type substring_type;
|
||||
typedef typename base_string_type::size_type size_type;
|
||||
typedef typename base_string_type::substring_tuple_type substring_tuple_type;
|
||||
typedef typename base_string_type::literalstring_type literalstring_type;
|
||||
|
||||
// These are only for internal use within the string classes:
|
||||
typedef typename base_string_type::DataFlags DataFlags;
|
||||
|
@ -646,6 +663,14 @@ public:
|
|||
this->Assign(mozilla::Move(aStr));
|
||||
}
|
||||
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
explicit
|
||||
nsTAutoStringN(const literalstring_type& aStr)
|
||||
: self_type()
|
||||
{
|
||||
this->Assign(aStr);
|
||||
}
|
||||
|
||||
MOZ_IMPLICIT nsTAutoStringN(const substring_tuple_type& aTuple)
|
||||
: self_type()
|
||||
{
|
||||
|
@ -691,6 +716,12 @@ public:
|
|||
this->Assign(mozilla::Move(aStr));
|
||||
return *this;
|
||||
}
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
self_type& operator=(const literalstring_type& aStr)
|
||||
{
|
||||
this->Assign(aStr);
|
||||
return *this;
|
||||
}
|
||||
self_type& operator=(const substring_tuple_type& aTuple)
|
||||
{
|
||||
this->Assign(aTuple);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsCharTraits.h"
|
||||
|
||||
template <typename T> class nsTSubstringTuple;
|
||||
template <typename T> class nsTLiteralString;
|
||||
|
||||
// The base for string comparators
|
||||
template <typename T> class nsTStringComparator
|
||||
|
@ -74,6 +75,7 @@ public:
|
|||
|
||||
typedef nsTSubstring<T> substring_type;
|
||||
typedef nsTSubstringTuple<T> substring_tuple_type;
|
||||
typedef nsTLiteralString<T> literalstring_type;
|
||||
|
||||
typedef nsReadingIterator<char_type> const_iterator;
|
||||
typedef nsWritingIterator<char_type> iterator;
|
||||
|
|
|
@ -530,6 +530,14 @@ nsTSubstring<T>::Assign(self_type&& aStr, const fallible_t& aFallible)
|
|||
return true;
|
||||
}
|
||||
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
template <typename T>
|
||||
void
|
||||
nsTSubstring<T>::Assign(const literalstring_type& aStr)
|
||||
{
|
||||
Assign(aStr.AsString());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
nsTSubstring<T>::Assign(const substring_tuple_type& aTuple)
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
|
||||
typedef typename mozilla::detail::nsTStringRepr<T> base_string_type;
|
||||
typedef typename base_string_type::substring_type substring_type;
|
||||
typedef typename base_string_type::literalstring_type literalstring_type;
|
||||
|
||||
typedef typename base_string_type::fallible_t fallible_t;
|
||||
|
||||
|
@ -174,6 +175,13 @@ public:
|
|||
void NS_FASTCALL Assign(self_type&&);
|
||||
MOZ_MUST_USE bool NS_FASTCALL Assign(self_type&&, const fallible_t&);
|
||||
|
||||
// XXX(nika): GCC 4.9 doesn't correctly resolve calls to Assign a
|
||||
// nsLiteralCString into a nsTSubstring, due to a frontend bug. This explcit
|
||||
// Assign overload (and the corresponding constructor and operator= overloads)
|
||||
// are used to avoid this bug. Once we stop supporting GCC 4.9 we can remove
|
||||
// them.
|
||||
void NS_FASTCALL Assign(const literalstring_type&);
|
||||
|
||||
void NS_FASTCALL Assign(const substring_tuple_type&);
|
||||
MOZ_MUST_USE bool NS_FASTCALL Assign(const substring_tuple_type&,
|
||||
const fallible_t&);
|
||||
|
@ -263,6 +271,12 @@ public:
|
|||
Assign(mozilla::Move(aStr));
|
||||
return *this;
|
||||
}
|
||||
// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped.
|
||||
self_type& operator=(const literalstring_type& aStr)
|
||||
{
|
||||
Assign(aStr);
|
||||
return *this;
|
||||
}
|
||||
self_type& operator=(const substring_tuple_type& aTuple)
|
||||
{
|
||||
Assign(aTuple);
|
||||
|
|
Загрузка…
Ссылка в новой задаче