diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-15 17:28:02 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-15 17:28:02 +0200 |
commit | 42bd37a4b8d8feab2d30761648b51eaf20623abb (patch) | |
tree | 271d4b3838fbf9c7889b6eeb31c8956cccbacc6b | |
parent | 2917f424d32dc9f7128ecf4d47cdcc48fb0781d2 (diff) |
we always require RTTI now
RTTI is supported by any decent compiler and with the mandatory c++11 support
we are no longer supporting older compilers anyway.
-rw-r--r-- | INSTALL-unix | 15 | ||||
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | doc/FAQ | 4 | ||||
-rw-r--r-- | include/cppunit/config/config-bcb5.h | 10 | ||||
-rw-r--r-- | include/cppunit/config/config-evc4.h | 10 | ||||
-rw-r--r-- | include/cppunit/config/config-mac.h | 10 | ||||
-rw-r--r-- | include/cppunit/config/config-msvc6.h | 14 | ||||
-rw-r--r-- | include/cppunit/extensions/TestNamer.h | 20 | ||||
-rw-r--r-- | include/cppunit/extensions/TypeInfoHelper.h | 6 | ||||
-rw-r--r-- | m4/ax_cxx_rtti.m4 | 52 | ||||
-rw-r--r-- | src/cppunit/TestNamer.cpp | 11 | ||||
-rw-r--r-- | src/cppunit/TypeInfoHelper.cpp | 6 |
12 files changed, 5 insertions, 171 deletions
diff --git a/INSTALL-unix b/INSTALL-unix index 0e3d98e..6a4a5cc 100644 --- a/INSTALL-unix +++ b/INSTALL-unix @@ -1,21 +1,6 @@ See the file INSTALL for basic instructions. A short explanation for each non-standard configure option follows. - --disable-typeinfo-name - -Some output from the library will use a class name to distinguish -between tests. Normally, the Run-Time Type Information (RTTI) system -is used (specifically, the type_info::name() function) to generate the -name. Some compilers return human-readable names via this interface. -Other compilers do not. - -If your compiler does not generate a pleasing class name, specify -this option; the names will be generated by other means. The names -are used only for diagnostic purposes -- no functionality will be -lost nor gained by using this option. - - - System Notes ------------ diff --git a/configure.ac b/configure.ac index af0adef..9dd6aca 100644 --- a/configure.ac +++ b/configure.ac @@ -47,24 +47,8 @@ AC_CXX_HAVE_STRSTREAM BB_ENABLE_DOXYGEN # Compiler characteristics -AC_CXX_RTTI AX_CXX_GCC_ABI_DEMANGLE AC_CXX_STRING_COMPARE_STRING_FIRST - -AC_ARG_ENABLE([typeinfo-name], - [AS_HELP_STRING([--disable-typeinfo-name], [Disable use of RTTI for class names])], - [enable_typeinfo_name="$enableval"], - [enable_typeinfo_name=yes] -) -AS_IF([test x"$enable_typeinfo_name" = "xno" -o x"$HAVE_RTTI" != "x1"], [ - use_typeinfo="yes" - typeinfoval="CPPUNIT_HAVE_RTTI" -], [ - use_typeinfo="no" - typeinfoval="0" -]) -AC_DEFINE_UNQUOTED(USE_TYPEINFO_NAME, [$typeinfoval], - [Define to 1 to use type_info::name() for class names]) AX_CXX_COMPILE_STDCXX_11(noext, mandatory) # ================================= @@ -84,6 +68,7 @@ AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION, [cppunit_interface_age]) AC_SUBST(LT_AGE) + # ================ # Check for cflags # ================ @@ -181,7 +166,6 @@ Build configuration: debug: ${enable_debug} docs: ${enable_doc} werror: ${enable_werror} - typeinfo-name: ${use_typeinfo} optional-features: ${enable_optional} ============================================================================== ]) @@ -9,7 +9,7 @@ Frequently Asked Questions: Yes, there is. Macros have been created to take care of the repetitive work. Look up include/extensions/HelperMacros.h in CppUnit documentation. Most of CppUnit test suite is also written that way since they remain -compatible as CppUnit evolve. They also use RTTI if available. +compatible as CppUnit evolve. 2) Questions related to Microsoft Visual VC++ @@ -28,4 +28,4 @@ the correct library. I really don't have a clue. All CppUnit's headers starts by either including Portability.h or another CppUnit's header. Portability.h includes config-msvc6.h which disable that specific warning. The warning is generated -by TestFactoryRegistry::m_factories. A solution to this problem is welcome.
\ No newline at end of file +by TestFactoryRegistry::m_factories. A solution to this problem is welcome. diff --git a/include/cppunit/config/config-bcb5.h b/include/cppunit/config/config-bcb5.h index d491452..7bcde53 100644 --- a/include/cppunit/config/config-bcb5.h +++ b/include/cppunit/config/config-bcb5.h @@ -26,16 +26,6 @@ #define CPPUNIT_HAVE_NAMESPACES 1 #endif -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 -#endif - -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - #define CPPUNIT_HAVE_SSTREAM 1 /* Name of package */ diff --git a/include/cppunit/config/config-evc4.h b/include/cppunit/config/config-evc4.h index a791698..ae93ff3 100644 --- a/include/cppunit/config/config-evc4.h +++ b/include/cppunit/config/config-evc4.h @@ -30,16 +30,6 @@ #define CPPUNIT_HAVE_NAMESPACES 1 #endif -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 0 -#endif - -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - #define CPPUNIT_NO_STREAM 1 #define CPPUNIT_NO_ASSERT 1 diff --git a/include/cppunit/config/config-mac.h b/include/cppunit/config/config-mac.h index 4ace906..755429b 100644 --- a/include/cppunit/config/config-mac.h +++ b/include/cppunit/config/config-mac.h @@ -34,11 +34,6 @@ #define CPPUNIT_HAVE_NAMESPACES 1 #endif -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 -#endif - /* define if the compiler has stringstream */ #ifndef CPPUNIT_HAVE_SSTREAM #define CPPUNIT_HAVE_SSTREAM 1 @@ -49,10 +44,5 @@ #define CPPUNIT_HAVE_STRSTREAM 1 #endif -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - /* _INCLUDE_CPPUNIT_CONFIG_MAC_H */ #endif diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h index 54bce82..2607a46 100644 --- a/include/cppunit/config/config-msvc6.h +++ b/include/cppunit/config/config-msvc6.h @@ -30,20 +30,6 @@ #define CPPUNIT_HAVE_NAMESPACES 1 #endif -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -# ifdef _CPPRTTI // Defined by the compiler option /GR -# define CPPUNIT_HAVE_RTTI 1 -# else -# define CPPUNIT_HAVE_RTTI 0 -# endif -#endif - -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - #define CPPUNIT_HAVE_SSTREAM 1 /* Name of package */ diff --git a/include/cppunit/extensions/TestNamer.h b/include/cppunit/extensions/TestNamer.h index 5a6471c..3907569 100644 --- a/include/cppunit/extensions/TestNamer.h +++ b/include/cppunit/extensions/TestNamer.h @@ -4,19 +4,14 @@ #include <cppunit/Portability.h> #include <string> -#if CPPUNIT_HAVE_RTTI -# include <typeinfo> -#endif +#include <typeinfo> /*! \def CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) * \brief Declares a TestNamer. * - * Declares a TestNamer for the specified type, using RTTI if enabled, otherwise - * using macro string expansion. - * - * RTTI is used if CPPUNIT_USE_TYPEINFO_NAME is defined and not null. + * Declares a TestNamer for the specified type * * \code * void someMethod() @@ -29,19 +24,11 @@ * \relates TestNamer * \see TestNamer */ -#if CPPUNIT_USE_TYPEINFO_NAME # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) ) -#else -# define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) ) -#endif - - CPPUNIT_NS_BEGIN - /*! \brief Names a test or a fixture suite. * * TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL. @@ -50,12 +37,10 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API TestNamer { public: -#if CPPUNIT_HAVE_RTTI /*! \brief Constructs a namer using the fixture's type-info. * \param typeInfo Type-info of the fixture type. Use to name the fixture suite. */ TestNamer( const std::type_info &typeInfo ); -#endif /*! \brief Constructs a namer using the specified fixture name. * \param fixtureName Name of the fixture suite. Usually extracted using a macro. @@ -82,7 +67,6 @@ protected: std::string m_fixtureName; }; - CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H diff --git a/include/cppunit/extensions/TypeInfoHelper.h b/include/cppunit/extensions/TypeInfoHelper.h index c0ecdbc..1adec83 100644 --- a/include/cppunit/extensions/TypeInfoHelper.h +++ b/include/cppunit/extensions/TypeInfoHelper.h @@ -3,14 +3,11 @@ #include <cppunit/Portability.h> -#if CPPUNIT_HAVE_RTTI - #include <typeinfo> #include <string> CPPUNIT_NS_BEGIN - /**! \brief Helper to use type_info. */ class CPPUNIT_API TypeInfoHelper @@ -25,9 +22,6 @@ CPPUNIT_NS_BEGIN static std::string getClassName( const std::type_info &info ); }; - CPPUNIT_NS_END -#endif // CPPUNIT_HAVE_RTTI - #endif // CPPUNIT_TYPEINFOHELPER_H diff --git a/m4/ax_cxx_rtti.m4 b/m4/ax_cxx_rtti.m4 deleted file mode 100644 index 97cfe06..0000000 --- a/m4/ax_cxx_rtti.m4 +++ /dev/null @@ -1,52 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_cxx_rtti.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_RTTI -# -# DESCRIPTION -# -# If the compiler supports Run-Time Type Identification (typeinfo header -# and typeid keyword), define HAVE_RTTI. -# -# LICENSE -# -# Copyright (c) 2008 Todd Veldhuizen -# Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AU_ALIAS([AC_CXX_RTTI], [AX_CXX_RTTI]) -AC_DEFUN([AX_CXX_RTTI], -[AC_CACHE_CHECK(whether the compiler supports Run-Time Type Identification, -ax_cv_cxx_rtti, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include <typeinfo> -class Base { public : - Base () {} - virtual int f () { return 0; } - }; -class Derived : public Base { public : - Derived () {} - virtual int f () { return 1; } - }; -],[Derived d; -Base *ptr = &d; -return typeid (*ptr) == typeid (Derived); -], - ax_cv_cxx_rtti=yes, ax_cv_cxx_rtti=no) - AC_LANG_RESTORE -]) -if test "$ax_cv_cxx_rtti" = yes; then - AC_DEFINE(HAVE_RTTI,1, - [define if the compiler supports Run-Time Type Identification]) -fi -]) diff --git a/src/cppunit/TestNamer.cpp b/src/cppunit/TestNamer.cpp index 3bfe985..0cdf258 100644 --- a/src/cppunit/TestNamer.cpp +++ b/src/cppunit/TestNamer.cpp @@ -2,43 +2,32 @@ #include <cppunit/extensions/TypeInfoHelper.h> #include <string> - CPPUNIT_NS_BEGIN - -#if CPPUNIT_HAVE_RTTI TestNamer::TestNamer( const std::type_info &typeInfo ) : m_fixtureName( TypeInfoHelper::getClassName( typeInfo ) ) { } -#endif - TestNamer::TestNamer( const std::string &fixtureName ) : m_fixtureName( fixtureName ) { } - TestNamer::~TestNamer() { } - std::string TestNamer::getFixtureName() const { return m_fixtureName; } - std::string TestNamer::getTestNameFor( const std::string &testMethodName ) const { return getFixtureName() + "::" + testMethodName; } - - - CPPUNIT_NS_END diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index f2b9a67..aa24a80 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -1,8 +1,6 @@ #include <cppunit/Portability.h> #include <cppunit/extensions/TypeInfoHelper.h> -#if CPPUNIT_HAVE_RTTI - #include <string> #if CPPUNIT_HAVE_GCC_ABI_DEMANGLE @@ -13,7 +11,6 @@ CPPUNIT_NS_BEGIN - std::string TypeInfoHelper::getClassName( const std::type_info &info ) { @@ -59,7 +56,4 @@ TypeInfoHelper::getClassName( const std::type_info &info ) return name; } - CPPUNIT_NS_END - -#endif // CPPUNIT_HAVE_RTTI |