Fix some non-standard parts of our test suite. Reported by STL

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-04-22 10:33:56 +00:00
parent 59f2aea750
commit 5ccbc48774
22 changed files with 45 additions and 31 deletions

View File

@@ -12,6 +12,8 @@
// void resize(size_type n); // void resize(size_type n);
#include <deque> #include <deque>
#include <algorithm>
#include <iterator>
#include <cassert> #include <cassert>
#include "test_macros.h" #include "test_macros.h"

View File

@@ -12,6 +12,8 @@
// void resize(size_type n, const value_type& v); // void resize(size_type n, const value_type& v);
#include <deque> #include <deque>
#include <algorithm>
#include <iterator>
#include <cassert> #include <cassert>
#include "test_macros.h" #include "test_macros.h"

View File

@@ -12,6 +12,8 @@
// iterator erase(const_iterator p) // iterator erase(const_iterator p)
#include <deque> #include <deque>
#include <algorithm>
#include <iterator>
#include <cassert> #include <cassert>
#include "min_allocator.h" #include "min_allocator.h"

View File

@@ -14,6 +14,8 @@
// iterator erase(const_iterator f, const_iterator l) // iterator erase(const_iterator f, const_iterator l)
#include <deque> #include <deque>
#include <algorithm>
#include <iterator>
#include <cassert> #include <cassert>
#include "min_allocator.h" #include "min_allocator.h"

View File

@@ -22,7 +22,6 @@
// template <class... Args> // template <class... Args>
// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
#include <__config>
#include <unordered_map> #include <unordered_map>
#include <cassert> #include <cassert>
#include <tuple> #include <tuple>

View File

@@ -17,6 +17,7 @@
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm); // template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random> #include <random>
#include <algorithm>
#include <vector> #include <vector>
#include <iterator> #include <iterator>
#include <numeric> #include <numeric>

View File

@@ -19,6 +19,7 @@
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <algorithm>
#include <vector> #include <vector>
#include <iterator> #include <iterator>
#include <numeric> #include <numeric>

View File

@@ -11,6 +11,7 @@
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include <memory>
#include <string> #include <string>
#include <complex> #include <complex>
#include <type_traits> #include <type_traits>

View File

@@ -10,9 +10,9 @@
#ifndef ASAN_TESTING_H #ifndef ASAN_TESTING_H
#define 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 extern "C" int __sanitizer_verify_contiguous_container
( const void *beg, const void *mid, const void *end ); ( 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 #else
template <typename T, typename Alloc> 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; return true;
} }

View File

@@ -11,9 +11,9 @@
#ifndef _CONSTEXPR_CHAR_TRAITS #ifndef _CONSTEXPR_CHAR_TRAITS
#define _CONSTEXPR_CHAR_TRAITS #define _CONSTEXPR_CHAR_TRAITS
#include <__config>
#include <string> #include <string>
#include "test_macros.h"
template <class _CharT> template <class _CharT>
struct constexpr_char_traits struct constexpr_char_traits
@@ -24,41 +24,41 @@ struct constexpr_char_traits
typedef std::streampos pos_type; typedef std::streampos pos_type;
typedef std::mbstate_t state_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;} {__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;} {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;} {return __c1 < __c2;}
static _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(const char_type* __s1, const char_type* __s2, size_t __n); static TEST_CONSTEXPR_CXX14 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 TEST_CONSTEXPR_CXX14 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 TEST_CONSTEXPR_CXX14 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 TEST_CONSTEXPR_CXX14 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 TEST_CONSTEXPR_CXX14 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 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;} {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);} {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);} {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;} {return __c1 == __c2;}
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static TEST_CONSTEXPR int_type eof() TEST_NOEXCEPT
{return int_type(EOF);} {return int_type(EOF);}
}; };
template <class _CharT> 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) constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ {
for (; __n; --__n, ++__s1, ++__s2) for (; __n; --__n, ++__s1, ++__s2)
@@ -72,7 +72,7 @@ constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* _
} }
template <class _CharT> template <class _CharT>
_LIBCPP_CONSTEXPR_AFTER_CXX11 size_t TEST_CONSTEXPR_CXX14 size_t
constexpr_char_traits<_CharT>::length(const char_type* __s) constexpr_char_traits<_CharT>::length(const char_type* __s)
{ {
size_t __len = 0; size_t __len = 0;
@@ -82,7 +82,7 @@ constexpr_char_traits<_CharT>::length(const char_type* __s)
} }
template <class _CharT> 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) constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
{ {
for (; __n; --__n) for (; __n; --__n)
@@ -95,7 +95,7 @@ constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char
} }
template <class _CharT> 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) constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
{ {
char_type* __r = __s1; char_type* __r = __s1;
@@ -115,7 +115,7 @@ constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size
} }
template <class _CharT> 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) 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"); _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> 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) constexpr_char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
{ {
char_type* __r = __s; char_type* __r = __s;

View File

@@ -15,8 +15,6 @@
#ifndef PLATFORM_SUPPORT_H #ifndef PLATFORM_SUPPORT_H
#define PLATFORM_SUPPORT_H #define PLATFORM_SUPPORT_H
#include <__config>
// locale names // locale names
#ifdef _WIN32 #ifdef _WIN32
// WARNING: Windows does not support UTF-8 codepages. // WARNING: Windows does not support UTF-8 codepages.
@@ -54,7 +52,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) #if defined(_WIN32) || defined(__MINGW32__)
#include <io.h> // _mktemp #include <io.h> // _mktemp
#else #else
#include <unistd.h> // close #include <unistd.h> // close
@@ -67,12 +65,12 @@ extern "C" {
} }
#endif #endif
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE #ifndef __CloudABI__
inline inline
std::string std::string
get_temp_file_name() get_temp_file_name()
{ {
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) #if defined(_WIN32) || defined(__MINGW32__)
char Path[MAX_PATH+1]; char Path[MAX_PATH+1];
char FN[MAX_PATH+1]; char FN[MAX_PATH+1];
do { } while (0 == GetTempPath(MAX_PATH+1, Path)); do { } while (0 == GetTempPath(MAX_PATH+1, Path));
@@ -93,6 +91,6 @@ get_temp_file_name()
return Name; return Name;
#endif #endif
} }
#endif // _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE #endif // __CloundABI__
#endif // PLATFORM_SUPPORT_H #endif // PLATFORM_SUPPORT_H

View File

@@ -70,8 +70,14 @@
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
#define TEST_CONSTEXPR constexpr #define TEST_CONSTEXPR constexpr
#define TEST_NOEXCEPT noexcept #define TEST_NOEXCEPT noexcept
# if TEST_STD_VER >= 14
# define TEST_CONSTEXPR_CXX14 constexpr
# else
# define TEST_CONSTEXPR_CXX14
# endif
#else #else
#define TEST_CONSTEXPR #define TEST_CONSTEXPR
#define TEST_CONSTEXPR_CXX14
#define TEST_NOEXCEPT #define TEST_NOEXCEPT
#endif #endif