COMP: Added KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT check for non-standard argument to stl allocator<>::max_size method. Needed for kwsys hashtable to compile on Sun CC.
This commit is contained in:
parent
551b28d501
commit
be1084b524
|
@ -184,6 +184,8 @@ KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR
|
|||
"Checking whether stl string has operator!= for char*" DIRECT)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_REBIND
|
||||
"Checking for rebind member of stl allocator" DIRECT)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
|
||||
"Checking for non-standard argument to stl allocator<>::max_size" DIRECT)
|
||||
IF(KWSYS_IOS_USE_ANSI)
|
||||
# ANSI streams always have string operators.
|
||||
SET(KWSYS_STL_STRING_HAVE_OSTREAM 1)
|
||||
|
|
|
@ -96,6 +96,9 @@
|
|||
/* Whether the stl allocator has rebind. */
|
||||
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
|
||||
|
||||
/* Whether the stl allocator has a size argument for max_size. */
|
||||
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
|
||||
|
||||
/* Whether struct stat has the st_mtim member for high resolution times. */
|
||||
#define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
|
||||
|
||||
|
@ -124,6 +127,7 @@
|
|||
# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
|
||||
# define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
|
||||
# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
|
||||
# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -119,11 +119,18 @@ public:
|
|||
alloc_.deallocate(static_cast<alloc_pointer>(static_cast<void*>(p)), n*chunk());
|
||||
}
|
||||
}
|
||||
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
|
||||
size_type max_size(size_type s) const throw()
|
||||
{
|
||||
return alloc_.max_size(s);
|
||||
}
|
||||
#else
|
||||
size_type max_size() const throw()
|
||||
{
|
||||
size_type n = alloc_.max_size() / chunk();
|
||||
return n>0? n:1;
|
||||
}
|
||||
#endif
|
||||
void construct(pointer p, const value_type& val) { new (p) value_type(val); }
|
||||
void destroy(pointer p) { (void)p; p->~value_type(); }
|
||||
private:
|
||||
|
|
|
@ -122,6 +122,19 @@ int main()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
|
||||
#include <memory>
|
||||
void f(kwsys_stl::allocator<char> const& a)
|
||||
{
|
||||
a.max_size(sizeof(int));
|
||||
};
|
||||
int main()
|
||||
{
|
||||
f(kwsys_stl::allocator<char>());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
11
bootstrap
11
bootstrap
|
@ -204,6 +204,7 @@ cmake_kwsys_config_replace_string ()
|
|||
s/@KWSYS_STL_STRING_HAVE_OSTREAM@/${KWSYS_STL_STRING_HAVE_OSTREAM}/g;
|
||||
s/@KWSYS_STL_STRING_HAVE_NEQ_CHAR@/${KWSYS_STL_STRING_HAVE_NEQ_CHAR}/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_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;
|
||||
|
@ -716,6 +717,7 @@ KWSYS_STL_HAVE_STD=0
|
|||
KWSYS_STAT_HAS_ST_MTIM=0
|
||||
KWSYS_STL_STRING_HAVE_NEQ_CHAR=0
|
||||
KWSYS_STL_HAS_ALLOCATOR_REBIND=0
|
||||
KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=0
|
||||
KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=0
|
||||
KWSYS_CXX_HAS_MEMBER_TEMPLATES=0
|
||||
KWSYS_CXX_HAS_FULL_SPECIALIZATION=0
|
||||
|
@ -800,6 +802,15 @@ else
|
|||
echo "${cmake_cxx_compiler} does not have allocator<>::rebind<>"
|
||||
fi
|
||||
|
||||
if cmake_try_run "${cmake_cxx_compiler}" \
|
||||
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
|
||||
"${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
|
||||
KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
|
||||
echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
|
||||
else
|
||||
echo "${cmake_cxx_compiler} does not have non-standard allocator<>::max_size argument"
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue