summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix missing includes in test headerEric Fiselier2018-11-211-5/+6
| | | | llvm-svn: 347416
* [NFC][libcxx] Fix incorrect commentsLouis Dionne2018-11-191-3/+3
| | | | llvm-svn: 347267
* [libcxx] Add availability markup for bad_optional_access, bad_variant_access ↵Louis Dionne2018-11-191-0/+3
| | | | | | | | | | | | and bad_any_cast Reviewers: dexonsmith, EricWF Subscribers: christof, arphaman, libcxx-commits Differential Revision: https://reviews.llvm.org/D53256 llvm-svn: 347219
* Get tests compiling with -Wunused-local-typedefEric Fiselier2018-11-152-3/+0
| | | | llvm-svn: 346914
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2018-11-141-2/+2
| | | | llvm-svn: 346826
* Fix test assumption that Linux implies glibc.Dan Albert2018-11-011-3/+9
| | | | | | | | | | | | | | | | | | | | | Summary: This fixes an regression when using bionic introduced in r345173. I need to follow up and figure out what exactly is implied by TEST_HAS_C11_FEATURES and see what the correct configuration is for bionic (new versions should have everything the tests care about, versions that predate C11 certainly don't), but this gets the tests back to the old behavior. Reviewers: EricWF Reviewed By: EricWF Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D53956 llvm-svn: 345900
* [libcxx] Fix usage of _C2, which is a "nasty macro" in some environmentsLouis Dionne2018-11-011-0/+3
| | | | | | The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775. llvm-svn: 345834
* Fix use of libc++ specific macro in support/test_macros.hEric Fiselier2018-10-241-3/+4
| | | | llvm-svn: 345173
* Add test macros for always_inline and noinlineEric Fiselier2018-10-101-0/+10
| | | | llvm-svn: 344167
* Selectively import timespec_get into namespace std, since some C libraries ↵Marshall Clow2018-08-151-0/+7
| | | | | | don't have it. Reviewed as https://reviews.llvm.org/D50799 llvm-svn: 339816
* For FreeBSD, don't define _M in nasty_macros.hppDimitry Andric2018-08-151-0/+4
| | | | | | | | | | Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid including that header, only define _M to NASTY_MACRO for other operating systems. This fixes almost 2000 unexpected test failures. Discussed with Eric Fiselier. llvm-svn: 339794
* [libc++] Fix incorrect definition of TEST_HAS_C11_FEATURESLouis Dionne2018-08-141-1/+1
| | | | | | | | | | | | | | Summary: The macro was not defined in C++11 mode when it should have been, at least according to how _LIBCPP_HAS_C11_FEATURES is defined. Reviewers: mclow.lists, EricWF, jfb, dexonsmith Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50719 llvm-svn: 339702
* Make my new test harness work w/c++03Marshall Clow2018-08-031-2/+2
| | | | llvm-svn: 338803
* [libc++] Fix build failures after merging <charconv>Zhihao Yuan2018-08-011-1/+1
| | | | | | | | | | | | | | Summary: - fix a stupid unit test typo - add <charconv> symbols to Linux abilist Reviewers: EricWF Subscribers: christof, ldionne, cfe-commits Differential Revision: https://reviews.llvm.org/D50130 llvm-svn: 338486
* [libc++][C++17] Elementary string conversions for integral typesZhihao Yuan2018-08-011-0/+232
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Major QoI considerations: - The facility is backported to C++14, same as libstdc++. - Efforts have been made to minimize the header dependencies. - The design is friendly to the uses of MSVC intrinsics (`__emulu`, `_umul128`, `_BitScanForward`, `_BitScanForward64`) but not implemented; future contributions are welcome. Thanks to Milo Yip for contributing the implementation of `__u64toa` and `__u32toa`. References: https://wg21.link/p0067r5 https://wg21.link/p0682r1 Reviewers: mclow.lists, EricWF Reviewed By: mclow.lists Subscribers: ldionne, Quuxplusone, christof, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D41458 llvm-svn: 338479
* First half of C++17's splicing maps and setsErik Pilkington2018-08-011-2/+2
| | | | | | | | | | | | | This commit adds a node handle type, (located in __node_handle), and adds extract() and insert() members to all map and set types, as well as their implementations in __tree and __hash_table. The second half of this feature is adding merge() members, which splice nodes in bulk from one container into another. This will be committed in a follow-up. Differential revision: https://reviews.llvm.org/D46845 llvm-svn: 338472
* Introduce a new test macro TEST_HAS_C11_FEATURES which is set when the ↵Marshall Clow2018-07-311-10/+37
| | | | | | underlying C library has C11 features. In C++17, we use those features. <__config> defines a similar macro, _LIBCPP_HAS_C11_FEATURES, but we don't want to use that in the library-independent parts of the tests, so define the new one. Also add a libc++-specific test to make sure the two stay in sync. llvm-svn: 338411
* Implement <filesystem>Eric Fiselier2018-07-271-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the <filesystem> header and uses that to provide <experimental/filesystem>. Unlike other standard headers, the symbols needed for <filesystem> have not yet been placed in libc++.so. Instead they live in the new libc++fs.a library. Users of filesystem are required to link this library. (Also note that libc++experimental no longer contains the definition of <experimental/filesystem>, which now requires linking libc++fs). The reason for keeping <filesystem> out of the dylib for now is that it's still somewhat experimental, and the possibility of requiring an ABI breaking change is very real. In the future the symbols will likely be moved into the dylib, or the dylib will be made to link libc++fs automagically). Note that moving the symbols out of libc++experimental may break user builds until they update to -lc++fs. This should be OK, because the experimental library provides no stability guarantees. However, I plan on looking into ways we can force libc++experimental to automagically link libc++fs. In order to use a single implementation and set of tests for <filesystem>, it has been placed in a special `__fs` namespace. This namespace is inline in C++17 onward, but not before that. As such implementation is available in C++11 onward, but no filesystem namespace is present "directly", and as such name conflicts shouldn't occur in C++11 or C++14. llvm-svn: 338093
* Fix missing includes in format_string.hpp helperEric Fiselier2018-07-251-4/+5
| | | | llvm-svn: 337886
* New test support for comparisons. Reviewed as https://reviews.llvm.org/D49773Marshall Clow2018-07-251-0/+175
| | | | llvm-svn: 337885
* Stop wrapping __has_include in another macroAlexander Richardson2018-07-241-5/+3
| | | | | | | | | | | | | | Summary: This is not guaranteed to work since the characters after '__has_include(' have special lexing rules that can't possibly be applied when __has_include is generated by a macro. It also breaks the crash reproducers generated by -frewrite-includes (see https://llvm.org/pr37990). Reviewers: EricWF, rsmith, mclow.lists Reviewed By: mclow.lists Differential Revision: https://reviews.llvm.org/D49067 llvm-svn: 337824
* Fix use of C++14 syntax in C++11 filesystem tests.Eric Fiselier2018-07-231-3/+5
| | | | llvm-svn: 337666
* Implement filesystem_error::what() and improve reporting.Eric Fiselier2018-07-232-11/+134
| | | | | | | | | | | This patch implements the `what()` for filesystem errors. The message includes the 'what_arg', any paths that were specified, and the error code message. Additionally this patch refactors how errors are created, making it easier to report them correctly. llvm-svn: 337664
* Implement a better copy_file.Eric Fiselier2018-07-222-14/+18
| | | | | | | | | | | | | | | | | | | | This patch improves both the performance, and the safety of the copy_file implementation. The performance improvements are achieved by using sendfile on Linux and copyfile on OS X when available. The TOCTOU hardening is achieved by opening the source and destination files and then using fstat to check their attributes to see if we can copy them. Unfortunately for the destination file, there is no way to open it without accidentally creating it, so we first have to use stat to determine if it exists, and if we should copy to it. Then, once we're sure we should try to copy, we open the dest file and ensure it names the same entity we previously stat'ed. llvm-svn: 337649
* [libc++] Implement Directory Entry Caching -- Sort of.Eric Fiselier2018-07-202-2/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements directory_entry caching *almost* as specified in P0317r1. However, I explicitly chose to deviate from the standard as I'll explain below. The approach I decided to take is a fully caching one. When `refresh()` is called, the cache is populated by calls to `stat` and `lstat` as needed. During directory iteration the cache is only populated with the `file_type` as reported by `readdir`. The cache can be in the following states: * `_Empty`: There is nothing in the cache (likely due to an error) * `_IterSymlink`: Created by directory iteration when we walk onto a symlink only the symlink file type is known. * `_IterNonSymlink`: Created by directory iteration when we walk onto a non-symlink. Both the regular file type and symlink file type are known. * `_RefreshSymlink` and `_RefreshNonSymlink`: A full cache created by `refresh()`. This case includes dead symlinks. * `_RefreshSymlinkUnresolved`: A partial cache created by refresh when we fail to resolve the file pointed to by a symlink (likely due to permissions). Symlink attributes are cached, but attributes about the linked entity are not. As mentioned, this implementation purposefully deviates from the standard. According to some readings of the specification, and the Windows filesystem implementation, the constructors and modifiers which don't pass an `error_code` must throw when the `directory_entry` points to a entity which doesn't exist. or when attribute resolution fails for another reason. @BillyONeal has proposed a more reasonable set of requirements, where modifiers other than refresh ignore errors. This is the behavior libc++ currently implements, with the expectation some form of the new language will be accepted into the standard. Some additional semantics which differ from the Windows implementation: 1. `refresh` will not throw when the entry doesn't exist. In this case we can still meet the functions specification, so we don't treat it as an error. 2. We don't clear the path name when a constructor fails via refresh (this will hopefully be changed in the standard as well). It should be noted that libstdc++'s current implementation has the same behavior as libc++, except for point (2). If the changes to the specification don't get accepted, we'll be able to make the changes later. [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0317r1.html Reviewers: mclow.lists, gromer, ldionne, aaron.ballman Subscribers: BillyONeal, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D49530 llvm-svn: 337516
* [libcxx] [test] Update msvc_stdlib_force_include.hpp.Stephan T. Lavavej2018-06-141-11/+0
| | | | | | | | MSVC's STL removed _SCL_SECURE_NO_WARNINGS. MSVC's STL implemented feature-test macros. llvm-svn: 334675
* Fix PR37694 - std::vector doesn't correctly move construct allocators.Eric Fiselier2018-06-051-5/+52
| | | | | | | | | | | | | | | | | | | C++2a[container.requirements.general]p8 states that when move constructing a container, the allocator is move constructed. Vector previously copy constructed these allocators. This patch fixes that bug. Additionally it cleans up some unnecessary allocator conversions when copy constructing containers. Libc++ uses __internal_allocator_traits::select_on_copy_construction to select the correct allocator during copy construction, but it unnecessarily converted the resulting allocator to the user specified allocator type and back. After this patch list and forward_list no longer do that. Technically we're supposed to be using allocator_traits<allocator_type>::select_on_copy_construction, but that should seemingly be addressed as a separate patch, if at all. llvm-svn: 334053
* LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()"Eric Fiselier2018-05-291-1/+1
| | | | | | | | | | | | | | | | | | | Patch from Arthur O'Dwyer. In the TS, `uses_allocator` construction for `pair` tried to use an allocator type of `memory_resource*`, which is incorrect because `memory_resource*` is not an allocator type. LWG 2969 fixed it to use `polymorphic_allocator` as the allocator type instead. https://wg21.link/lwg2969 (D47090 included this in `<memory_resource>`; at Eric's request, I've split this out into its own patch applied to the existing `<experimental/memory_resource>` instead.) Reviewed as https://reviews.llvm.org/D47109 llvm-svn: 333384
* [libcxx] [test] Update msvc_stdlib_force_include.hpp.Stephan T. Lavavej2018-05-111-4/+0
| | | | llvm-svn: 332159
* [libcxx] [test] Avoid unary_function.Stephan T. Lavavej2018-04-121-1/+3
| | | | | | | | | | | Replace unary_function inheritance (which was never required, even in C++98) with argument_type and result_type typedefs. This increases portability, as unary_function was removed in C++17 and MSVC has implemented that removal. Fixes D45596. llvm-svn: 329974
* Implement P0768r1: Library support for the Spaceship Operator.Eric Fiselier2018-04-061-0/+5
| | | | | | | | | | | | this patch adds the <compare> header and implements all of it except for [comp.alg]. As I understand it, the header is needed by the compiler in when implementing the semantics of operator<=>. For that reason I feel it's important to land this header early, despite all compilers lacking support. llvm-svn: 329460
* Implement filesystem NB comments, relative paths, and related issues.Eric Fiselier2018-04-022-1/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fairly large patch that implements all of the filesystem NB comments and the relative paths changes (ex. adding weakly_canonical). These issues and papers are all interrelated so their implementation couldn't be split up nicely. This patch upgrades <experimental/filesystem> to match the C++17 spec and not the published experimental TS spec. Some of the changes in this patch are both API and ABI breaking, however libc++ makes no guarantee about stability for experimental implementations. The major changes in this patch are: * Implement NB comments for filesystem (P0492R2), including: * Implement `perm_options` enum as part of NB comments, and update the `permissions` function to match. * Implement changes to `remove_filename` and `replace_filename` * Implement changes to `path::stem()` and `path::extension()` which support splitting examples like `.profile`. * Change path iteration to return an empty path instead of '.' for trailing separators. * Change `operator/=` to handle absolute paths on the RHS. * Change `absolute` to no longer accept a current path argument. * Implement relative paths according to NB comments (P0219r1) * Combine `path.cpp` and `operations.cpp` since some path functions require access to the operations internals, and some fs operations require access to the path parser. llvm-svn: 329028
* Make filesystem tests generic between experimental and std versions.Eric Fiselier2018-03-262-2/+19
| | | | | | | | | | | | | | | As I move towards implementing std::filesystem, there is a need to make the existing tests run against both the std and experimental versions. Additionally, it's helpful to allow running the tests against other implementations of filesystem. This patch converts the test to easily target either. First, it adds a filesystem_include.hpp header which is soley responsible for selecting and including the correct implementation. Second, it converts existing tests to use this header instead of including filesystem directly. llvm-svn: 328475
* Use DoNotOptimize to prevent new/delete elision.Eric Fiselier2018-03-221-2/+12
| | | | | | | | | | | The new/delete tests, in particular those which test replacement functions, often fail when the optimizer is enabled because the calls to new/delete may be optimized away, regardless of their side-effects. This patch converts the tests to use DoNotOptimize in order to prevent the elision. llvm-svn: 328245
* Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definitionEric Fiselier2018-03-221-2/+3
| | | | llvm-svn: 328185
* Fix PR22634 - std::allocator doesn't respect over-aligned types.Eric Fiselier2018-03-222-5/+170
| | | | | | | | | | | | | | | | | | | | This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. llvm-svn: 328180
* libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* ↵Peter Collingbourne2018-01-231-0/+12
| | | | | | | | | | | | filenames on Windows. This is an MSVC standard library extension. It seems like a reasonable enough extension to me because wchar_t* is the native format for filenames on that platform. Differential Revision: https://reviews.llvm.org/D42225 llvm-svn: 323170
* [libcxx] [test] Improve MSVC portability.Stephan T. Lavavej2018-01-101-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. llvm-svn: 322144
* Move + and * operators of MoveOnly into MoveOnly.h.Billy Robert O'Neal III2018-01-051-1/+2
| | | | llvm-svn: 321852
* [libcxx] [test] Fix MSVC warnings, null pointer deref.Stephan T. Lavavej2017-12-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp Silence MSVC warning C4244. This is expected when passing floating-point values for size. test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Avoid MSVC "warning C4293: '<<': shift count negative or too big, undefined behavior". MSVC sees (1ULL << N) and warns - being guarded by const bool canFit is insufficient. A small change to the code avoids the warning without the need for a pragma. Remove a spurious printf() declaration from to_ullong.pass.cpp. Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was probably copy-pasted. test/std/utilities/tuple/tuple.general/ignore.pass.cpp Use LIBCPP_STATIC_ASSERT for consistency with other files. test/support/container_test_types.h Fix a null pointer dereference, found by MSVC /analyze warning C6011 "Dereferencing NULL pointer 'm_expected_args'." Fixes D41030. llvm-svn: 320535
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-211-0/+2
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* Rename identifiers named `__output`Alexander Richardson2017-11-141-0/+3
| | | | | | | | | | | | | | | | Summary: In the CHERI clang compiler __output and __input are keywords and therefore we can't compile libc++ with our compiler. Reviewers: mclow.lists, EricWF, theraven Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39537 llvm-svn: 318144
* fix shadowing warnings in new tests, try 2Eric Fiselier2017-10-171-2/+2
| | | | llvm-svn: 316009
* fix shadowing warnings in new testsEric Fiselier2017-10-171-3/+3
| | | | llvm-svn: 315997
* [libc++] Fix PR34898 - vector iterator constructors and assign method ↵Eric Fiselier2017-10-172-2/+100
| | | | | | | | | | | | | | | | | | | | | | | perform push_back instead of emplace_back. Summary: The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, Iter)` don't correctly perform EmplaceConstruction from the result of dereferencing the iterator. This results in them performing an additional and unneeded copy. This patch addresses the issue by correctly using `emplace_back` in C++11 and newer. There are also some bugs in our `insert` implementation, but those will be handled separately. @mclow.lists We should probably merge this into 5.1, agreed? Reviewers: mclow.lists, dlj, EricWF Reviewed By: mclow.lists, EricWF Subscribers: cfe-commits, mclow.lists Differential Revision: https://reviews.llvm.org/D38757 llvm-svn: 315994
* [libcxx] [test] Silence warning C4324 for MSVC.Stephan T. Lavavej2017-09-261-0/+1
| | | | | | | | This warning "structure was padded due to alignment specifier" says that the compiler is going to do exactly what you asked it to do. It's triggered by the tests for over-aligned dynamic memory allocation. llvm-svn: 314257
* [libcxx] [test] Update for C++17 feature removals.Stephan T. Lavavej2017-08-242-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/containers/Emplaceable.h test/std/containers/NotConstructible.h test/support/counting_predicates.hpp Replace unary_function/binary_function inheritance with typedefs. test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp test/std/utilities/function.objects/func.require/binary_function.pass.cpp test/std/utilities/function.objects/func.require/unary_function.pass.cpp Mark these tests as requiring 98/03/11/14 because 17 removed unary_function/binary_function. test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp Mark these tests as requiring 11/14 because 17 removed packaged_task allocator support. test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp This test doesn't need to be skipped in C++17 mode. Only the construction of std::function from an allocator needs to be skipped in C++17 mode. test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp When testing these reference_wrapper features, unary_function inheritance is totally irrelevant. test/std/utilities/function.objects/refwrap/weak_result.pass.cpp Define and use my_unary_function/my_binary_function to test the weak result type machinery (which is still present in C++17, although deprecated). test/support/msvc_stdlib_force_include.hpp Now we can test C++17 strictly, without enabling removed features. Fixes D36503. llvm-svn: 311705
* [libcxx] [test] Rename _Tp to T. NFCI.Stephan T. Lavavej2017-08-112-8/+8
| | | | | | | This improves readability and (theoretically) improves portability, as _Ugly names are reserved. llvm-svn: 310758
* [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.Stephan T. Lavavej2017-08-051-1/+1
| | | | llvm-svn: 310156
* [libcxx] [test] Make files consistently end with newlines, NFC.Stephan T. Lavavej2017-07-291-1/+1
| | | | llvm-svn: 309465
OpenPOWER on IntegriCloud