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

This commit is contained in:
Jeff Walden 2013-04-13 19:04:38 -07:00
parent b865d1182c
commit d349e7c9e0
5 changed files with 0 additions and 203 deletions

View File

@ -3537,34 +3537,6 @@ if test "$GNU_CC"; then
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,

View File

@ -972,8 +972,6 @@ struct NormalizeNewlinesCharTraits {
OutputIterator mIterator;
};
#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
template <class CharT>
struct NormalizeNewlinesCharTraits<CharT*> {
public:
@ -989,40 +987,6 @@ struct NormalizeNewlinesCharTraits<CharT*> {
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
{

View File

@ -2911,34 +2911,6 @@ if test "$GNU_CC"; then
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,

View File

@ -550,8 +550,6 @@ struct nsCharSourceTraits
}
};
#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
template <class CharT>
struct nsCharSourceTraits<CharT*>
{
@ -587,82 +585,6 @@ struct nsCharSourceTraits<CharT*>
}
};
#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
{
@ -674,8 +596,6 @@ struct nsCharSinkTraits
}
};
#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION
template <class CharT>
struct nsCharSinkTraits<CharT*>
{
@ -688,32 +608,4 @@ struct nsCharSinkTraits<CharT*>
}
};
#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___)

View File

@ -24,9 +24,6 @@
/* 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
*/