diff options
author | Brad King <brad.king@kitware.com> | 2015-09-02 14:23:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-09-02 14:23:17 (GMT) |
commit | c5cc3441b379e2bc6e70efd6dbd530edebbf0024 (patch) | |
tree | de0c2a39648c936039b7c86886cbe49c04b92923 /Source/kwsys/kwsysPlatformTestsCXX.cxx | |
parent | 72c11e590273d100c49f472afc3a7569b233ff00 (diff) | |
parent | 1b79433a6d7cdd1da1a0af74240f2299c78e4112 (diff) | |
download | CMake-c5cc3441b379e2bc6e70efd6dbd530edebbf0024.zip CMake-c5cc3441b379e2bc6e70efd6dbd530edebbf0024.tar.gz CMake-c5cc3441b379e2bc6e70efd6dbd530edebbf0024.tar.bz2 |
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/kwsysPlatformTestsCXX.cxx')
-rw-r--r-- | Source/kwsys/kwsysPlatformTestsCXX.cxx | 274 |
1 files changed, 12 insertions, 262 deletions
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 1596fe4..94579b3 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -9,110 +9,11 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -// Setup for tests that use result of stl namespace test. -#if defined(KWSYS_STL_HAVE_STD) -# if KWSYS_STL_HAVE_STD -# define kwsys_stl std -# else -# define kwsys_stl -# endif -#endif - -// Setup for tests that use iostreams. -#if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD) -# if defined(_MSC_VER) -# pragma warning (push,1) -# endif -# if KWSYS_IOS_USE_ANSI -# include <iostream> -# else -# include <iostream.h> -# endif -# if defined(_MSC_VER) -# pragma warning (pop) -# endif -# if KWSYS_IOS_HAVE_STD -# define kwsys_ios std -# else -# define kwsys_ios -# endif -#endif - -#ifdef TEST_KWSYS_STL_HAVE_STD -#include <list> -void f(std ::list<int>*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_ANSI -#include <iosfwd> -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_HAVE_STD -#include <iosfwd> -void f(std ::ostream*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_SSTREAM -#include <sstream> -#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96 -# error "GCC 2.96 stringstream is buggy" -#endif -int main() -{ - std ::ostringstream ostr; - ostr << "hello"; - if(ostr.str().size() == 5) - { - return 0; - } - return -1; -} -#endif - -#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H -#include <strstream.h> -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H -#include <strstrea.h> -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM -# include <iostream.h> -# include <string> -void f(ostream& os, const kwsys_stl::string& s) { os << s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM -# include <iostream.h> -# include <string> -void f(istream& is, kwsys_stl::string& s) { is >> s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -# include <string> -bool f(const kwsys_stl::string& s) { return s != ""; } -int main() { return 0; } -#endif - #ifdef TEST_KWSYS_CXX_HAS_CSTDIO #include <cstdio> 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_LONG_LONG long long f(long long n) { return n; } int main() @@ -131,150 +32,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS -template <class T> class A; -template <class T> int f(A<T>&); -template <class T> class A -{ -public: - // "friend int f<>(A<T>&)" would conform - friend int f(A<T>&); -private: - int x; -}; - -template <class T> int f(A<T>& a) { return a.x = 0; } -template int f(A<int>&); - -int main() -{ - A<int> a; - return f(a); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES -template <class U> -class A -{ -public: - U u; - A(): u(0) {} - template <class V> V m(V* p) { return *p = u; } -}; - -int main() -{ - A<short> a; - int s = 1; - return a.m(&s); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION -template <class T> struct A {}; -template <> struct A<int*> -{ - static int f() { return 0; } -}; -int main() { return A<int*>::f(); } -#endif - -#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP -namespace N -{ - class A {}; - int f(A*) { return 0; } -} -void f(void*); -int main() -{ - N::A* a = 0; - return f(a); -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS -#include <iterator> -#include <list> -void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -#include <iterator> -#include <list> -void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -#include <iterator> -#include <list> -void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -#include <memory> -template <class Alloc> -void f(const Alloc&) -{ - typedef typename Alloc::size_type alloc_size_type; -} -int main() -{ - f(kwsys_stl::allocator<char>()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -#include <memory> -void f(kwsys_stl::allocator::size_type const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -#include <memory> -template <class T, class Alloc> -void f(const T&, const Alloc&) -{ - typedef typename Alloc::template rebind<T>::other alloc_type; -} -int main() -{ - f(0, kwsys_stl::allocator<char>()); - return 0; -} -#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_STL_HAS_ALLOCATOR_OBJECTS -#include <vector> -void f(kwsys_stl::vector<int> const& v1) -{ - kwsys_stl::vector<int>(1, 1, v1.get_allocator()); -} -int main() -{ - f(kwsys_stl::vector<int>()); - return 0; -} -#endif - #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM #include <sys/types.h> #include <sys/stat.h> @@ -323,62 +80,55 @@ int main() } #endif -#ifdef TEST_KWSYS_IOS_HAVE_BINARY -int test_binary(int, ...) -{ - return 0; -} -int main() -{ - return test_binary(1, kwsys_ios::ios::binary); -} -#endif - #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG -int test_istream(kwsys_ios::istream& is, long long& x) +# include <iostream> +int test_istream(std::istream& is, long long& x) { return (is >> x)? 1:0; } int main() { long long x = 0; - return test_istream(kwsys_ios::cin, x); + return test_istream(std::cin, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG -int test_ostream(kwsys_ios::ostream& os, long long x) +# include <iostream> +int test_ostream(std::ostream& os, long long x) { return (os << x)? 1:0; } int main() { long long x = 0; - return test_ostream(kwsys_ios::cout, x); + return test_ostream(std::cout, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64 -int test_istream(kwsys_ios::istream& is, __int64& x) +# include <iostream> +int test_istream(std::istream& is, __int64& x) { return (is >> x)? 1:0; } int main() { __int64 x = 0; - return test_istream(kwsys_ios::cin, x); + return test_istream(std::cin, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64 -int test_ostream(kwsys_ios::ostream& os, __int64 x) +# include <iostream> +int test_ostream(std::ostream& os, __int64 x) { return (os << x)? 1:0; } int main() { __int64 x = 0; - return test_ostream(kwsys_ios::cout, x); + return test_ostream(std::cout, x); } #endif |