summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/language.support
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix test failures caused by new/delete calls getting optimized awayEric Fiselier2017-03-025-5/+13
| | | | llvm-svn: 296813
* Fix type_info's constructor by making it explicit again.Eric Fiselier2017-01-171-0/+14
| | | | | | | In recent changes type_info's private constructor was accidentally made implicit. This patch fixes that. llvm-svn: 292294
* Rename new_handler in tests to avoid conflicts with MSVC symbols.Eric Fiselier2017-01-177-14/+14
| | | | | | | On Windows the header new.h defines "new_handler" in the global namespace. llvm-svn: 292177
* Remove mblen(), mbtowc() and wctomb() from the thread-unsafe functions.Ed Schouten2016-12-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in r240527 I added a knob to prevent thread-unsafe functions from being exposed. mblen(), mbtowc() and wctomb() were also added to this list, as the latest issue of POSIX doesn't require these functions to be thread-safe. It turns out that the only circumstance in which these functions are not thread-safe is in case they are used in combination with state-dependent character sets (e.g., Shift-JIS). According to Austin Group Bug 708, these character sets "[...] are mostly a relic of the past and which were never supported on most POSIX systems". Though in many cases the use of these functions can be prevented by using the reentrant counterparts, they are the only functions that allow you to query whether the locale's character set is state-dependent. This means that omitting these functions removes actual functionality. Let's be a bit less pedantic and drop the guards around these functions. Links: http://austingroupbugs.net/view.php?id=708 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2037.htm Reviewed by: ericwf Differential Revision: https://reviews.llvm.org/D21436 llvm-svn: 290748
* Fix unused parameters and variablesEric Fiselier2016-12-234-4/+4
| | | | llvm-svn: 290459
* Fix more uses of dynamic exception specifications in C++17Eric Fiselier2016-12-1118-44/+79
| | | | llvm-svn: 289356
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 7/7. test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4). test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1). test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp This test is intentionally writing doubles to ostream_iterator<int>. It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC. test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float. test/std/numerics/complex.number/cmplx.over/arg.pass.cpp test/std/numerics/complex.number/cmplx.over/norm.pass.cpp These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long. Saying static_cast<double>(x) avoids this. test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index, we can just iterate with `T s`. test/std/re/re.traits/value.pass.cpp regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t (which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation. (And 100 is representable even when char has a signed range.) test/std/strings/string.view/string.view.hash/string_view.pass.cpp Add static_cast<char_type> because `'0' + i` has type int. test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2 says that pow(int, int) returns double, so this was truncating double to int. Adding static_cast<T> silences this. test/std/utilities/function.objects/unord.hash/integral.pass.cpp This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this. test/std/utilities/utility/exchange/exchange.pass.cpp First, this was exchanging 67.2 into an int, but that's inherently truncating. Changing this to static_cast<short>(67) avoids the truncation while preserving the "what if T and U are different" test coverage. Second, this was exchanging {} with the explicit type float into an int, and that's also inherently truncating. Specifying short is just as good. test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp Add static_cast<short>. Note that this affects template argument deduction for make_pair(), better fulfilling the test's intent. For example, this was saying `typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking make_pair() to return pair<int, int>, which was then being converted to pair<int, short>. (pair's converting constructors are tested elsewhere.) Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>. (There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.) Fixes D27544. llvm-svn: 289111
* [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-062-4/+6
| | | | | | | | | | 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
* Protect nested-exceptions tests under no-exceptionsRoger Ferrer Ibanez2016-11-143-3/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D26458 llvm-svn: 286813
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-043-10/+16
| | | | | | | | | | | 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 llvm-svn: 286007
* Remove spurious token from #endifRoger Ferrer Ibanez2016-11-021-1/+1
| | | | llvm-svn: 285792
* Protect tests for new/delete under libcpp-no-exceptionsRoger Ferrer Ibanez2016-11-024-5/+20
| | | | | | | | Skip the tests that expect an exception be thrown and protect unreachable catch blocks. Differential Revision: https://reviews.llvm.org/D26197 llvm-svn: 285791
* Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: ↵Roger Ferrer Ibanez2016-10-318-8/+8
| | | | | | | | | | | | | 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 llvm-svn: 285550
* Fix nullptr testsEric Fiselier2016-10-251-8/+17
| | | | llvm-svn: 285117
* Attempt to workaround XPASS for aligned allocation testsEric Fiselier2016-10-204-4/+8
| | | | llvm-svn: 284691
* Prevent new/delete replacement tests from being optimized away.Eric Fiselier2016-10-147-37/+31
| | | | llvm-svn: 284289
* Clarify XFAIL commentsEric Fiselier2016-10-142-2/+4
| | | | llvm-svn: 284282
* XFAIL aligned allocation tests for older Clang versionsEric Fiselier2016-10-148-18/+28
| | | | llvm-svn: 284214
* XFAIL aligned allocation test failures with UBSANEric Fiselier2016-10-144-9/+10
| | | | llvm-svn: 284210
* Implement P0035R4 -- Add C++17 aligned allocation functionsEric Fiselier2016-10-1411-0/+845
| | | | | | | | | | | | | | | | Summary: This patch implements the library side of P0035R4. The implementation is thanks to @rsmith. In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects. Reviewers: mclow.lists, rsmith Subscribers: rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D25591 llvm-svn: 284206
* Remove usages of _ALIGNAS_TYPEEric Fiselier2016-10-121-1/+3
| | | | llvm-svn: 283999
* Avoid applying unary minus to unsigned integers. Patch from STL@microsoft.comEric Fiselier2016-06-301-4/+4
| | | | llvm-svn: 274203
* Placate MSVC's unchecked malloc warnings.Eric Fiselier2016-06-224-5/+12
| | | | llvm-svn: 273374
* UBSan doesn't globally replace new/delete but it still makes some tests ↵Eric Fiselier2016-06-226-0/+20
| | | | | | fail. Investigation needed. llvm-svn: 273372
* Move all tests for _LIBCPP_VERSION in language.support to ↵Eric Fiselier2016-06-2215-300/+0
| | | | | | test/libcxx/language.support. llvm-svn: 273364
* Guard use of non-standard macros in denorm_min() tests.Eric Fiselier2016-06-221-0/+11
| | | | llvm-svn: 273344
* Allow placement new array test to consume extra bytes as specified by the ↵Eric Fiselier2016-06-221-4/+8
| | | | | | standard. llvm-svn: 273342
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-143-5/+11
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* Fix warnings in tests.Eric Fiselier2016-06-141-1/+1
| | | | llvm-svn: 272629
* Avoid name shadowing in test. Patch from STL@microsoft.comEric Fiselier2016-06-141-2/+2
| | | | llvm-svn: 272618
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-011-2/+2
| | | | llvm-svn: 271435
* Cleanup non-standard tests as reported by STL@microsoft.com. NFC.Eric Fiselier2016-06-011-28/+0
| | | | | | | | | | | | | | | This patch addresses the following issues in the test suite: 1. Move "std::bad_array_length" test from std/ to libcxx/ test directory since the feature is not a part of the standard. 2. Rename "futures.tas" test directory to "futures.task" since that is the correct stable name. 3. Move tests for "packaged_task<T>::result_type" from std/ to libcxx/ test directory since the typedef is a libc++ extension. llvm-svn: 271430
* [libcxx] Improve tests to use the UNSUPPORTED lit directiveAsiri Rathnayake2016-05-281-2/+1
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271108
* Void cast runtime-unused variables. Patch from STL@microsoft.comEric Fiselier2016-05-024-4/+10
| | | | llvm-svn: 268284
* Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traitsEric Fiselier2016-01-201-0/+4
| | | | llvm-svn: 258287
* [WebAssembly] Set std::numeric_limits's traps field for WebAssembly.Dan Gohman2016-01-131-1/+2
| | | | | | | WebAssembly's integer division instruction traps on division by zero; set the traps field of integral std::numeric_limits to true. llvm-svn: 257612
* Fix a corner case that involved calling rethrow_if_nested with a type that ↵Marshall Clow2015-12-141-1/+9
| | | | | | had a deleted operator&. Added a test to catch this as well. Thanks to Ville for the heads-up. llvm-svn: 255517
* Make it possible to build a no-exceptions variant of libcxx.Asiri Rathnayake2015-11-1015-0/+15
| | | | | | | | | | | | 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 llvm-svn: 252598
* Manually suppress -Wnonnull when it occurs in an unevaluated contextEric Fiselier2015-10-011-0/+6
| | | | llvm-svn: 248989
* Suppress some warnings in the tests that snuck in. That 'tmpnam' is ↵Marshall Clow2015-09-151-1/+1
| | | | | | deprecated doesn't change the fact that we have to test it. llvm-svn: 247704
* Suppress clang warnings in some testsEric Fiselier2015-08-301-4/+19
| | | | llvm-svn: 246399
* Fix a handful of tests that fail in C++03Eric Fiselier2015-07-283-5/+5
| | | | llvm-svn: 243392
* Fix warnings in test/std/language.supportEric Fiselier2015-07-188-5/+30
| | | | llvm-svn: 242624
* Cleanup tests that fail in C++1z and with Clang 3.8Eric Fiselier2015-07-172-8/+6
| | | | llvm-svn: 242581
* Mark two tests as failing on clang 3.8 (they failed on 3.7, too)Marshall Clow2015-07-162-4/+4
| | | | llvm-svn: 242375
* Make support for thread-unsafe C functions optional.Ed Schouten2015-06-242-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | One of the aspects of CloudABI is that it aims to help you write code that is thread-safe out of the box. This is very important if you want to write libraries that are easy to reuse. For CloudABI we decided to not provide the thread-unsafe functions. So far this is working out pretty well, as thread-unsafety issues are detected really early on. The following patch adds a knob to libc++, _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS, that can be set to disable thread-unsafe functions that can easily be avoided in practice. The following functions are not thread-safe: - <clocale>: locale handles should be preferred over setlocale(). - <cstdlib>: mbrlen(), mbrtowc() and wcrtomb() should be preferred over their non-restartable counterparts. - <ctime>: asctime(), ctime(), gmtime() and localtime() are not thread-safe. The first two are also deprecated by POSIX. Differential Revision: http://reviews.llvm.org/D8703 Reviewed by: marshall llvm-svn: 240527
* Implement uncaught_exceptions() using the newly added hooks in libc++abi, ↵Marshall Clow2015-06-021-0/+45
| | | | | | when available llvm-svn: 238846
* Add TODO items and remove use of 'noexcept' in C++03 test.Eric Fiselier2015-06-021-1/+1
| | | | llvm-svn: 238802
* Address @danalberts comments on r237700Eric Fiselier2015-05-192-2/+2
| | | | llvm-svn: 237740
* Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.Eric Fiselier2015-05-192-10/+4
| | | | llvm-svn: 237700
OpenPOWER on IntegriCloud