# HG changeset patch # User Chris Peterson # Date 1532242954 25200 # Sun Jul 22 00:02:34 2018 -0700 # Node ID 14f33f70fa0c3bc615a19f0b104b63a7421e6fab # Parent 88bcc99cc084fafd8432870e4c88f75c74133390 Bug 1481097 - xpcom: Remove nsTString literal string workaround for gcc 4.9 bug. r=nika This gcc 4.9 workaround (from bug 1377351) is no longer needed because Firefox currently requires gcc 6.1 or later (as of bug 1444274). MozReview-Commit-ID: 9R14BDzWEoj diff --git a/xpcom/string/nsTString.h b/xpcom/string/nsTString.h --- a/xpcom/string/nsTString.h +++ b/xpcom/string/nsTString.h @@ -33,18 +33,16 @@ public: // bindgen w/ clang 3.9 at least chokes on a typedef, but using is okay. using typename nsTSubstring::substring_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 nsTSubstring::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; typedef typename substring_type::char_traits char_traits; typedef typename substring_type::incompatible_char_type incompatible_char_type; typedef typename substring_type::substring_tuple_type substring_tuple_type; @@ -118,25 +116,16 @@ public: explicit nsTString(substring_type&& aReadable) : substring_type(ClassFlags::NULL_TERMINATED) { this->Assign(std::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) { this->Assign(aChar); return *this; } self_type& operator=(const char_type* aData) { @@ -166,22 +155,16 @@ public: this->Assign(aStr); return *this; } self_type& operator=(substring_type&& aStr) { this->Assign(std::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); return *this; } /** * returns the null-terminated string @@ -582,17 +565,16 @@ public: typedef nsTString base_string_type; typedef typename base_string_type::string_type string_type; typedef typename base_string_type::char_type char_type; typedef typename base_string_type::char_traits char_traits; 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; typedef typename base_string_type::ClassFlags ClassFlags; public: /** @@ -652,24 +634,16 @@ public: explicit nsTAutoStringN(substring_type&& aStr) : self_type() { this->Assign(std::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() { this->Assign(aTuple); } // |operator=| does not inherit, so we must define our own self_type& operator=(char_type aChar) @@ -705,22 +679,16 @@ public: this->Assign(aStr); return *this; } self_type& operator=(substring_type&& aStr) { this->Assign(std::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); return *this; } static const size_t kStorageSize = N; diff --git a/xpcom/string/nsTStringRepr.h b/xpcom/string/nsTStringRepr.h --- a/xpcom/string/nsTStringRepr.h +++ b/xpcom/string/nsTStringRepr.h @@ -10,17 +10,16 @@ #include // std::enable_if #include "mozilla/Char16.h" #include "mozilla/fallible.h" #include "nsStringFlags.h" #include "nsCharTraits.h" template class nsTSubstringTuple; -template class nsTLiteralString; // The base for string comparators template class nsTStringComparator { public: typedef T char_type; nsTStringComparator() {} @@ -102,17 +101,16 @@ public: typedef nsCharTraits char_traits; typedef typename char_traits::incompatible_char_type incompatible_char_type; typedef nsTStringRepr self_type; typedef self_type base_string_type; typedef nsTSubstring substring_type; typedef nsTSubstringTuple substring_tuple_type; - typedef nsTLiteralString literalstring_type; typedef nsReadingIterator const_iterator; typedef nsWritingIterator iterator; typedef nsTStringComparator comparator_type; typedef char_type* char_iterator; typedef const char_type* const_char_iterator; diff --git a/xpcom/string/nsTSubstring.cpp b/xpcom/string/nsTSubstring.cpp --- a/xpcom/string/nsTSubstring.cpp +++ b/xpcom/string/nsTSubstring.cpp @@ -527,24 +527,16 @@ nsTSubstring::Assign(self_type&& aStr // We don't truncate the source string if the allocation failed. if (!Assign(aStr, aFallible)) { return false; } aStr.Truncate(); return true; } -// NOTE(nika): gcc 4.9 workaround. Remove when support is dropped. -template -void -nsTSubstring::Assign(const literalstring_type& aStr) -{ - Assign(aStr.AsString()); -} - template void nsTSubstring::Assign(const substring_tuple_type& aTuple) { if (!Assign(aTuple, mozilla::fallible)) { AllocFailed(aTuple.Length()); } } diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h --- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -41,17 +41,16 @@ class nsTSubstring : public mozilla::det { public: typedef nsTSubstring self_type; typedef nsTString string_type; typedef typename mozilla::detail::nsTStringRepr 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; typedef typename base_string_type::char_type char_type; typedef typename base_string_type::char_traits char_traits; typedef typename base_string_type::incompatible_char_type incompatible_char_type; typedef typename base_string_type::substring_tuple_type substring_tuple_type; @@ -167,23 +166,16 @@ public: size_type aLength, const fallible_t&); void NS_FASTCALL Assign(const self_type&); MOZ_MUST_USE bool NS_FASTCALL Assign(const self_type&, const fallible_t&); 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&); #if defined(MOZ_USE_CHAR16_WRAPPER) template > void Assign(char16ptr_t aData) { @@ -263,22 +255,16 @@ public: Assign(aStr); return *this; } self_type& operator=(self_type&& aStr) { Assign(std::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); return *this; } // Adopt a heap-allocated char sequence for this string; is Voided if aData // is null. Useful for e.g. converting an strdup'd C string into an