Bug 866988 - Remove the HAVE_CPP_PARTIAL_SPECIALIZATION autoconf define, and the test for template specialization working at all. Any compiler not supporting either of these is so incredibly doomed it's not worth the pain of testing them. Plus we use both features liberally without testing these defines first, so they're basically pointless. r=ted
authorJeff Walden <jwalden@mit.edu>
Sat, 13 Apr 2013 19:04:38 -0700
changeset 141474 dfd22ba01d720bf7023291713a298320835dfd38
parent 141473 05275490b9c18457c4459057a117afd6d6c9226d
child 141475 06962a458da3cae4b17a8a7d2b7470e3d289a9c0
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs866988
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 866988 - Remove the HAVE_CPP_PARTIAL_SPECIALIZATION autoconf define, and the test for template specialization working at all. Any compiler not supporting either of these is so incredibly doomed it's not worth the pain of testing them. Plus we use both features liberally without testing these defines first, so they're basically pointless. r=ted
configure.in
content/base/src/nsContentUtils.cpp
js/src/configure.in
xpcom/string/public/nsCharTraits.h
xpcom/xpcom-config.h.in
--- a/configure.in
+++ b/configure.in
@@ -3532,44 +3532,16 @@ if test "$GNU_CC"; then
     else
         ARM_ABI_PREFIX=oabi-
     fi
   fi
 
   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
 fi
 
-dnl Check for support of modern template specialization syntax
-dnl Test code and requirement from scc@netscape.com.
-dnl Autoconf cut-and-paste job by waterson@netscape.com
-AC_CACHE_CHECK(for modern C++ template specialization syntax support,
-               ac_cv_cpp_modern_specialize_template_syntax,
-               [AC_TRY_COMPILE(template <class T> struct X { int a; };
-                               class Y {};
-                               template <> struct X<Y> { double a; };,
-                               X<int> int_x;
-                               X<Y> y_x;,
-                               ac_cv_cpp_modern_specialize_template_syntax=yes,
-                               ac_cv_cpp_modern_specialize_template_syntax=no)])
-if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
-  AC_MSG_ERROR([The C++ compiler does not support template specialization])
-fi
-
-dnl Some compilers support only full specialization, and some don't.
-AC_CACHE_CHECK(whether partial template specialization works,
-               ac_cv_cpp_partial_specialization,
-               [AC_TRY_COMPILE(template <class T> class Foo {};
-                               template <class T> class Foo<T*> {};,
-                               return 0;,
-                               ac_cv_cpp_partial_specialization=yes,
-                               ac_cv_cpp_partial_specialization=no)])
-if test "$ac_cv_cpp_partial_specialization" = yes ; then
-  AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
-fi
-
 dnl Check to see if we can resolve ambiguity with |using|.
 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
                ac_cv_cpp_ambiguity_resolving_using,
                [AC_TRY_COMPILE(class X {
                                  public: int go(const X&) {return 3;}
                                          int jo(const X&) {return 3;}
                                };
                                class Y : public X {
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -967,67 +967,31 @@ struct NormalizeNewlinesCharTraits {
     void writechar(typename OutputIterator::value_type aChar) {
       *mIterator++ = aChar;
     }
 
   private:
     OutputIterator mIterator;
 };
 
-#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
-
 template <class CharT>
 struct NormalizeNewlinesCharTraits<CharT*> {
   public:
     typedef CharT value_type;
 
   public:
     NormalizeNewlinesCharTraits(CharT* aCharPtr) : mCharPtr(aCharPtr) { }
     void writechar(CharT aChar) {
       *mCharPtr++ = aChar;
     }
 
   private:
     CharT* mCharPtr;
 };
 
-#else
-
-template <>
-struct NormalizeNewlinesCharTraits<char*> {
-  public:
-    typedef char value_type;
-
-  public:
-    NormalizeNewlinesCharTraits(char* aCharPtr) : mCharPtr(aCharPtr) { }
-    void writechar(char aChar) {
-      *mCharPtr++ = aChar;
-    }
-
-  private:
-    char* mCharPtr;
-};
-
-template <>
-struct NormalizeNewlinesCharTraits<PRUnichar*> {
-  public:
-    typedef PRUnichar value_type;
-
-  public:
-    NormalizeNewlinesCharTraits(PRUnichar* aCharPtr) : mCharPtr(aCharPtr) { }
-    void writechar(PRUnichar aChar) {
-      *mCharPtr++ = aChar;
-    }
-
-  private:
-    PRUnichar* mCharPtr;
-};
-
-#endif
-
 template <class OutputIterator>
 class CopyNormalizeNewlines
 {
   public:
     typedef typename OutputIterator::value_type value_type;
 
   public:
     CopyNormalizeNewlines(OutputIterator* aDestination,
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2906,44 +2906,16 @@ if test "$GNU_CC"; then
     else
         ARM_ABI_PREFIX=oabi-
     fi
   fi
 
   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
 fi
 
-dnl Check for support of modern template specialization syntax
-dnl Test code and requirement from scc@netscape.com.
-dnl Autoconf cut-and-paste job by waterson@netscape.com
-AC_CACHE_CHECK(for modern C++ template specialization syntax support,
-               ac_cv_cpp_modern_specialize_template_syntax,
-               [AC_TRY_COMPILE(template <class T> struct X { int a; };
-                               class Y {};
-                               template <> struct X<Y> { double a; };,
-                               X<int> int_x;
-                               X<Y> y_x;,
-                               ac_cv_cpp_modern_specialize_template_syntax=yes,
-                               ac_cv_cpp_modern_specialize_template_syntax=no)])
-if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
-  AC_MSG_ERROR([The C++ compiler does not support template specialization])
-fi
-
-dnl Some compilers support only full specialization, and some don't.
-AC_CACHE_CHECK(whether partial template specialization works,
-               ac_cv_cpp_partial_specialization,
-               [AC_TRY_COMPILE(template <class T> class Foo {};
-                               template <class T> class Foo<T*> {};,
-                               return 0;,
-                               ac_cv_cpp_partial_specialization=yes,
-                               ac_cv_cpp_partial_specialization=no)])
-if test "$ac_cv_cpp_partial_specialization" = yes ; then
-  AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
-fi
-
 dnl Check to see if we can resolve ambiguity with |using|.
 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
                ac_cv_cpp_ambiguity_resolving_using,
                [AC_TRY_COMPILE(class X {
                                  public: int go(const X&) {return 3;}
                                          int jo(const X&) {return 3;}
                                };
                                class Y : public X {
--- a/xpcom/string/public/nsCharTraits.h
+++ b/xpcom/string/public/nsCharTraits.h
@@ -545,18 +545,16 @@ struct nsCharSourceTraits
     static
     void
     advance( InputIterator& s, difference_type n )
       {
         s.advance(n);
       }
   };
 
-#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
-
 template <class CharT>
 struct nsCharSourceTraits<CharT*>
   {
     typedef ptrdiff_t difference_type;
 
     static
     uint32_t
     readable_distance( CharT* s )
@@ -582,138 +580,32 @@ struct nsCharSourceTraits<CharT*>
     static
     void
     advance( CharT*& s, difference_type n )
       {
         s += n;
       }
   };
 
-#else
-
-template <>
-struct nsCharSourceTraits<const char*>
-  {
-    typedef ptrdiff_t difference_type;
-
-    static
-    uint32_t
-    readable_distance( const char* s )
-      {
-        return uint32_t(nsCharTraits<char>::length(s));
-//      return numeric_limits<uint32_t>::max();
-      }
-
-    static
-    uint32_t
-    readable_distance( const char* first, const char* last )
-      {
-        return uint32_t(last-first);
-      }
-
-    static
-    const char*
-    read( const char* s )
-      {
-        return s;
-      }
-
-    static
-    void
-    advance( const char*& s, difference_type n )
-      {
-        s += n;
-      }
- };
-
-
-template <>
-struct nsCharSourceTraits<const PRUnichar*>
-  {
-    typedef ptrdiff_t difference_type;
-
-    static
-    uint32_t
-    readable_distance( const PRUnichar* s )
-      {
-        return uint32_t(nsCharTraits<PRUnichar>::length(s));
-//      return numeric_limits<uint32_t>::max();
-      }
-
-    static
-    uint32_t
-    readable_distance( const PRUnichar* first, const PRUnichar* last )
-      {
-        return uint32_t(last-first);
-      }
-
-    static
-    const PRUnichar*
-    read( const PRUnichar* s )
-      {
-        return s;
-      }
-
-    static
-    void
-    advance( const PRUnichar*& s, difference_type n )
-      {
-        s += n;
-      }
- };
-
-#endif
-
-
 template <class OutputIterator>
 struct nsCharSinkTraits
   {
     static
     void
     write( OutputIterator& iter, const typename OutputIterator::value_type* s, uint32_t n )
       {
         iter.write(s, n);
       }
   };
 
-#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
-
 template <class CharT>
 struct nsCharSinkTraits<CharT*>
   {
     static
     void
     write( CharT*& iter, const CharT* s, uint32_t n )
       {
         nsCharTraits<CharT>::move(iter, s, n);
         iter += n;
       }
   };
 
-#else
-
-template <>
-struct nsCharSinkTraits<char*>
-  {
-    static
-    void
-    write( char*& iter, const char* s, uint32_t n )
-      {
-        nsCharTraits<char>::move(iter, s, n);
-        iter += n;
-      }
-  };
-
-template <>
-struct nsCharSinkTraits<PRUnichar*>
-  {
-    static
-    void
-    write( PRUnichar*& iter, const PRUnichar* s, uint32_t n )
-      {
-        nsCharTraits<PRUnichar>::move(iter, s, n);
-        iter += n;
-      }
-  };
-
-#endif
-
 #endif // !defined(nsCharTraits_h___)
--- a/xpcom/xpcom-config.h.in
+++ b/xpcom/xpcom-config.h.in
@@ -19,19 +19,16 @@
 #undef HAVE_CPP_AMBIGUITY_RESOLVING_USING
 
 /* Define if the c++ compiler supports char16_t */
 #undef HAVE_CPP_CHAR16_T
 
 /* Define if a dyanmic_cast to void* gives the most derived object */
 #undef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 
-/* Define if the c++ compiler supports partial template specialization */
-#undef HAVE_CPP_PARTIAL_SPECIALIZATION
-
 /* Define if the c++ compiler has trouble comparing a constant
  * reference to a templatized class to zero
  */
 #undef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
 
 /* Define if the c++ compiler requires implementations of 
  * unused virtual methods
  */