Commit Graph

43 Commits

Author SHA1 Message Date
Marshall Clow
0662d025d5 Disable the 'nextafter' portions of these tests on PPC when using 128-bit doubles because the 'nextafter' call doesn't work right. Reviewed as https://reviews.llvm.org/D62384. Thanks to Xing Xue for the patch, and Hubert for the explanation.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363740 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 21:20:02 +00:00
Marshall Clow
389b4e6d63 Fix the floating point version of midpoint. It wasn't constexpr, among other things. Add more tests. As a drive-by, the LCD implementation had a class named '__abs' which did a 'absolute value to a common-type' conversion. Rename that to be '__ct_abs'.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363714 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-18 18:13:54 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
Marshall Clow
58320bef19 Add additional constraints on midpoint(pointer, pointer). Fixes PR#42037.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361970 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-29 15:17:55 +00:00
Michal Gorny
549cc3d6e1 [libc++] [test] Use std::nextafter() instead of std::nexttoward()
Use std::nextafter() instead of std::nexttoward() in midpoint tests.
In the context of this test, this should not cause any difference.
Since nexttowardl() is not implemented on NetBSD 8, the latter function
combined with 'long double' type caused test failure.  nextafterl() does
not have this problem.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@360673 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-14 13:56:20 +00:00
Marshall Clow
321a1f890d Implement midpoint for floating point types. Reviewed as https://reviews.llvm.org/D61014.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359184 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-25 12:11:43 +00:00
Billy Robert O'Neal III
80e36e12fd [libc++] [test] Add missing required headers to midpoint.integer.pass.cpp
This change authored by Paolo Torres <t-pator@microsoft.com>

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@358698 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-18 18:02:14 +00:00
Marshall Clow
3f377ef16a Reorg the midpoint pointer test into runtime and constexpr tests; comment out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:43:41 +00:00
Marshall Clow
3166f3aa00 Fix two of the three bot failures for midpoint; the ones regarding the lack of '__int128_t'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356169 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:20:02 +00:00
Marshall Clow
5310aa3850 Add std::midpoint for integral and poiner types. Described in P0811, reviewed as D59099.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 16:25:55 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Stephan T. Lavavej
76c246434a [libcxx] [test] Fix MSVC warnings and errors.
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
Fix MSVC x64 truncation warnings.
warning C4267: conversion from 'size_t' to 'int', possible loss of data

test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
Fix MSVC uninitialized memory warning.
warning C6001: Using uninitialized memory 'vl'.

test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
Include <cassert> for the assert() macro.

Fixes D43273.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-26 20:47:46 +00:00
Billy Robert O'Neal III
4d8cc6db10 Change add_ten to add_one to avoid triggering ubsan integer overflow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322021 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 19:45:16 +00:00
Billy Robert O'Neal III
a5f7365011 Add casts to prevent narrowing warnings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321923 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 02:50:03 +00:00
Billy Robert O'Neal III
e32740b599 [libcxx] [test] Remove nonstandard things and resolve warnings in Xxx_scan tests
Reviewed as https://reviews.llvm.org/D41748

* These tests use function objects from functional, back_inserter from iterator, and equal from algorithm, so add those headers.
* The use of iota targeting vector<unsigned char> with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&; so change the parameter to unsigned char with a static_cast.
* Avoid naming unary_function in identity here as that is removed in '17. (This also fixes naming _VSTD, _NOEXCEPT_, and other libcxx-isms)
* Change the predicate in the transform tests to add_ten so that problems with multiple application are caught.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321922 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 02:18:20 +00:00
Billy Robert O'Neal III
4dd943ec8e Move + and * operators of MoveOnly into MoveOnly.h.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321852 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 01:32:00 +00:00
Billy Robert O'Neal III
70a8aae298 Fix incorrect handling of move-only types in transform_reduce iter iter iter init, and add test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321851 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 01:31:57 +00:00
Billy Robert O'Neal III
5de0f33bc6 Add move-only types test to transform_reduce iter iter iter init op op.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321849 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 01:31:52 +00:00
Billy Robert O'Neal III
519485521a Add move-only types test for transform_reduce bop/uop.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321848 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 01:31:50 +00:00
Billy Robert O'Neal III
4436c8cd83 Fix nonstandard bits in transform_reduce_iter_iter_init_bop_uop.
* _VSTD should be std.
* <utility> is needed for forward.
* unary_function is no longer standard (and unnecessary for this, a C++17-only test)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321847 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 01:31:47 +00:00
Billy Robert O'Neal III
7e250fcdc1 Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Stephan T. Lavavej
8cbff23f7d [libcxx] [test] Rename __x to x. NFCI.
This improves readability and (theoretically) improves portability,
as __ugly names are reserved.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 20:54:06 +00:00
Stephan T. Lavavej
302557b724 [libcxx] [test] Rename _Tp to T. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 20:53:53 +00:00
Stephan T. Lavavej
a686caad20 [libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Stephan T. Lavavej
62e519c2f9 [libcxx] [test] Strip trailing whitespace, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:54:49 +00:00
Marshall Clow
3477ae445a Implement inclusive_scan/transform_inclusive_scan for C++17.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 05:12:42 +00:00
Stephan T. Lavavej
b836deb5db [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Marshall Clow
270a04fb06 Renamed some of the newly added tests. No functional change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 05:44:49 +00:00
Marshall Clow
0175dfdfdf Implement the non-parallel versions of reduce and transform_reduce for C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 04:48:45 +00:00
Marshall Clow
6bb9569124 Add a test with an empty input range - should do nothing
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 02:28:40 +00:00
Marshall Clow
fb97c4408f Implement the non-parallel versions of exclusive_scan and transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-10 02:22:13 +00:00
Billy Robert O'Neal III
3f9bc2d28c Resolve integer overflow warnings in GCD and LCM tests
lcm.pass.cpp:
19: Update headers to that actually used in the test.
41: test0 was triggering narrowing warnings for all callers, because the
inputs were always ints, but some of the explicit template arguments were
smaller than that. Instead, have this function accept ints and static_cast
explicitly to the types we want before calling std::lcm.
47: Replace unnecessary ternary.
55: Use foo_t instead of typename foo<>::type
111/116: intX_t were not std::qualified but only <cfoo> headers were included.
141: C1XX has a bug where it interprets 2147483648 as unsigned int. Then the
negation trips "negation of unsigned value, result still unsigned" warnings.
Perma-workaround this issue by saying INT_MIN, which better documents the
intended behavior and avoids triggering warnings on C1XX.

gcd.pass.cpp:
Same changes as lcm.pass.cpp but for GCD.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302472 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-08 21:52:05 +00:00
Eric Fiselier
f4dfb45247 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 03:43:25 +00:00
Marshall Clow
ebf66a385f Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294779 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 20:49:08 +00:00
Marshall Clow
1b8fc14abc Temporarily disable the LCM/GCD tests under UBSAN.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 07:40:59 +00:00
Marshall Clow
24597f254d Add some tests to verify that we implement LWG#2837 correctly. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06 16:03:23 +00:00
Eric Fiselier
0e5ebbc77c Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:37:52 +00:00
Stephan T. Lavavej
e33c0b01f8 [libcxx] [test] D27027: Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287829 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:03:28 +00:00
Marshall Clow
db7fa111ab Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286858 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 18:22:19 +00:00
Marshall Clow
1c1e91d9a3 Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 14:29:45 +00:00
Eric Fiselier
22bff1afcc Move remaining _LIBCPP_VERSION tests into test/libcxx
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273367 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:23:22 +00:00
Eric Fiselier
a90c6dd460 Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 01:40:03 +00:00