diff options
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Source/kwsys/Configure.hxx.in | 4 | ||||
-rw-r--r-- | Source/kwsys/hash_fun.hxx.in | 2 | ||||
-rw-r--r-- | Source/kwsys/hashtable.hxx.in | 1 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformCxxTests.cxx | 6 | ||||
-rw-r--r-- | Source/kwsys/kwsys_cstddef.hxx.in | 37 | ||||
-rwxr-xr-x | bootstrap | 11 |
7 files changed, 69 insertions, 0 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index f77d3a0..a1e12bb 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -178,6 +178,9 @@ ELSE(KWSYS_IOS_USE_SSTREAM) ENDIF(KWSYS_IOS_USE_STRSTREAM_H) ENDIF(KWSYS_IOS_USE_SSTREAM) +KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF + "Checking whether header cstddef is available" DIRECT) + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}) KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR @@ -294,6 +297,11 @@ FOREACH(header algorithm deque iterator list map numeric queue set stack string ENDIF(KWSYS_HEADER_INSTALL_DIR) ENDFOREACH(header) +# Provide cstddef header. +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_cstddef.hxx.in + ${KWSYS_HEADER_DIR}/cstddef + @ONLY IMMEDIATE) + #----------------------------------------------------------------------------- # Create streams header wrappers to give standard names by which they # may be included. diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 5b9268c..b599388 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -63,6 +63,9 @@ # define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios #endif +/* Whether the cstddef header is available. */ +#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@ + /* Whether the compiler supports null template arguments. */ #define @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@ @@ -133,6 +136,7 @@ # define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H # define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H # define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM +# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF # define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM # define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM # define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in index f40750e..59f445c 100644 --- a/Source/kwsys/hash_fun.hxx.in +++ b/Source/kwsys/hash_fun.hxx.in @@ -41,6 +41,8 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <@KWSYS_NAMESPACE@/cstddef> // size_t + namespace @KWSYS_NAMESPACE@ { diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index 061862a..af0ec5f 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -41,6 +41,7 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <@KWSYS_NAMESPACE@/cstddef> // size_t #include <@KWSYS_NAMESPACE@/stl/algorithm> // lower_bound #include <@KWSYS_NAMESPACE@/stl/functional> // unary_function #include <@KWSYS_NAMESPACE@/stl/iterator> // iterator_traits diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx index a8b3d6f..44c0432 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ b/Source/kwsys/kwsysPlatformCxxTests.cxx @@ -59,6 +59,12 @@ bool f(const kwsys_stl::string& s) { return s != ""; } int main() { return 0; } #endif +#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF +#include <cstddef> +void f(size_t) {} +int main() { return 0; } +#endif + #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS template <class T> class A; template <class T> int f(A<T>&); diff --git a/Source/kwsys/kwsys_cstddef.hxx.in b/Source/kwsys/kwsys_cstddef.hxx.in new file mode 100644 index 0000000..3c951ec --- /dev/null +++ b/Source/kwsys/kwsys_cstddef.hxx.in @@ -0,0 +1,37 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef @KWSYS_NAMESPACE@_cstddef +#define @KWSYS_NAMESPACE@_cstddef + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +/* Avoid warnings in MSVC standard headers. */ +#ifdef _MSC_VER +# pragma warning (push, 1) +# pragma warning (disable: 4702) +# pragma warning (disable: 4786) +#endif + +/* Include the real header. */ +#if @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF +# include <cstddef> +#else +# include <stddef.h> +#endif + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +#endif @@ -209,6 +209,7 @@ cmake_kwsys_config_replace_string () s/@KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@/${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}/g; s/@KWSYS_STL_HAS_ALLOCATOR_REBIND@/${KWSYS_STL_HAS_ALLOCATOR_REBIND}/g; s/@KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@/${KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT}/g; + s/@KWSYS_CXX_HAS_CSTDDEF@/${KWSYS_CXX_HAS_CSTDDEF}/g; s/@KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@/${KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS}/g; s/@KWSYS_CXX_HAS_MEMBER_TEMPLATES@/${KWSYS_CXX_HAS_MEMBER_TEMPLATES}/g; s/@KWSYS_CXX_HAS_FULL_SPECIALIZATION@/${KWSYS_CXX_HAS_FULL_SPECIALIZATION}/g; @@ -727,6 +728,7 @@ KWSYS_STL_HAS___ITERATOR_CATEGORY=0 KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=0 KWSYS_STL_HAS_ALLOCATOR_REBIND=0 KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0 +KWSYS_CXX_HAS_CSTDDEF=0 KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0 KWSYS_CXX_HAS_MEMBER_TEMPLATES=0 KWSYS_CXX_HAS_FULL_SPECIALIZATION=0 @@ -863,6 +865,15 @@ if [ "x${KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE}" = "x0" ]; then fi if cmake_try_run "${cmake_cxx_compiler}" \ + "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \ + "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then + KWSYS_CXX_HAS_CSTDDEF=1 + echo "${cmake_cxx_compiler} has header cstddef" +else + echo "${cmake_cxx_compiler} does not have header cstddef" +fi + +if cmake_try_run "${cmake_cxx_compiler}" \ "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \ "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then echo "${cmake_cxx_compiler} does not require template friends to use <>" |