diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-04-22 10:33:56 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-04-22 10:33:56 +0000 |
| commit | b530a2591b3d3f2d4c6f380468d710c677fe37be (patch) | |
| tree | 0eaa67e5421c2ad5f95e9d7b87adaa566f7a744b /libcxx/test/support | |
| parent | 8e366822c2a889ad3a73522449dd0636f23360b7 (diff) | |
| download | bcm5719-llvm-b530a2591b3d3f2d4c6f380468d710c677fe37be.tar.gz bcm5719-llvm-b530a2591b3d3f2d4c6f380468d710c677fe37be.zip | |
Fix some non-standard parts of our test suite. Reported by STL
llvm-svn: 267131
Diffstat (limited to 'libcxx/test/support')
| -rw-r--r-- | libcxx/test/support/asan_testing.h | 6 | ||||
| -rw-r--r-- | libcxx/test/support/constexpr_char_traits.hpp | 42 | ||||
| -rw-r--r-- | libcxx/test/support/platform_support.h | 10 | ||||
| -rw-r--r-- | libcxx/test/support/test_macros.h | 6 |
4 files changed, 34 insertions, 30 deletions
diff --git a/libcxx/test/support/asan_testing.h b/libcxx/test/support/asan_testing.h index 45ad04b1bb2..b1209de2313 100644 --- a/libcxx/test/support/asan_testing.h +++ b/libcxx/test/support/asan_testing.h @@ -10,9 +10,9 @@ #ifndef ASAN_TESTING_H #define ASAN_TESTING_H -#include <__config> +#include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_ASAN +#if TEST_HAS_FEATURE(address_sanitizer) extern "C" int __sanitizer_verify_contiguous_container ( const void *beg, const void *mid, const void *end ); @@ -27,7 +27,7 @@ bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c ) #else template <typename T, typename Alloc> -bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c ) +bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &) { return true; } diff --git a/libcxx/test/support/constexpr_char_traits.hpp b/libcxx/test/support/constexpr_char_traits.hpp index b069c90076a..0a73d3ad1ea 100644 --- a/libcxx/test/support/constexpr_char_traits.hpp +++ b/libcxx/test/support/constexpr_char_traits.hpp @@ -11,9 +11,9 @@ #ifndef _CONSTEXPR_CHAR_TRAITS #define _CONSTEXPR_CHAR_TRAITS -#include <__config> #include <string> +#include "test_macros.h" template <class _CharT> struct constexpr_char_traits @@ -24,41 +24,41 @@ struct constexpr_char_traits typedef std::streampos pos_type; typedef std::mbstate_t state_type; - static _LIBCPP_CONSTEXPR_AFTER_CXX11 void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT + static TEST_CONSTEXPR_CXX14 void assign(char_type& __c1, const char_type& __c2) TEST_NOEXCEPT {__c1 = __c2;} - static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static TEST_CONSTEXPR bool eq(char_type __c1, char_type __c2) TEST_NOEXCEPT {return __c1 == __c2;} - static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static TEST_CONSTEXPR bool lt(char_type __c1, char_type __c2) TEST_NOEXCEPT {return __c1 < __c2;} - static _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(const char_type* __s1, const char_type* __s2, size_t __n); - static _LIBCPP_CONSTEXPR_AFTER_CXX11 size_t length(const char_type* __s); - static _LIBCPP_CONSTEXPR_AFTER_CXX11 const char_type* find(const char_type* __s, size_t __n, const char_type& __a); - static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* move(char_type* __s1, const char_type* __s2, size_t __n); - static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); - static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* assign(char_type* __s, size_t __n, char_type __a); + static TEST_CONSTEXPR_CXX14 int compare(const char_type* __s1, const char_type* __s2, size_t __n); + static TEST_CONSTEXPR_CXX14 size_t length(const char_type* __s); + static TEST_CONSTEXPR_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a); + static TEST_CONSTEXPR_CXX14 char_type* move(char_type* __s1, const char_type* __s2, size_t __n); + static TEST_CONSTEXPR_CXX14 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); + static TEST_CONSTEXPR_CXX14 char_type* assign(char_type* __s, size_t __n, char_type __a); - static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT + static TEST_CONSTEXPR int_type not_eof(int_type __c) TEST_NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT + static TEST_CONSTEXPR char_type to_char_type(int_type __c) TEST_NOEXCEPT {return char_type(__c);} - static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT + static TEST_CONSTEXPR int_type to_int_type(char_type __c) TEST_NOEXCEPT {return int_type(__c);} - static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static TEST_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) TEST_NOEXCEPT {return __c1 == __c2;} - static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT + static TEST_CONSTEXPR int_type eof() TEST_NOEXCEPT {return int_type(EOF);} }; template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 int +TEST_CONSTEXPR_CXX14 int constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (; __n; --__n, ++__s1, ++__s2) @@ -72,7 +72,7 @@ constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* _ } template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 size_t +TEST_CONSTEXPR_CXX14 size_t constexpr_char_traits<_CharT>::length(const char_type* __s) { size_t __len = 0; @@ -82,7 +82,7 @@ constexpr_char_traits<_CharT>::length(const char_type* __s) } template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT* +TEST_CONSTEXPR_CXX14 const _CharT* constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) { for (; __n; --__n) @@ -95,7 +95,7 @@ constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char } template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +TEST_CONSTEXPR_CXX14 _CharT* constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) { char_type* __r = __s1; @@ -115,7 +115,7 @@ constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size } template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +TEST_CONSTEXPR_CXX14 _CharT* constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) { _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); @@ -126,7 +126,7 @@ constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size } template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +TEST_CONSTEXPR_CXX14 _CharT* constexpr_char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) { char_type* __r = __s; diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 233e721ff51..1aec3cdae6d 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/test/support/platform_support.h @@ -15,8 +15,6 @@ #ifndef PLATFORM_SUPPORT_H #define PLATFORM_SUPPORT_H -#include <__config> - // locale names #ifdef _WIN32 // WARNING: Windows does not support UTF-8 codepages. @@ -54,7 +52,7 @@ #include <stdio.h> #include <stdlib.h> #include <string> -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if defined(_WIN32) || defined(__MINGW32__) #include <io.h> // _mktemp #else #include <unistd.h> // close @@ -67,12 +65,12 @@ extern "C" { } #endif -#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +#ifndef __CloudABI__ inline std::string get_temp_file_name() { -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if defined(_WIN32) || defined(__MINGW32__) char Path[MAX_PATH+1]; char FN[MAX_PATH+1]; do { } while (0 == GetTempPath(MAX_PATH+1, Path)); @@ -93,6 +91,6 @@ get_temp_file_name() return Name; #endif } -#endif // _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +#endif // __CloundABI__ #endif // PLATFORM_SUPPORT_H diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index c34e8cf7ef1..09d878b143c 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -70,8 +70,14 @@ #if TEST_STD_VER >= 11 #define TEST_CONSTEXPR constexpr #define TEST_NOEXCEPT noexcept +# if TEST_STD_VER >= 14 +# define TEST_CONSTEXPR_CXX14 constexpr +# else +# define TEST_CONSTEXPR_CXX14 +# endif #else #define TEST_CONSTEXPR +#define TEST_CONSTEXPR_CXX14 #define TEST_NOEXCEPT #endif |

