Commit Graph

66 Commits

Author SHA1 Message Date
Roger Ferrer Ibanez
d3584d51a2 Reverting wrong diff
I managed to confuse me with two reviews of the same thing and ended commiting the wrong one.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287868 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 11:28:02 +00:00
Roger Ferrer Ibanez
37a0d7cb33 Protect std::string tests under libcpp-no-exceptions
Skip tests that expect an exception be thrown and/or disable
unreachable catch handlers.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287865 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 11:15:09 +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
Stephan T. Lavavej
bdf8bae8bb [libcxx] [test] D27018: Fix MSVC warning C4018 "signed/unsigned mismatch", part 5/12.
Various changes:

test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
Change M from unsigned to int. It's compared against "int x",
and we binary_search() for it within a vector<int>.

test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
Add static_cast<unsigned> when comparing int to unsigned.

test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
Change unsigned indices to int when we're being given int as a bound.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287825 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:02:35 +00:00
Marshall Clow
49721a90e5 Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286932 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 05:03:22 +00:00
Marshall Clow
a4163bce6a Missed a test with exceptions disabled earlier. Oops.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 20:38:43 +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
Stephan T. Lavavej
45e692539c [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but not referenced".
test/std/depr/depr.c.headers/inttypes_h.pass.cpp
test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
test/std/input.output/iostream.forward/iosfwd.pass.cpp
Add test() to avoid a bunch of void-casts, although we still need a few.

test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below).

test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
When retrieving facets, the references are unused.

test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
"std::ios_base::iostate err = ios.goodbit;" was completely unused here.

test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
test/std/numerics/c.math/ctgmath.pass.cpp
test/std/numerics/rand/rand.device/entropy.pass.cpp
test/std/numerics/rand/rand.device/eval.pass.cpp
test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
test/std/thread/futures/futures.promise/dtor.pass.cpp
test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
These variables are verifying types but are otherwise unused.

test/std/strings/basic.string/string.capacity/reserve.pass.cpp
old_cap was unused (it's unclear to me whether it was intended to be used).

test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
These tests contained unused characters.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286847 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 17:35:14 +00:00
Roger Ferrer Ibanez
bc464e50e9 Update tests for strings conversions under libcpp-no-exceptions
Differential Revision: https://reviews.llvm.org/D26139



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 10:44:26 +00:00
Stephan T. Lavavej
e619862dbf [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04 20:26:59 +00:00
Roger Ferrer Ibanez
c09116009c Protect exceptional paths under libcpp-no-exceptions
These tests are of the form

try {
   action-that-may-throw
   assert(!exceptional-condition)
   assert(some-other-facts)
 } catch (relevant-exception) {
   assert(exceptional-condition)
 }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false. When exception are supported make sure that a true
exceptional-condition throws an exception

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-01 15:46:16 +00:00
Roger Ferrer Ibanez
efc9f170c9 Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else
This is a follow up of D24562.

These tests do not check anything but exceptions, so it makes sense to mark
them as UNSUPPORTED under a library built without exceptions.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-31 08:47:53 +00:00
Eric Fiselier
eb6b13f578 Fix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.
This prevent the symbols from being both externally available and hidden, which
causes them to be linked incorrectly. This is only a problem when the address
of the function is explicitly taken since it will always be inlined otherwise.

This patch fixes the issues that caused r285456 to be reverted, and can
now be reapplied.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285531 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-31 02:07:23 +00:00
Eric Fiselier
04b7f3da2b Add missing include in string_view tests. Patch from Billy ONeil @ microsoft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285012 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 20:11:17 +00:00
Eric Fiselier
44543930e4 Fix shadow warnings in string_view tests. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 20:10:00 +00:00
Marshall Clow
6f5d5948ef Add another append test for basic_string
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 15:47:13 +00:00
Marshall Clow
1277962876 Fix a few static_asserts that need extra parens on -03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 23:52:21 +00:00
Marshall Clow
6ac8de0976 Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282342 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 22:45:42 +00:00
Marshall Clow
ac655ef742 Fix PR#30303 - no matching function for call to '__ptr_in_range'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280779 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 03:32:06 +00:00
Marshall Clow
d979eed766 Fix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-05 01:54:30 +00:00
Marshall Clow
d4badbbc5a Support allocators with explicit conversion constructors. Fixes bug #29000
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 05:58:40 +00:00
Eric Fiselier
775417d97c Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:50:32 +00:00
Eric Fiselier
f4a698aa30 Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.
See D21820 for more information (https://reviews.llvm.org/D21820).



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:15:29 +00:00
Marshall Clow
7c56f99282 Again, w/o the tabs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 13:19:36 +00:00
Marshall Clow
f82c1cef1d Another fix to appease the no-exception bots.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 13:18:50 +00:00
Marshall Clow
15362334f6 Fix some string_view tests that were failing when exceptions were disabled. Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 06:24:04 +00:00
Marshall Clow
1e00d6db31 Implement std::string_view as described in http://wg21.link/P0254R1. Reviewed as https://reviews.llvm.org/D21459
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276238 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 05:31:24 +00:00
Eric Fiselier
67ec8a281b Move more _LIBCPP_VERSION tests to test/libcxx.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:07:26 +00:00
Eric Fiselier
03dacbe87a Fix comment typos, strip trailing whitespace. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 01:23:51 +00:00
Eric Fiselier
d24c465bea Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable.
Patch from STL@microsoft.com. Thanks STL!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:31:42 +00:00
Marshall Clow
10b452646a Remove arithmetic +/-127 on chars; results in UB when dealing with signed chars. Thanks to STL@microsoft for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271897 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 14:35:22 +00:00
Eric Fiselier
84acb1ec3f Remove trailing whitespace in test suite. Approved by Marshall Clow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 21:35:39 +00:00
Asiri Rathnayake
a3eac518e6 [libcxx] Improve tests to use the UNSUPPORTED lit directive
Quite a few libcxx tests seem to follow the format:
 #if _LIBCPP_STD_VER > X
   // Do test.
 #else
   // Empty test.
 #endif
We should instead use the UNSUPPORTED lit directive to exclude the test on
earlier C++ standards. This gives us a more accurate number of test passes
for those standards and avoids unnecessary conflicts with other lit
directives on the same tests.

Reviewers: bcraig, ericwf, mclow.lists

Differential revision: http://reviews.llvm.org/D20730

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 08:57:35 +00:00
Eric Fiselier
a9ea11398d Void cast runtime-unused variables. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 19:15:48 +00:00
Eric Fiselier
a7a9004024 Fix test failures by adding missing include
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 04:18:13 +00:00
Eric Fiselier
1e5a4a4a71 Fix or move various non-standard tests.
This patch does the following:

* Remove <__config> includes from some container tests.
* Guards uses of std::launch::any in async tests because it's an extension.
* Move "test/std/extensions" to "test/libcxx/extensions"
* Moves various non-standard tests including those in "sequences/vector",
  "std/localization" and "utilities/meta".


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 04:07:45 +00:00
Eric Fiselier
375e2f669c Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 22:28:23 +00:00
Marshall Clow
f4f7d8fc96 Recommit r263036 with additional inlining, so that it will continue to work with existing system dylibs. Implements LWG#2583
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@265706 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 18:13:41 +00:00
Nico Weber
fadd1db573 Revert r263036, it's ABI-breaking.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263246 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 15:26:06 +00:00
Marshall Clow
f40ec90389 Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assign
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263042 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-09 18:08:29 +00:00
Marshall Clow
ff0b9f5749 Implement LWG#2583: There is no way to supply an allocator for basic_string(str, pos)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263036 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-09 17:51:43 +00:00
Marshall Clow
ee208ca378 Remove a couple tabs that crept in
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@262932 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 15:45:06 +00:00
Marshall Clow
f532a70b63 Implement P0272R1: Give 'std::string' a non-const '.data()' member function
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@262931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 15:44:30 +00:00
Richard Smith
b4aa97130b Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
<string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
provide a const-correct overload set even when the underlying C library does
not.

This change adds a new macro, _LIBCPP_PREFERRED_OVERLOAD, which (if defined)
specifies that a given overload is a better match than an otherwise equally
good function declaration without the overload. This is implemented in modern
versions of Clang via __attribute__((enable_if)), and not elsewhere.

We use this new macro to define overloads in the global namespace for these
functions that displace the overloads provided by the C library, unless we
believe the C library is already providing the correct signatures.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 00:59:02 +00:00
Marshall Clow
f90978aa1a More string fixes for noexcept cases. Apparently I didn't get them all in r258281.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 05:41:24 +00:00
Marshall Clow
85d4c2a93f Fix up the tests I added for string exceptions to be skipped when exceptions are disabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 03:19:15 +00:00
Marshall Clow
df9db31c27 Fix PR#25973 : 'basic_string::assign(InputIt, InputIt) doesn't provide the strong exception safety guarantee'. This turned out to be a pervasive problem in <string>, which required a fair amount of rework. Add in an optimization for when iterators provide noexcept increment/comparison/assignment/dereference (which covers many of the iterators in libc++). Reviewed as http://reviews.llvm.org/D15862
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@257682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 21:54:34 +00:00
Marshall Clow
14ba0ad689 Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@254119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-26 01:24:04 +00:00
Asiri Rathnayake
cc2e93cff0 Make it possible to build a no-exceptions variant of libcxx.
Fixes a small omission in libcxx that prevents libcxx being built when
-DLIBCXX_ENABLE_EXCEPTIONS=0 is specified.

This patch adds XFAILS to all those tests that are currently failing
on the new -fno-exceptions library variant. Follow-up patches will
update the tests (progressively) to cope with the new library variant.

Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 11:41:22 +00:00
Richard Smith
ceeace9a60 Split <ctype.h> out of <cctype>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 20:36:30 +00:00