INSTALL-unix | 15 -------- Makefile.am | 2 - NEWS | 5 ++ configure.ac | 23 +----------- doc/FAQ | 4 +- include/cppunit/config/config-bcb5.h | 10 ----- include/cppunit/config/config-evc4.h | 10 ----- include/cppunit/config/config-mac.h | 10 ----- include/cppunit/config/config-msvc6.h | 14 ------- include/cppunit/extensions/HelperMacros.h | 15 +------- include/cppunit/extensions/TestNamer.h | 20 +--------- include/cppunit/extensions/TypeInfoHelper.h | 6 --- include/cppunit/portability/SmartPtr.h | 4 -- m4/ax_cxx_rtti.m4 | 52 ---------------------------- src/cppunit/TestNamer.cpp | 11 ----- src/cppunit/TypeInfoHelper.cpp | 6 --- 16 files changed, 15 insertions(+), 192 deletions(-)
New commits: commit e8c0def96e6ca4370377747bda1d8a8c0dab4867 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:46:30 2016 +0200 update NEWS diff --git a/NEWS b/NEWS index 65dd5d8..1ea436a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ New in CppUnit 1.14.0: --------------------- +* Portability: + - Always build with C++11 + + - Always require RTTI support + * Test Plug-in Runner: - Fixed crash on Win64 in test runner (fdo#81433) commit fcc84eec40acf8506f2a5fcc3fe0399663d1ce18 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:46:16 2016 +0200 cppunit.m4 is gone diff --git a/Makefile.am b/Makefile.am index e39432c..d78f862 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,7 @@ docinternal = \ doc/makedox.bat m4dir = $(datadir)/aclocal -m4_DATA = cppunit.m4 +m4_DATA = m4internal = \ m4/ac_cxx_have_strstream.m4 \ commit 442300567b57ff6a02b180e36407b93e2177a3fc Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:45:56 2016 +0200 always use std::unique_ptr diff --git a/include/cppunit/portability/SmartPtr.h b/include/cppunit/portability/SmartPtr.h index 5fa9c9d..76e2183 100644 --- a/include/cppunit/portability/SmartPtr.h +++ b/include/cppunit/portability/SmartPtr.h @@ -1,10 +1,6 @@ #ifndef CPPUNIT_PORTABILITY_CPPUNITSMARTPTR_H #define CPPUNIT_PORTABILITY_CPPUNITSMARTPTR_H -#if HAVE_CXX11 #define CppUnitSmartPtr std::unique_ptr -#else -#define CppUnitSmartPtr std::auto_ptr -#endif #endif // CPPUNIT_PORTABILITY_CPPUNITDEQUE_H commit c314941600c5bd601831e6204b04b06a223064e7 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:09:59 2016 +0200 replace with std::unique_ptr diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index e883960..3dfab2d 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -165,24 +165,15 @@ */ #define CPPUNIT_TEST_SUITE_END() \ } \ - \ - struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \ - CPPUNIT_NS::TestSuite *suite; \ - CppUnitExDeleter() : suite (nullptr) {} \ - ~CppUnitExDeleter() { delete suite; } \ - CPPUNIT_NS::TestSuite *release() { \ - CPPUNIT_NS::TestSuite *tmp = suite; suite = nullptr; return tmp; \ - } \ - }; \ \ public: \ static CPPUNIT_NS::TestSuite *suite() \ { \ const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \ - CppUnitExDeleter guard; \ - guard.suite = new CPPUNIT_NS::TestSuite( namer.getFixtureName() ); \ + std::unique_ptr<CPPUNIT_NS::TestSuite> guard( \ + new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \ - CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.suite, \ + CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.get(), \ namer, \ factory ); \ TestFixtureType::addTestsToSuite( context ); \ commit 29ae31614fb70e192f63fdab1c65105493319edc Author: GARCIN David <david.gar...@openwide.fr> Date: Sat Oct 15 17:01:25 2016 +0200 HelperMacros: fix deprecated NULL macro usage Using gcc (currently using gcc 5.2) flag -Wzero-as-null-pointer-constant triggers warnings: [...]include/cppunit/extensions/HelperMacros.h:171:31: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant] CppUnitExDeleter() : suite (0) {} \ ^ [...]include/cppunit/extensions/HelperMacros.h:174:45: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant] CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \ ^ Using nullptr is the c++11 way to initialize pointers with null value [1]. [1] http://en.cppreference.com/w/cpp/language/nullptr diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index 43fc08e..e883960 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -168,10 +168,10 @@ \ struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \ CPPUNIT_NS::TestSuite *suite; \ - CppUnitExDeleter() : suite (0) {} \ + CppUnitExDeleter() : suite (nullptr) {} \ ~CppUnitExDeleter() { delete suite; } \ CPPUNIT_NS::TestSuite *release() { \ - CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \ + CPPUNIT_NS::TestSuite *tmp = suite; suite = nullptr; return tmp; \ } \ }; \ \ commit 42bd37a4b8d8feab2d30761648b51eaf20623abb Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:28:02 2016 +0200 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. 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} ============================================================================== ]) diff --git a/doc/FAQ b/doc/FAQ index e43cdba..f647c54 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -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 <l...@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 commit 2917f424d32dc9f7128ecf4d47cdcc48fb0781d2 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sat Oct 15 17:26:43 2016 +0200 we always require c++11 now diff --git a/configure.ac b/configure.ac index ffd5fad..af0adef 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ AS_IF([test x"$enable_typeinfo_name" = "xno" -o x"$HAVE_RTTI" != "x1"], [ ]) 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) # ================================= # Libtool/Version Makefile settings @@ -97,10 +98,6 @@ AC_ARG_ENABLE(optional_features, [enable_optional=yes] ) -AS_IF([test "x$enable_optional" != "xno"], [ - AX_CXX_COMPILE_STDCXX_11(noext, mandatory) -]) - AM_CONDITIONAL([WITH_OPTIONAL_FEATURES], [test "x$enable_optional" != "xno"]) # ===== _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits