summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Sessler <bernhard.sessler@corscience.de>2013-12-04 14:54:42 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-17 12:37:04 +0000
commitddae6859ecddeb60ebc80f649215d123ecdae33e (patch)
tree2905c49c9413bcd3546dce60b071d7c6e1cef6f9
parent0c417c4a933ec390da1f315079abbfacd2be3806 (diff)
downloadcppunit-ddae6859ecddeb60ebc80f649215d123ecdae33e.tar.gz
include: Let the build system handle detecting the features
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. Change-Id: I40e26aa1846838d20badda82c40bfd002340ba80 Signed-off-by: Bernhard Sessler <bernhard.sessler@corscience.de> Reviewed-on: https://gerrit.libreoffice.org/7113 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--cmake/PlatformChecks.cmake6
-rw-r--r--cmake/have_default_template_args.cpp16
-rw-r--r--include/config-auto.h.in3
-rw-r--r--include/cppunit/Portability.h22
-rw-r--r--include/cppunit/config/config-bcb5.h47
-rw-r--r--include/cppunit/config/config-evc4.h57
-rw-r--r--include/cppunit/config/config-msvc6.h64
7 files changed, 35 insertions, 180 deletions
diff --git a/cmake/PlatformChecks.cmake b/cmake/PlatformChecks.cmake
index 65ab570..5d20bfe 100644
--- a/cmake/PlatformChecks.cmake
+++ b/cmake/PlatformChecks.cmake
@@ -104,6 +104,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..42773f7
--- /dev/null
+++ b/cmake/have_default_template_args.cpp
@@ -0,0 +1,16 @@
+// 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 1dc9d00..7d7c0ae 100644
--- a/include/config-auto.h.in
+++ b/include/config-auto.h.in
@@ -54,6 +54,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