Commit Graph

4676 Commits

Author SHA1 Message Date
Billy Robert O'Neal III 6e083f628a [libcxx] [test] Remove non-portable assertions from filebuf tests
seekoff.pass.cpp:
libc++'s tests are asserting things about the buffer passed to pubsetbuf. [filebuf.virtuals]/12 says that what the filebuf does with the buffer you give it is completely implementation defined. The MSVC++ implementation takes that buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't necessarily follow the pattern this test wants.
This change simply makes asserts against the buffer's contents use LIBCPP_ASSERT instead of assert.

pbackfail.pass.cpp:
libc++'s tests are asserting about what characters will and will not be available in the putback area. [filebuf.virtuals]/9 says "The function can alter the number of putback positions available as a result of any call." This change LIBCPP_ASSERTS libc++'s behavior, but checks invariants of the putback area independently.

llvm-svn: 330999
2018-04-26 22:18:33 +00:00
Marshall Clow 57e782535e Move old test into test/libcxx, and implement new version of test for ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report.
llvm-svn: 330955
2018-04-26 16:16:45 +00:00
Volodymyr Sapsai aa208791bb [libcxx] func.wrap.func.con: Unset function before destroying anything
Be defensive against a reentrant std::function::operator=(nullptr_t), in case
the held function object has a non-trivial destructor.  Destroying the function
object in-place can lead to the destructor being called twice.

Patch by Duncan P. N. Exon Smith. C++03 support by Volodymyr Sapsai.

rdar://problem/32836603

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits, arphaman

Differential Revision: https://reviews.llvm.org/D34331

llvm-svn: 330885
2018-04-25 23:38:41 +00:00
Marshall Clow 0badc676cf Disable the test I just added when testing C++03.
llvm-svn: 330838
2018-04-25 16:09:47 +00:00
Marshall Clow 3df56fdd9b Fix static initialization of std::atomic_flag; Fixes PR#37226. Thanks to Ricky Zhou for the report and test case.
llvm-svn: 330828
2018-04-25 14:27:29 +00:00
Billy Robert O'Neal III 078611eed5 [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests
These io_error asserts that std::errc::is_a_directory has message "Is a directory". On MSVC++ it reports "is a directory" (with a lowercase I). That doesn't matter for the ios_failure component being tested, so just implement in terms of system_category().message().

Reviewed as https://reviews.llvm.org/D45715

llvm-svn: 330791
2018-04-25 01:58:55 +00:00
Tim Shen 403c667b4b Re-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."
There are 3 changes:
* Renamed genertor.pass.cpp to generator.pass.cpp
* Removed nothing_to_do.pass.cpp
* Mark GCC 4.9 as UNSUPPORTED for the test files that have negative
  narrowing conversion SFINAE test (see GCC PR63723).

llvm-svn: 330655
2018-04-23 21:54:06 +00:00
Tim Shen f72b208576 Revert "[libcxx] implement <experimental/simd> declarations based on P0214R7."
This reverts commit r330627.

This causes several bots to freak out.

llvm-svn: 330636
2018-04-23 19:56:20 +00:00
Tim Shen 6a72ef6c4b [libcxx] implement <experimental/simd> declarations based on P0214R7.
Summary:
The patch includes all declarations, and also implements the following features:
* ABI.
* narrowing-conversion related SFIANE, including simd<> ctors and (static_)simd_cast.

Reviewers: mclow.lists, EricWF

Subscribers: lichray, sanjoy, MaskRay, cfe-commits

Differential Revision: https://reviews.llvm.org/D41148

llvm-svn: 330627
2018-04-23 18:47:07 +00:00
Reid Kleckner 6a2a5e0abb Don't do aligned allocations on MSVCRT before 19.12 (update 15.3)
Reviewers: EricWF, pcc

Subscribers: christof, cfe-commits

Differential Revision: https://reviews.llvm.org/D45836

llvm-svn: 330372
2018-04-19 22:12:10 +00:00
Reid Kleckner 317a6ddea7 Remove impossible _MSC_VER check
Summary:
It is immediately preceded by this check:
  #if _MSC_VER < 1900
  #error "MSVC versions prior to Visual Studio 2015 are not supported"
  #endif

Reviewers: EricWF

Subscribers: christof, cfe-commits

Differential Revision: https://reviews.llvm.org/D45829

llvm-svn: 330360
2018-04-19 19:40:12 +00:00
Saleem Abdulrasool a4e874c516 support: add missing locale stubs for android L, M
The strto* family was introduced in android O (API Level 26).  However,
the support headers were adjusted to indicate that all locale aware
functions were added in L.  Provide stubs for the locale aware strto*
family until O.

llvm-svn: 330045
2018-04-13 18:14:57 +00:00
Petr Hosek de2b464504 [CMake] Set the default ABI version for Fuchsia in CMake as well
This is neeeded since the CMake value is used for the SOVERSION.

Differential Revision: https://reviews.llvm.org/D45529

llvm-svn: 329983
2018-04-13 01:59:15 +00:00
Stephan T. Lavavej 8fc5b84349 [libcxx] [test] Use TEST_IGNORE_NODISCARD.
Fixes D45595.

llvm-svn: 329979
2018-04-13 00:07:48 +00:00
Stephan T. Lavavej ad9545eb30 [libcxx] [test] Fix whitespace, NFC.
test/std almost always uses spaces; now it is entirely tab-free.

llvm-svn: 329978
2018-04-12 23:56:22 +00:00
Stephan T. Lavavej 9e5283f27f [libcxx] [test] Use TEST_COMPILER_C1XX.
Also TEST_COMPILER_CLANG in one place. (More could be changed.)

llvm-svn: 329977
2018-04-12 23:56:17 +00:00
Stephan T. Lavavej 23e82831e5 [libcxx] [test] Silence MSVC warning C4146.
This test code triggers the MSVC warning:

"unary minus operator applied to unsigned type, result still unsigned"

Although it would be possible to change the test code to avoid
this warning, I have chosen to simply silence it.

Fixes D45594.

llvm-svn: 329976
2018-04-12 23:56:14 +00:00
Stephan T. Lavavej cf017f0451 [libcxx] [test] Fix nodiscard warnings.
MSVC's STL has marked to_bytes/from_bytes as nodiscard.

Fixes D45595.

llvm-svn: 329975
2018-04-12 23:56:12 +00:00
Stephan T. Lavavej 3ed719bb63 [libcxx] [test] Avoid unary_function.
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
2018-04-12 23:56:10 +00:00
Stephan T. Lavavej 0f66190aef [libcxx] [test] Avoid MSVC truncation warnings.
MSVC emits "warning C4244: 'initializing': conversion from 'int'
to 'short', possible loss of data" when it sees pair<Whatever, short>
constructed from (whatever, 4), because int is being truncated to
short within pair's constructor. (The compiler doesn't take into
account the fact that 4 is a literal at the callsite; it generates
this warning when the constructor is instantiated, because it might
be called with a runtime-valued int that would actually truncate.)

Instead of static_cast<short>, we can simply change short to int
in these tests, without affecting the pair operations that they're
trying to test: move assignment, convert copy construction, and
convert move construction.

Fixes D45016.

llvm-svn: 329973
2018-04-12 23:56:07 +00:00
Petr Hosek 2b3846306d [libcxx] Set ABI version 2 as default for Fuchsia
This avoids the need for a custom generated config file which is desired
because the custom config files differs per-target which means we cannot
reuse headers across different targets.

Differential Revision: https://reviews.llvm.org/D45304

llvm-svn: 329770
2018-04-11 01:06:28 +00:00
Billy Robert O'Neal III 34ab26d62a [libcxx] [test] Use the correct type from strlen. Include correct header.
llvm-svn: 329665
2018-04-10 03:04:07 +00:00
Casey Carter e5b6400b54 [test] [NFC] cleanup aligned_storage test
* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`

llvm-svn: 329618
2018-04-09 20:41:45 +00:00
Petr Hosek f73514c810 Revert "[CMake] Use custom command and target to install libc++ headers"
This reverts commit r329544 which is failing on libcxx standalone bots.

llvm-svn: 329545
2018-04-09 04:36:04 +00:00
Petr Hosek e10ef3548f [CMake] Use custom command and target to install libc++ headers
Using file(COPY FILE...) has several downsides. Since the file command
is only executed at configuration time, any changes to headers made
after the initial CMake execution are ignored. This can lead to subtle
errors since the just built Clang will be using stale libc++ headers.
Furthermore, since the headers are copied prior to executing the build
system, this may hide missing dependencies on libc++ from other LLVM
components.

This changes replaces the use of file(COPY FILE...) command with a
custom command and target which addresses all aforementioned issues and
matches the implementation already used by other LLVM components that
also install headers like Clang builtin headers.

Differential Revision: https://reviews.llvm.org/D44773

llvm-svn: 329544
2018-04-09 04:23:04 +00:00
Eric Fiselier ba0543b32b [test] Fix Container::insert(value_type const&) tests
Patch from Joe Loser.

Several unit tests meaning to test the behavior of lvalue insertion incorrectly
pass rvalues. Fixes bug PR # 27394

Reviewed as https://reviews.llvm.org/D44411

llvm-svn: 329541
2018-04-08 21:57:35 +00:00
Roman Lebedev 6669e59f88 [libcxx][test] Silence -Wself-assign diagnostics
Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

Differential Revision: https://reviews.llvm.org/D45128

llvm-svn: 329490
2018-04-07 10:36:03 +00:00
Eric Fiselier d1324fdff0 Use void() to create a void expression type
llvm-svn: 329484
2018-04-07 04:28:11 +00:00
Eric Fiselier b12cc2003a Work around missing braces in init warning
llvm-svn: 329474
2018-04-07 01:28:54 +00:00
Eric Fiselier 0913ca1978 Implement P0768r1: Library support for the Spaceship Operator.
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
2018-04-06 21:37:23 +00:00
Marshall Clow 1b25a3994e Mark <span> as "In progress"
llvm-svn: 329375
2018-04-06 04:43:27 +00:00
Gor Nishanov 8f310655af [coroutines] libcxx, noop_coroutine, make bots even more happy
llvm-svn: 329245
2018-04-05 00:18:37 +00:00
Gor Nishanov 3a7fdb7d04 [coroutines] libcxx noop_coroutine. Make bots happier
llvm-svn: 329240
2018-04-04 23:43:50 +00:00
Gor Nishanov b1e985db53 [coroutines] Allow compilation under c++03
llvm-svn: 329239
2018-04-04 22:51:57 +00:00
Gor Nishanov 0f87a80795 [coroutines] Add noop_coroutine to <experimental/coroutine>
A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined
coroutine noop_coroutine that does nothing.

This patch implements require library types in <experimental/coroutine>

Related clang and llvm patches:

https://reviews.llvm.org/D45114
https://reviews.llvm.org/D45120

llvm-svn: 329237
2018-04-04 22:18:03 +00:00
Jan Korous 3abc515dc2 [libcxx][test] Fix fs::proximate tests on platforms where /net exists.
Following Eric's patch.

llvm-svn: 329199
2018-04-04 14:23:51 +00:00
Jan Korous b5fc2b1433 [libcxx][test] Improve assert message
llvm-svn: 329194
2018-04-04 13:31:39 +00:00
Simon Dardis 6487c3b012 [libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when configuring
When libcxx is built in tree for a host which requires libatomic, LLVM's
configuration steps will determine it is required and add it to
CMAKE_REQUIRED_LIBRARIES. When libcxx is later configured, it tests if it
has C++ atomics without libatomic. The test erroneously passes as libatomic
is already part of the set of required libraries.

In turn, a number of the atomic tests will fail as they require libatomic
but the test suite is configured not to use libatomic.

Address this by always dropping libatomic from the set of required libraries
before determining if LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB is true,
then restoring the set of required libraries.

Reviewers: EricWF

Differential Revision: https://reviews.llvm.org/D43509

llvm-svn: 329167
2018-04-04 11:05:03 +00:00
Eric Fiselier c18fe4cf41 Fix undefined macro issue in locale tests; Try 2
llvm-svn: 329149
2018-04-04 04:48:26 +00:00
Eric Fiselier 06091cfa7a Fix undefined macro issue in locale tests
llvm-svn: 329148
2018-04-04 04:39:38 +00:00
Eric Fiselier b5d2937d5f Update Clang version on Appveyor bots
llvm-svn: 329145
2018-04-04 04:33:09 +00:00
Eric Fiselier acc32abb11 Touch up tests for new <version> header; fix module.modulemap.
This patch does some housekeeping for the new <version> header.
It adds it to the module.modulemap, and the double_include.sh.cpp test.

Additionally it corrects the // UNSUPPORTED options for the libc++
specific test. The header needs to compile under C++03 to support
modules, and it should compile under all available compilers.

llvm-svn: 329144
2018-04-04 04:21:54 +00:00
Eric Fiselier fcc1e6d978 Fix locale test data for GLIBC 2.27 and newer.
GLIBC 2.27 changed the locale data for fr_FR and ru_RU. In particular
they change the decimal and thousands separators used. This patch
makes the locale tests tolerate the updated locales.

llvm-svn: 329143
2018-04-04 04:00:14 +00:00
Marshall Clow 082229eb0f Implement P0754R2: The <version> header.
llvm-svn: 329075
2018-04-03 15:48:24 +00:00
Eric Fiselier 9085c6fcd8 Fix fs::proximate tests on platforms where /net exists.
The proximate tests depended on `/net` not being a valid path,
however, on OS X it is.

Correct the tests to handle this.

llvm-svn: 329038
2018-04-03 01:52:12 +00:00
Eric Fiselier d491a6960a Implement P0430R2 - File system library on non-POSIX systems.
This patch implements P0430R2, who's largest change is adding the path::format
enumeration for supporting path format conversions in path constructors.

However, since libc++'s filesystem only really supports POSIX like systems,
there are no real changes needed. This patch simply adds the format enum
and then ignores it when it's passed to constructors.

llvm-svn: 329031
2018-04-02 23:35:24 +00:00
Eric Fiselier d7fae181c3 Implement filesystem NB comments, relative paths, and related issues.
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
2018-04-02 23:03:41 +00:00
Volodymyr Sapsai 24a77396a9 [libcxx] Disable testing with system lib for 2 tests verifying debug mode.
llvm-svn: 329023
2018-04-02 22:09:57 +00:00
Eric Fiselier 02eb974af5 fix typo in align_const_pair_U_V.pass.cpp
llvm-svn: 328760
2018-03-29 03:44:01 +00:00
Eric Fiselier f8aa23879e Move libc++ pair/tuple assign test to libcxx/ test directory.
Libc++ implements the pair& operator=(pair<U, V>) assignment operator
using a single template that handles assignment from all tuple-like types.

This patch moves the test for that to the libcxx test directory since
it's non-standard. It also adds additional tests to the std/.../pair
directory to test the standard behavior this template implements.

llvm-svn: 328758
2018-03-29 03:30:00 +00:00