Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


This includes a cleanup of the specialized configuration header
files, as supported features are detected during the configuration
stage and do not need to be hard coded into the headers for different
platforms.

Signed-off-by: Bernhard Sessler <bernhard.sessler@corscience.de>
---
 cmake/PlatformChecks.cmake            |  6 ++++
 cmake/have_default_template_args.cpp  | 35 +++++++++++++++++++
 include/config-auto.h.in              |  3 ++
 include/cppunit/Portability.h         | 22 ++++++------
 include/cppunit/config/config-bcb5.h  | 47 -------------------------
 include/cppunit/config/config-evc4.h  | 57 -------------------------------
 include/cppunit/config/config-msvc6.h | 64 -----------------------------------
 7 files changed, 54 insertions(+), 180 deletions(-)
 create mode 100644 cmake/have_default_template_args.cpp
 delete mode 100644 include/cppunit/config/config-bcb5.h

diff --git a/cmake/PlatformChecks.cmake b/cmake/PlatformChecks.cmake
index 657bf3b..e6ff590 100644
--- a/cmake/PlatformChecks.cmake
+++ b/cmake/PlatformChecks.cmake
@@ -123,6 +123,12 @@ check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/have_casts.cpp
                               CPPUNIT_HAVE_CPP_CAST)
 check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/string_compare_signature.cpp
                               CPPUNIT_FUNC_STRING_COMPARE_SIZE_FIRST)
+check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/have_default_template_args.cpp
+                              CPPUNIT_HAVE_DEFAULT_TEMPLATE_ARGS)
+
+if(NOT CPPUNIT_HAVE_DEFAULT_TEMPLATE_ARGS)
+    set(CPPUNIT_STD_NEED_ALLOCATOR 1 CACHE INTERNAL "Default template parameters not supported")
+endif()
 
 if(NOT CPPUNIT_FUNC_STRING_COMPARE_SIZE_FIRST)
     set(CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 1
diff --git a/cmake/have_default_template_args.cpp b/cmake/have_default_template_args.cpp
new file mode 100644
index 0000000..465c391
--- /dev/null
+++ b/cmake/have_default_template_args.cpp
@@ -0,0 +1,35 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+// Check whether the compiler supports default arguments for template parameters
+template<typename T=int>
+class Foo
+{
+public:
+    T bar(T param)
+    {
+        return param;
+    }
+};
+
+int main()
+{
+    Foo<> f;
+    return f.bar(0);
+}
diff --git a/include/config-auto.h.in b/include/config-auto.h.in
index 309e291..ad5b8d3 100644
--- a/include/config-auto.h.in
+++ b/include/config-auto.h.in
@@ -73,6 +73,9 @@
 /* define if the compiler supports C++ style casts */
 #cmakedefine CPPUNIT_HAVE_CPP_CAST 1
 
+/* define if the compiler does not support default arguments for template parameters */
+#cmakedefine CPPUNIT_STD_NEED_ALLOCATOR 1
+
 /* Define if you have the shl_load function. */
 #cmakedefine CPPUNIT_HAVE_SHL_LOAD 1
 
diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h
index a21f1a2..7d32c97 100644
--- a/include/cppunit/Portability.h
+++ b/include/cppunit/Portability.h
@@ -5,24 +5,23 @@
 # define WIN32 1
 #endif
 
+/* include automatically generated configuration */
+#include <cppunit/config-auto.h>
+
 /* include platform specific config */
-#if defined(__BORLANDC__)
-#  include <cppunit/config/config-bcb5.h>
-#elif defined (_MSC_VER)
+#if defined (_MSC_VER)
 #  if _MSC_VER == 1200 && defined(_WIN32_WCE) //evc4
 #    include <cppunit/config/config-evc4.h>
 #  else
 #    include <cppunit/config/config-msvc6.h>
 #  endif
-#else
-#    include <cppunit/config-auto.h>
 #endif
 
 // Version number of package
-#ifndef CPPUNIT_VERSION 
+#ifndef CPPUNIT_VERSION
 #define CPPUNIT_VERSION  "1.13.0"
 #endif
- 
+
 #include <cppunit/config/CppUnitApi.h>    // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL
 #include <cppunit/config/SelectDllLoader.h>
 
@@ -44,7 +43,7 @@
 # define CPPUNIT_ENABLE_CU_TEST_MACROS        0
 #endif
 
-/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) 
+/* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.)
    I don't think there is any C preprocess that does NOT support this! */
 #if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION)
 # define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION   1
@@ -74,14 +73,13 @@
 # endif // !defined(CPPUNIT_STD_ALLOCATOR)
 #endif // defined(CPPUNIT_STD_NEED_ALLOCATOR)
 
-
 // Compiler error location format for CompilerOutputter
 // If not define, assumes that it's gcc
 // See class CompilerOutputter for format.
 #if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT)
 #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) )
 // gcc/Xcode integration on Mac OS X
-# define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: " 
+# define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: "
 #else
 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
 #endif
@@ -122,7 +120,7 @@
 #endif  // defined(CPPUNIT_NO_NAMESPACE)
 
 /*! Stringize a symbol.
- * 
+ *
  * Use this macro to convert a preprocessor symbol to a string.
  *
  * Example of usage:
@@ -148,7 +146,7 @@
  * to obtain a 'unique' identifier.
  *
  * \internal From boost documentation:
- * The following piece of macro magic joins the two 
+ * The following piece of macro magic joins the two
  * arguments together, even when one of the arguments is
  * itself a macro (see 16.3.1 in C++ standard).  The key
  * is that macro expansion of macro arguments does not
diff --git a/include/cppunit/config/config-bcb5.h b/include/cppunit/config/config-bcb5.h
deleted file mode 100644
index d491452..0000000
--- a/include/cppunit/config/config-bcb5.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef _INCLUDE_CPPUNIT_CONFIG_BCB5_H
-#define _INCLUDE_CPPUNIT_CONFIG_BCB5_H 1
-
-#define HAVE_CMATH 1
- 
-/* include/cppunit/config-bcb5.h. Manually adapted from 
-   include/cppunit/config-auto.h */
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#define CPPUNIT_HAVE_NAMESPACES  1 
-#endif
-
-/* define if library uses std::string::compare(string,pos,n) */
-#ifndef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 
-#define CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST  0
-#endif
-
-/* Define if you have the <dlfcn.h> header file. */
-#ifdef CPPUNIT_HAVE_DLFCN_H 
-#undef CPPUNIT_HAVE_DLFCN_H 
-#endif
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#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 */
-#ifndef CPPUNIT_PACKAGE 
-#define CPPUNIT_PACKAGE  "cppunit" 
-#endif
- 
-/* _INCLUDE_CPPUNIT_CONFIG_BCB5_H */
-#endif
diff --git a/include/cppunit/config/config-evc4.h b/include/cppunit/config/config-evc4.h
index a791698..49c58d3 100644
--- a/include/cppunit/config/config-evc4.h
+++ b/include/cppunit/config/config-evc4.h
@@ -5,52 +5,9 @@
 #pragma warning( disable : 4786 )   // disable warning debug symbol > 255...
 #endif // _MSC_VER > 1000
 
-#define HAVE_CMATH 1
- 
-/* include/cppunit/config-msvc6.h. Manually adapted from 
-   include/cppunit/config-auto.h */
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#define CPPUNIT_HAVE_NAMESPACES  1 
-#endif
-
-/* define if library uses std::string::compare(string,pos,n) */
-#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 
-#undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST
-#endif
-
-/* Define if you have the <dlfcn.h> header file. */
-#ifdef CPPUNIT_HAVE_DLFCN_H 
-#undef CPPUNIT_HAVE_DLFCN_H 
-#endif
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#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
 
-#define CPPUNIT_HAVE_SSTREAM 0
-
-/* Name of package */
-#ifndef CPPUNIT_PACKAGE 
-#define CPPUNIT_PACKAGE  "cppunit" 
-#endif
-
-
 // Compiler error location format for CompilerOutputter
 // See class CompilerOutputter for format.
 #undef CPPUNIT_COMPILER_LOCATION_FORMAT
@@ -60,19 +17,5 @@
 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p(%l):"
 #endif
 
-/* define to 1 if the compiler has _finite() */
-#ifndef CPPUNIT_HAVE__FINITE
-#define CPPUNIT_HAVE__FINITE 1 
-#endif
-
-// Uncomment to turn on STL wrapping => use this to test compilation. 
-// This will make CppUnit subclass std::vector & co to provide default
-// parameter.
-/*#define CPPUNIT_STD_NEED_ALLOCATOR 1
-#define CPPUNIT_STD_ALLOCATOR std::allocator<T>
-//#define CPPUNIT_NO_NAMESPACE 1
-*/
-
-
 /* _INCLUDE_CPPUNIT_CONFIG_EVC4_H */
 #endif
diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h
index 54bce82..7e35a05 100644
--- a/include/cppunit/config/config-msvc6.h
+++ b/include/cppunit/config/config-msvc6.h
@@ -5,53 +5,6 @@
 #pragma warning( disable : 4786 )   // disable warning debug symbol > 255...
 #endif // _MSC_VER > 1000
 
-#define HAVE_CMATH 1
- 
-/* include/cppunit/config-msvc6.h. Manually adapted from 
-   include/cppunit/config-auto.h */
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#define CPPUNIT_HAVE_NAMESPACES  1 
-#endif
-
-/* define if library uses std::string::compare(string,pos,n) */
-#ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 
-#undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST
-#endif
-
-/* Define if you have the <dlfcn.h> header file. */
-#ifdef CPPUNIT_HAVE_DLFCN_H 
-#undef CPPUNIT_HAVE_DLFCN_H 
-#endif
-
-/* define to 1 if the compiler implements namespaces */
-#ifndef CPPUNIT_HAVE_NAMESPACES 
-#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 */
-#ifndef CPPUNIT_PACKAGE 
-#define CPPUNIT_PACKAGE  "cppunit" 
-#endif
-
-
 // Compiler error location format for CompilerOutputter
 // See class CompilerOutputter for format.
 #undef CPPUNIT_COMPILER_LOCATION_FORMAT
@@ -61,23 +14,6 @@
 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p(%l):"
 #endif
 
-// Define to 1 if the compiler support C++ style cast.
-#define CPPUNIT_HAVE_CPP_CAST 1
-
-/* define to 1 if the compiler has _finite() */
-#ifndef CPPUNIT_HAVE__FINITE
-#define CPPUNIT_HAVE__FINITE 1 
-#endif
-
-
-// Uncomment to turn on STL wrapping => use this to test compilation. 
-// This will make CppUnit subclass std::vector & co to provide default
-// parameter.
-/*#define CPPUNIT_STD_NEED_ALLOCATOR 1
-#define CPPUNIT_STD_ALLOCATOR std::allocator<T>
-//#define CPPUNIT_NO_NAMESPACE 1
-*/
-
 #if _MSC_VER >= 1300    // VS 7.0
 #define CPPUNIT_UNIQUE_COUNTER __COUNTER__
 #endif // if _MSC_VER >= 1300    // VS 7.0
-- 
1.8.3.2


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.