Commit Graph

35 Commits

Author SHA1 Message Date
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
Louis Dionne
21c042e77e [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354940 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:57:57 +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
Marshall Clow
64c10d00c3 Implement LWG 2946, 3075 and 3076. Reviewed as https://reviews.llvm.org/D48616
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336132 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 18:41:15 +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
Marshall Clow
088e6015b2 Fix PR#31454 - 'basic_string<T>::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. This may be an ABI change (change the size of) strings of very large 'characters', but since they never worked, I'm not too concerned.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:30:17 +00:00
Marshall Clow
cd64646026 Ooops. I checked in a test for a bug I haven't fixed yet. Temporrarily commented it out.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 20:46:38 +00:00
Marshall Clow
46b4ad5400 Implement P0457R2: 'String Prefix and Suffix Checking' for c++2a
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 20:11:38 +00:00
Stephan T. Lavavej
a2f0b51b9a [libcxx] [test] Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314258 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 23:08:41 +00:00
Marshall Clow
e942bb000f Add more string_view tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 02:46:09 +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
Billy Robert O'Neal III
90c1331825 Add asserts that the nullptr is maintained in string erase operations.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 19:01:14 +00:00
Eric Fiselier
3e92897754 Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the string library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 00:28:44 +00:00
Eric Fiselier
622c7d5846 Fix PR32642 - string::insert and string::append don't work with move_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 06:49:02 +00:00
Eric Fiselier
778ec30428 Work around test failure on 32 bit OS X
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 23:18:40 +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
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
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
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
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
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
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
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
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
Marshall Clow
7ed093bde7 Implement LWG#2063, and update the issues links to point to the github generated pages
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 16:17:34 +00:00
Marshall Clow
6b913d7c52 Walter Brown sent a list of tests which needed 'additional includes' to match what was in the standard. Added these includes to the tests. No changes to the library or test results.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225541 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 20:25:52 +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