Commit Graph

3355 Commits

Author SHA1 Message Date
Eric Fiselier 4262748e0f Add more test cases to packaged_task copyability test
llvm-svn: 289034
2016-12-08 10:02:04 +00:00
Eric Fiselier 009259da8a Avoid C++17 guaranteed copy elision when testing for non-copyability
llvm-svn: 289033
2016-12-08 09:57:00 +00:00
Eric Fiselier 4879815600 Fix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.
Summary: Also see https://llvm.org/bugs/show_bug.cgi?id=30323

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 289029
2016-12-08 07:30:01 +00:00
Eric Fiselier 900efb2f1a Fix _LIBCPP_VERSION tests with modules on Darwin
llvm-svn: 289028
2016-12-08 06:37:41 +00:00
Eric Fiselier 2c482d3f01 Revert r288787: Add missing stdbool.h module.
Reverting because I didn't properly test this patch. Although it's probably
correct to add a stdbool_h module I thought the change fixed more than it did.
I'll re-commit after more investigation.

llvm-svn: 288789
2016-12-06 09:48:32 +00:00
Eric Fiselier d9cbffb0df Add missing stdbool.h module. The test suite now passes on OS X with modules
llvm-svn: 288787
2016-12-06 09:41:50 +00:00
Eric Fiselier 4facc13108 Fix stdio module build on OS X
llvm-svn: 288778
2016-12-06 07:40:46 +00:00
Casey Carter 6da13b6b79 std::get<0>([std::variant constant expression]) *is* noexcept.
Differential review: http://reviews.llvm.org/D27436

llvm-svn: 288760
2016-12-06 02:28:19 +00:00
Eric Fiselier 25af0418da Fix C++03 modules build
llvm-svn: 288755
2016-12-06 01:34:24 +00:00
Stephan T. Lavavej d4b83e6dfd [libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 3/4.
test/std/containers/sequences/vector.bool/copy.pass.cpp
test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
Change "unsigned s = x.size();" to "typename C::size_type s = x.size();"
because that's what it returns.

test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
Include <cstddef>, then change "unsigned n = T::length(s);"
to "std::size_t n = T::length(s);" because that's what char_traits returns.

test/std/strings/basic.string/string.cons/substr.pass.cpp
Change unsigned to typename S::size_type because that's what str.size() returns.

test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
This was needlessly truncating std::size_t to unsigned.
It's being used to compare and initialize std::size_t.

llvm-svn: 288753
2016-12-06 01:14:51 +00:00
Stephan T. Lavavej f41847c401 [libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' 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
2016-12-06 01:14:43 +00:00
Stephan T. Lavavej baa547b996 [libcxx] [test] D27267: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 1/4.
Replace "int n = str_.size();" with "int n = static_cast<int>(str_.size());".

int is the correct type to use, because we're eventually calling
"base::pbump(n+1);" where base is std::basic_streambuf.
N4606 27.6.3.3.3 [streambuf.put.area]/4 declares: "void pbump(int n);"

llvm-svn: 288751
2016-12-06 01:14:29 +00:00
Stephan T. Lavavej fe4ca8c539 [libcxx] [test] D27266: Remove spurious semicolons.
llvm-svn: 288750
2016-12-06 01:14:06 +00:00
Stephan T. Lavavej e9c728899f [libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", part 12/12.
Various changes:

test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int).
static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small).

test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
This is comparing an int remote-element to size_t. The values in question are small and non-negative,
so either type is fine. I think that converting int to size_t is marginally better here than the reverse.

test/std/containers/sequences/deque/deque.cons/size.pass.cpp
DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>.

test/std/strings/basic.string/string.access/index.pass.cpp
We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>.

test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t).

"v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool.

llvm-svn: 288749
2016-12-06 01:13:51 +00:00
Stephan T. Lavavej 6859c20ac9 [libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", part 11/12.
Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances.

test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
This one's a little special, but not really. "*i == n" is comparing MoveOnly to n.
MoveOnly is implicitly constructible from int, so int is the correct type to use here.

llvm-svn: 288748
2016-12-06 01:13:40 +00:00
Stephan T. Lavavej e17a155c61 [libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", part 10/12.
Add static_cast<int>. In these cases, the values are guaranteed to be small-ish,
and they're being compared to int elements.

test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
Use int instead of unsigned to iterate from 0 to 10.

llvm-svn: 288747
2016-12-06 01:13:29 +00:00
Stephan T. Lavavej 68a694b800 [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", part 9/12.
Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.)

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 288746
2016-12-06 01:13:14 +00:00
Stephan T. Lavavej fbfb2ab63e [libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", part 8/12.
Add static_cast<std::size_t> when comparing distance() to size().

These replacements were performed programmatically with regex_replace():

const vector<pair<regex, string>> reg_fmt = {
    { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"),
        "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" },
    { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(distance($1)) == $2.size())" },
    { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" },
};

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 288745
2016-12-06 01:12:34 +00:00
Eric Fiselier 9642b36e91 Add support for writing -verify shell tests
llvm-svn: 288743
2016-12-06 01:02:15 +00:00
Eric Fiselier 8e27c2b970 Allow enabling/disabling testing with module using env LIBCXX_USE_MODULES=1
The Clang modules implementation breaks enough that libc++ needs an easy way
to enable/disable using modules on the Zorg builders. Editing Zorg itself
requires a buildmaster restart which only happens weekly. This patch
allows LIBCXX_USE_MODULES to be used to enable/disable the feature,
allowing the buildslave to disable it as need be.

llvm-svn: 288736
2016-12-06 00:01:04 +00:00
Eric Fiselier e1f72557c2 Add module definitions for <experimental/foo> headers
llvm-svn: 288735
2016-12-05 23:55:34 +00:00
Eric Fiselier ca648c9787 Add module definitions for string_view
llvm-svn: 288733
2016-12-05 23:53:23 +00:00
Eric Fiselier 392aa10811 Add modules for any/optional/variant
llvm-svn: 288730
2016-12-05 23:33:19 +00:00
Eric Fiselier daf21c3f69 Adjust libc++ test infastructure to fully support modules
This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways:

1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules.
2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled.

This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features.

NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM.
llvm-svn: 288728
2016-12-05 23:16:07 +00:00
Shoaib Meenai fc6100c195 [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
It's useful to be able to disable visibility annotations entirely; for
example, if we're building libc++ static to include in another library,
and we don't want any libc++ functions getting exported out of that
library. This is a generalization of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT.

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

llvm-svn: 288690
2016-12-05 19:40:12 +00:00
Roger Ferrer Ibanez 4cb4b36aa2 Handle tests for noexcept that expect a false value
Under libcpp-no-exceptions, noexcept is trivially true. Some tests expect in
the usual setting to return false, so adjust them to expect true under
libcpp-no-exceptions.

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

llvm-svn: 288660
2016-12-05 11:05:09 +00:00
Eric Fiselier 11b932b0d9 Update status page for variant implementation
llvm-svn: 288625
2016-12-04 22:14:53 +00:00
Eric Fiselier 02460bac8b Choose better hash values for std::monostate and valueless variants.
Previously these hashes were 0 and -1 respectively. These seem like common
sentinel values and should be avoided to prevent needless collisions.

This patch changes those values to different arbitrary numbers, which should
hopefully cause less collisions. Because I couldn't help myself I choose the
fundamental constants for gravity and the speed of light.

llvm-svn: 288623
2016-12-04 21:37:37 +00:00
Eric Fiselier 0c6d89d614 Turn off testsuite warnings by default with GCC
llvm-svn: 288576
2016-12-03 03:29:45 +00:00
Eric Fiselier 613dc646d3 Make make_exception_ptr abort with -fno-exceptions
llvm-svn: 288575
2016-12-03 03:22:11 +00:00
Eric Fiselier 9a0b4abbba Mark various <variant> items as complete
llvm-svn: 288574
2016-12-03 02:47:40 +00:00
Eric Fiselier 46fcbb4da4 Work around more -Wshadow warnings
llvm-svn: 288573
2016-12-03 02:26:28 +00:00
Eric Fiselier 63322af698 Fix <variant> w/o exception support
llvm-svn: 288571
2016-12-03 01:58:07 +00:00
Eric Fiselier f9353d89be Revert workaround for Clang bug. Thanks to Richard for the quick fix
llvm-svn: 288566
2016-12-03 01:28:01 +00:00
Eric Fiselier 572e6deeb7 Fix -Wshadow warnings and enable warnings by default for C++ >= 11
llvm-svn: 288564
2016-12-03 01:21:40 +00:00
Eric Fiselier 33f947057d XFAIL variant tests for apple-clang
llvm-svn: 288559
2016-12-03 00:33:03 +00:00
Eric Fiselier 465bd0fc00 Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
llvm-svn: 288557
2016-12-03 00:27:13 +00:00
Eric Fiselier d7a50d1d6b Work around Clang 3.8 bugs
llvm-svn: 288556
2016-12-03 00:13:33 +00:00
Eric Fiselier 5877920183 Fix C++03 build
llvm-svn: 288555
2016-12-02 23:41:18 +00:00
Eric Fiselier 918f32fc7b Make variant's index part of the hash value
llvm-svn: 288554
2016-12-02 23:38:31 +00:00
Eric Fiselier cb3ef1561d Fix generated warnings in <variant>
llvm-svn: 288552
2016-12-02 23:17:33 +00:00
Eric Fiselier c7a28dee10 Update darwin ABI list for <variant>
llvm-svn: 288551
2016-12-02 23:14:18 +00:00
Eric Fiselier aa97dee358 Update ABI lists for <variant>
llvm-svn: 288550
2016-12-02 23:11:28 +00:00
Eric Fiselier 0d3d8de014 Implement C++17 <variant>. Patch from Michael Park!
This patch was reviewed as https://reviews.llvm.org/D23263.

llvm-svn: 288547
2016-12-02 23:00:05 +00:00
Eric Fiselier 13b6cc4b08 Work around a bug in Clang's implementation of noexcept function types
llvm-svn: 288544
2016-12-02 22:30:52 +00:00
Eric Fiselier ffd5732170 Fix copy/paste errors in new variant tests
llvm-svn: 288538
2016-12-02 21:32:35 +00:00
Eric Fiselier 96be8df23e Add tests for libc++'s constexpr variant copy/move extension
llvm-svn: 288536
2016-12-02 21:17:51 +00:00
Roger Ferrer Ibanez de344ac83b Protect sequences test under libcpp-no-exceptions
Replace throw with TEST_THROW and protect tests that do throw. Also add missing assert(false).

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

llvm-svn: 288383
2016-12-01 17:36:41 +00:00
Roger Ferrer Ibanez f3fce920ff Protect futures test under libcpp-no-exceptions
Skip tests that expect an exception be thrown.

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

llvm-svn: 288382
2016-12-01 17:34:57 +00:00
Roger Ferrer Ibanez c9a8a5596f Protect optional test under libcpp-no-exceptions
Replace throw with TEST_THROW and skip tests that throw exceptions

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

llvm-svn: 288379
2016-12-01 17:33:36 +00:00