summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix demangle.h on WindowsEric Fiselier2017-01-141-1/+1
| | | | llvm-svn: 292028
* [libc++][CMake] Use debug MSVC runtimes when libc++ is built in debug modeEric Fiselier2017-01-141-0/+36
| | | | | | | | | | | | Summary: This patch allows libc++ to be built against the debug MSVC runtimes instead of just the release ones. Reviewers: rnk, majnemer, compnerd, smeenai Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D28725 llvm-svn: 292006
* Use __is_identifier to detect Clang extensions instead of __has_extension.Eric Fiselier2017-01-141-0/+10
| | | | | | | | | | | | | | | | | | | | | When -pedantic-errors is specified `__has_extension(<feature>)` is always false when it would otherwise be true. This causes C++03 <atomic> to break along with other issues. This patch avoids the above problem by using __is_identifier(...) instead since it is not affected by -pedantic-errors. For example instead of checking for __has_extension(c_atomics) we now check `!__is_identifier(_Atomic)`, which is only true when _Atomic is not a keyword provided by the compiler. This patch applies similar changes to the detection logic for __decltype and __nullptr as well. Note that it does not apply this change to the C++03 `static_assert` macro since -Wc11-extensions warnings generated by expanding that macro will appear in user code, and will not be suppressed as part of a system header. llvm-svn: 291995
* Replace identifiers called `__out` because Windows.h #defines it.Eric Fiselier2017-01-071-0/+7
| | | | | | | | Windows is greedy and it defines the identifier `__out` as a macro. This patch renames all conflicting libc++ identifiers in order to correctly work on Windows. llvm-svn: 291345
* Get all tuple tests passing on WindowsEric Fiselier2017-01-071-0/+2
| | | | llvm-svn: 291311
* Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANGEric Fiselier2017-01-061-1/+1
| | | | llvm-svn: 291278
* [libc++] Cleanup and document <__threading_support>Eric Fiselier2017-01-061-1/+1
| | | | | | | | | | | | | | | Summary: This patch attempts to clean up the macro configuration mess in `<__threading_support>`, specifically the mess involving external threading variants. Additionally this patch adds design documentation for `<__threading_support>` and the configuration macros it uses. The primary change in this patch is separating the idea of an "external API" provided by `<__external_threading>` and the idea of having an external threading library. Now `_LIBCPP_HAS_THREAD_API_EXTERNAL` means that libc++ should use `<__external_threading>` and that the header is expected to exist. Additionally the new macro `_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL` is now used to configure for using an "external library" with the default threading API. Reviewers: compnerd, rmaprath Subscribers: smeenai, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D28316 llvm-svn: 291275
* [libcxx] Fix testing of the externally-threaded library buildAsiri Rathnayake2017-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | after r290850 Before r290850, building libcxx with -DLIBCXX_HAS_EXTERNAL_THREAD_API=ON had two uses: - Allow platform vendors to plug-in an __external_threading header which should take care of the entire threading infrastructure of libcxx - Allow testing of an externally-threaded library build; where the thread API is declared using pthread data structures, and the implementation of this API is provided as a separate library (test/support/external_threads.cpp) and linked-in when running the test suite. r290850 breaks the second use case (pthread data structures are no longer available). This patch re-stores the ability to build+test an externally-threaded library variant on a pthread based system. llvm-svn: 290878
* threading_support: refactor for Win32 threadingSaleem Abdulrasool2017-01-031-1/+1
| | | | | | | | | Refactor the header to allow us to implement alternate threading models with alternate data structures. Take the opportunity to clang-format the area. This will allow us to avoid re-declaring the interfaces for Win32 threading. NFC llvm-svn: 290850
* Add tests for unordered container tests and std::stringEric Fiselier2016-12-281-0/+382
| | | | llvm-svn: 290655
* Fix another unused warningEric Fiselier2016-12-241-0/+1
| | | | llvm-svn: 290470
* Fix unused parameters and variablesEric Fiselier2016-12-235-13/+14
| | | | llvm-svn: 290459
* Revert r289727 due to PR31384Eric Fiselier2016-12-151-145/+0
| | | | | | | | This patch reverts the changes to tuple which fixed construction from types derived from tuple. It breaks the code mentioned in llvm.org/PR31384. I'll follow this commit up with a test case. llvm-svn: 289773
* Fix PR31378 - std::list::remove should not require a default constructible ↵Eric Fiselier2016-12-142-0/+42
| | | | | | | | | | | | allocator. In list::remove we collect the nodes we're removing in a seperate list instance. However we construct this list using the default constructor which default constructs the allocator. However allocators are not required to be default constructible. This patch fixes the construction of the second list. llvm-svn: 289735
* [libcxx] Fix tuple construction/assignment from types derived from ↵Eric Fiselier2016-12-141-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tuple/pair/array. Summary: The standard requires tuple have the following constructors: ``` tuple(tuple<OtherTypes...> const&); tuple(tuple<OtherTypes...> &&); tuple(pair<T1, T2> const&); tuple(pair<T1, T2> &&); tuple(array<T, N> const&); tuple(array<T, N> &&); ``` However libc++ implements these as a single constructor with the signature: ``` template <class TupleLike, enable_if_t<__is_tuple_like<TupleLike>::value>> tuple(TupleLike&&); ``` This causes the constructor to reject types derived from tuple-like types; Unlike if we had all of the concrete overloads, because they cause the derived->base conversion in the signature. This patch fixes this issue by detecting derived types and the tuple-like base they are derived from. It does this by creating an overloaded function with signatures for each of tuple/pair/array and checking if the possibly derived type can convert to any of them. This patch fixes [PR17550]( https://llvm.org/bugs/show_bug.cgi?id=17550) This patch Reviewers: mclow.lists, K-ballo, mpark, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27606 llvm-svn: 289727
* Fix undefined behavior in container swap tests.Eric Fiselier2016-12-111-12/+24
| | | | | | | | | | | | These swap tests were swapping non-POCS non-equal allocators which is undefined behavior. This patch changes the tests to use allocators which compare equal. In order to test that the allocators were not swapped I added an "id" field to test_allocator which does not participate in equality but does propagate across copies/swaps. This patch is based off of D26623 which was submitted by STL. llvm-svn: 289358
* Fix more uses of dynamic exception specifications in C++17Eric Fiselier2016-12-113-41/+31
| | | | llvm-svn: 289356
* Fix count_new.hpp to work w/o dynamic exception specificationsEric Fiselier2016-12-111-4/+20
| | | | llvm-svn: 289355
* [libcxx] [test] Add LIBCPP_ASSERT_NOEXCEPT/LIBCPP_ASSERT_NOT_NOEXCEPT, ↵Stephan T. Lavavej2016-12-091-6/+10
| | | | | | | | | | | | | | | | | | | | | | remove an unused variable. test/support/test_macros.h For convenience/greppability, add macros for libcxx-specific static_asserts about noexceptness. (Moving the definitions of ASSERT_NOEXCEPT/ASSERT_NOT_NOEXCEPT isn't technically necessary because they're macros, but I think it's better style to define stuff before using it.) test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp There was a completely unused `TrackedCallable obj;`. apply() isn't depicted with conditional noexcept in C++17. test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp Now that we have LIBCPP_ASSERT_NOEXCEPT, use it. Fixes D27622. llvm-svn: 289264
* Refactor uses_allocator test types for upcoming fixesEric Fiselier2016-12-094-378/+643
| | | | llvm-svn: 289197
* Put C++ ABI headers in a special build directory instead of the top level.Eric Fiselier2016-12-092-0/+86
| | | | | | | | | | | | | | This patch changes where the C++ ABI headers are put during the build. Previously they were put in the top level include directory (not the libc++ header directory). However that just polutes the top level directory. Instead this patch creates a special directory to put them in. The reason they can't be put under c++/v1 until after the build is because libc++ uses the in-source headers, so we can't add the include path of the libc++ headers in the object dir. Additionally this patch teaches the test suite how to find the ABI headers, and adds a demangling utility to help debug tests with. llvm-svn: 289195
* [libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' ↵Stephan T. Lavavej2016-12-062-15/+15
| | | | | | | | | | | | | to 'int' [or 'unsigned int'], possible loss of data", part 2/4. Use static_cast<int> when storing size_t in int (or passing size_t to int). Also, remove a spurious semicolon in test/support/archetypes.hpp. test/support/count_new.hpp Additionally, change data members (and parameters) to size_t. llvm-svn: 288752
* [libcxx] [test] D27266: Remove spurious semicolons.Stephan T. Lavavej2016-12-061-4/+4
| | | | llvm-svn: 288750
* Fix __hash_table::max_size() on 32 bit systemsEric Fiselier2016-11-231-1/+2
| | | | llvm-svn: 287749
* [libcxx] Fix max_size() across all containersEric Fiselier2016-11-231-0/+6
| | | | | | | | | | | | Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26885 llvm-svn: 287729
* Add <variant> tests but disable them for libc++Eric Fiselier2016-11-232-1/+81
| | | | llvm-svn: 287728
* Adjust uses_alloc_types helpers for later changesEric Fiselier2016-11-211-2/+17
| | | | llvm-svn: 287512
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-041-1/+3
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 llvm-svn: 286007
* Fix archetypes.hpp under libcpp-no-extensions and std level < 14Roger Ferrer Ibanez2016-10-311-2/+2
| | | | | | | | | | | | Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns void. This causes a type mismatch in the conditional operator when testing the library in C++98,03,11 modes. Use a comma operator to workaround this problem. Differential Revision: https://reviews.llvm.org/D26147 llvm-svn: 285572
* Silence unused parameter warnings in archetypes.hppCasey Carter2016-10-261-6/+6
| | | | | | Reviewed at: https://reviews.llvm.org/D25958 llvm-svn: 285213
* Fix unreferenced parameters. Patch from STL@microsoft.comEric Fiselier2016-10-231-6/+6
| | | | llvm-svn: 284942
* Update issue status for LWG 2744Eric Fiselier2016-10-161-5/+14
| | | | llvm-svn: 284322
* Correctly grant rebound limited_allocators friendship.Eric Fiselier2016-10-121-0/+1
| | | | llvm-svn: 284006
* Unbreak C++03 buildEric Fiselier2016-10-121-1/+1
| | | | llvm-svn: 284004
* Remove usages of _ALIGNAS_TYPEEric Fiselier2016-10-121-0/+6
| | | | llvm-svn: 283999
* Fix more C++11 constexpr issues in the testsEric Fiselier2016-10-121-9/+24
| | | | llvm-svn: 283996
* Fix nasty_containers.hpp for other stdlibsEric Fiselier2016-10-122-44/+58
| | | | llvm-svn: 283994
* Fix use of C++14 constexpr in C++11Eric Fiselier2016-10-121-0/+4
| | | | llvm-svn: 283993
* Protect special members of NullBase archetype to avoid exposing themEric Fiselier2016-10-121-4/+11
| | | | llvm-svn: 283983
* Implement N4606 optionalEric Fiselier2016-10-122-43/+420
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional. - Update relational operators per http://wg21.link/P0307 - Update to requirements of http://wg21.link/P0032 - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable. Audit P/Rs for optional LWG issues: - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R). - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression. - 2740 "constexpr optional<T>::operator->" Already conforming. - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented. - 2748 "swappable traits for optionals" Already conforming. - 2753 "Optional's constructors and assignments need constraints" Implemented. Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey! Reviewers: mclow.lists, CaseyCarter, EricWF Differential Revision: https://reviews.llvm.org/D22741 llvm-svn: 283980
* Revert Add <optional>. Will recommit with better commit messageEric Fiselier2016-10-122-421/+44
| | | | llvm-svn: 283978
* Add <optional> header.Eric Fiselier2016-10-122-44/+421
| | | | | | | | This patch is largely thanks to Casey Carter @ Microsoft. He did the initial work of porting our experimental implementation and tests over to namespace std. llvm-svn: 283977
* Add missing include in test_allocator.hEric Fiselier2016-10-081-2/+3
| | | | llvm-svn: 283632
* [libc++] Fix stack_allocatorEric Fiselier2016-10-081-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: To quote STL the problems with stack allocator are" >"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements]. > First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.) > Second, it lacks templated equality/inequality. > Third, it completely ignores alignment. > Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though." This patch attempts to address all of those issues. First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument. Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding between types that have different sizes. Third, I added copy and rebinding constructors and assignment operators. And finally I fixed the allocation logic to always return properly aligned storage. Reviewers: mclow.lists, howard.hinnant, STL_MSFT Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25154 llvm-svn: 283631
* Fix various issues in std::any and the related tests.Eric Fiselier2016-10-072-61/+2
| | | | | | | | | | | | | | | | | | | | * Fix self-swap. Patch from Casey Carter. * Remove workarounds and tests for types with deleted move constructors. This was originally added as part of a LWG proposed resolution that has since changed. * Re-apply most recent PR for LWG 2769. * Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to use the decayed type. * Fix tests to allow moved-from std::any's to have a non-empty state. This is the behavior of MSVC's std::any. * Various whitespace and test fixes. llvm-svn: 283606
* Remove MSVC workarounds. Patch from STL@microsoft.comEric Fiselier2016-10-071-8/+2
| | | | llvm-svn: 283580
* [libcxx] [test] Guard __has_include usage with a macroEric Fiselier2016-10-041-1/+7
| | | | | | | | | | | | Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly). Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25251 llvm-svn: 283260
* Replace test_throw.h header with a single test macroEric Fiselier2016-10-012-27/+11
| | | | llvm-svn: 283030
* [libc++] Remove various C++03 feature test macrosEric Fiselier2016-09-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`. This patch removes the __config macros: * _LIBCPP_HAS_NO_TRAILING_RETURN * _LIBCPP_HAS_NO_TEMPLATE_ALIASES * _LIBCPP_HAS_NO_ADVANCED_SFINAE * _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS * _LIBCPP_HAS_NO_STATIC_ASSERT As a drive I also changed our C++03 static_assert to use _Static_assert if available. I plan to commit this without review if nobody voices an objection. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24895 llvm-svn: 282347
* [libcxx] Introduce an externally-threaded libc++ variant.Asiri Rathnayake2016-09-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch further decouples libc++ from pthread, allowing libc++ to be built against other threading systems. There are two main use cases: - Building libc++ against a thread library other than pthreads. - Building libc++ with an "external" thread API, allowing a separate library to provide the implementation of that API. The two use cases are quite similar, the second one being sligtly more de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API enables both kinds of builds. One needs to place an <__external_threading> header file containing an implementation of the "libc++ thread API" declared in the <__threading_support> header. For the second use case, the implementation of the libc++ thread API can delegate to a custom "external" thread API where the implementation of this external API is provided in a seperate library. This mechanism allows toolchain vendors to distribute a build of libc++ with a custom thread-porting-layer API (which is the "external" API above), platform vendors (recipients of the toolchain/libc++) are then required to provide their implementation of this API to be linked with (end-user) C++ programs. Note that the second use case still requires establishing the basic types that get passed between the external thread library and the libc++ library (e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources won't compile otherwise). It should also be noted that the second use case can have a slight performance penalty; as all the thread constructs need to cross a library boundary through an additional function call. When the header <__external_threading> is omitted, libc++ is built with the "libc++ thread API" (declared in <__threading_support>) as the "external" thread API (basic types are pthread based). An implementation (pthread based) of this API is provided in test/support/external_threads.cpp, which is built into a separate DSO and linked in when running the libc++ test suite. A test run therefore demonstrates the second use case (less the intermediate custom API). Differential revision: https://reviews.llvm.org/D21968 Reviewers: bcraig, compnerd, EricWF, mclow.lists llvm-svn: 281179
OpenPOWER on IntegriCloud