Commit Graph

70 Commits

Author SHA1 Message Date
Nico Weber
28db4445e2 libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:12 +00:00
Louis Dionne
e2586fd18f [libcxx] Rejigger test for destroying delete feature-test macros
In r361572, we introduced library support for C++20 destroying delete
and decided to only define the library feature-test macro when the
compiler supports the underlying language feature. This patch reworks
the tests to mirror that.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366263 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 21:13:40 +00:00
Eric Fiselier
6507e2af11 Mark destroying delete test as UNSUPPORTED with clang 7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365856 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 01:16:08 +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
Eric Fiselier
bfea7307ae fix test for older clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361594 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 03:15:32 +00:00
Eric Fiselier
57436c8125 fix destroying delete test with older apple compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361593 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 02:46:34 +00:00
Eric Fiselier
087c094fec P0722R3: Implement library support for destroying delete
Summary:
This provides the `std::destroying_delete_t` declaration in C++2a and after. (Even when the compiler doesn't support the language feature).

However, the feature test macro `__cpp_lib_destroying_delete` is only defined when we have both language support and  C++2a.


Reviewers: ldionne, ckennelly, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: dexonsmith, riccibruno, christof, jwakely, jdoerfert, mclow.lists, ldionne, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361572 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 23:46:44 +00:00
Billy Robert O'Neal III
3fd12d449b [libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]."
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356635 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 00:24:43 +00:00
Billy Robert O'Neal III
82e238eecb [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
This allows these tests to pass when compiled by MSVC++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356632 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 23:58:46 +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
Eric Fiselier
c6fd2de6a1 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351670 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-20 01:21:35 +00:00
Eric Fiselier
d162d3fe47 Revert "Fix aligned allocation availability XFAILs after D56445."
This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351669 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-20 01:12:53 +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
Eric Fiselier
14072788a3 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351625 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 03:27:05 +00:00
Eric Fiselier
50f14e23b5 Unbreak green dragon bots w/o __builtin_launder
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349373 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 18:37:59 +00:00
Eric Fiselier
2d0643acea Expect Clang diagnostics in std::launder test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349364 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 16:56:24 +00:00
Louis Dionne
f01e82fd42 [libcxx] Remove the availability_markup LIT feature
It is now equivalent to the 'availability' LIT feature, so there's no
reason to keep both.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348653 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-07 21:48:39 +00:00
Louis Dionne
7ea279fbed [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9
Some people are still running the test suite using AppleClang 9.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348507 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 18:06:47 +00:00
Louis Dionne
893cf80335 [libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347585 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-26 19:30:08 +00:00
Louis Dionne
739fdd4850 [NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347367 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 00:03:17 +00:00
Louis Dionne
a1b4766c47 [libcxx] Fix XFAILs for aligned allocation tests on older OSX versions
Summary:
Since r338934, Clang emits an error when aligned allocation functions are
used in conjunction with a system libc++ dylib that does not support those
functions. This causes some tests to fail when testing against older libc++
dylibs. This commit marks those tests as UNSUPPORTED, and also documents the
various reasons for the tests being unsupported.

Reviewers: vsapsai, EricWF

Subscribers: christof, dexonsmith, cfe-commits, mclow.lists, EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 00:30:03 +00:00
Stephan T. Lavavej
c538ab0daa [libcxx] [test] Fix whitespace, NFC.
test/std almost always uses spaces; now it is entirely tab-free.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329978 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:22 +00:00
Eric Fiselier
b06c8f07b2 Use DoNotOptimize to prevent new/delete elision.
The new/delete tests, in particular those which test replacement
functions, often fail when the optimizer is enabled because the
calls to new/delete may be optimized away, regardless of their side-effects.

This patch converts the tests to use DoNotOptimize in order to prevent
the elision.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328245 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22 21:28:09 +00:00
Eric Fiselier
457d2c157b Fix most GCC test failures.
This patch fixes almost all currently failing tests when
using GCC ToT.

The specific changes are:

(A) Workaround gcc.gnu.org/PR83921 which rejects variables w/o initializers
in constexpr contexts -- even when the variable is an empty class. This
bug has been worked around at all callsites by adding an initializer.
Additionally a new test, constexpr_init.pass.cpp, has been added to
test that Clang doesn't suffer from these bugs.

(B) Fix streambuf.assign/swap.pass.cpp. This test was never actually
calling the swap method as intended. In fact, the swap function it
intended to call was ill-formed when instantiated. GCC diagnosed
this ill-formedness w/o needing an instantiation.

(C) size_delete11.pass.cpp was fixed by adding c++2a to the list of
unsupported dialects.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 03:41:06 +00:00
Eric Fiselier
74cb4f5f46 Fix nodiscard failure tests on compilers w/o -verify.
Previously .fail.cpp tests for nodiscard were run with -Wunused-result
being a warning, not an error, when the compiler didn't support -verify.

When -verify isn't enabled this change judiciously adds -Werror=unused-result
when to only the failure tests containing the // expected-error string for nodiscard.

As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to
a test which was only supposed to run in C++ <= 11.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322776 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-17 22:48:09 +00:00
Marshall Clow
94ab5eb370 Commit tests for changes in revision 319710
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 23:04:53 +00:00
Marshall Clow
aa0e236289 Implement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22 19:49:03 +00:00
Casey Carter
3fdfbbfe34 [test] Alignment must be > __STDCPP_DEFAULT_NEW_ALIGNMENT__ to call aligned new
Differential Revision: D39221

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318325 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 19:14:45 +00:00
Eric Fiselier
6efb1c19a7 Change test suite to support c++17 dialect flag instead of c++1z.
This patch changes the test suite to attempt and prefer -std=c++17 over
-std=c++1z. It also fixes the REQUIRES and UNSUPPORTED lit markers
to refer to c++17 over c++1z.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@317610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07 20:20:58 +00:00
Shoaib Meenai
18dba06924 [libc++] Support Microsoft ABI without vcruntime headers
The vcruntime headers are hairy and clash with both libc++ headers
themselves and other libraries. libc++ normally deals with the clashes
by deferring to the vcruntime headers and silencing its own definitions,
but for clients which don't want to depend on vcruntime headers, it's
desirable to support the opposite, i.e. have libc++ provide its own
definitions.

Certain operator new/delete replacement scenarios are not currently
supported in this mode, which requires some tests to be marked XFAIL.
The added documentation has more details.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09 19:25:17 +00:00
Stephan T. Lavavej
5d91f314f1 [libcxx] [test] Change comments to say C++ instead of c++. NFC.
This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +00:00
Stephan T. Lavavej
25072f0004 [libcxx] [test] Make files consistently end with newlines, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:22 +00:00
Akira Hatanaka
c5247b417b Revert "[libcxx] Annotate c++17 aligned new/delete operators with availability"
This reverts commit r306310.

r306310 causes clang to reject a call to an aligned allocation or
deallocation function if it is not implemented in the standard library
of the deployment target. This is not the desired behavior when users
have defined their own aligned functions.

rdar://problem/32664169

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 18:50:23 +00:00
Akira Hatanaka
a028f3c8d9 [libcxx] Annotate c++17 aligned new/delete operators with availability
attribute.

This is needed because older versions of libc++ do not have these
operators. If users target an older deployment target and try to compile
programs in which these operators are explicitly called, the compiler
will complain.

The following is the list of minimum deployment targets for the four
OSes:

macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0

rdar://problem/32664169

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306310 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 17:39:48 +00:00
Eric Fiselier
9197008809 Fix GCC 7 test failures.
This patch fixes the test failures and unexpected passes that occur
when testing against GCC 7. Specifically:

* don't mark __gcd as always inline because it's a recursive function. GCC diagnoses this.
* don't XFAIL the aligned allocation tests. GCC 7 supports them but not the -faligned-allocation option.
* Work around gcc.gnu.org/PR78489 in variants constructors.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-09 00:00:00 +00:00
Eric Fiselier
8fb888ad45 Temporarly XFAIL aligned new/delete tests on Windows.
Libc++ doesn't provide its own definitions of new/delete on Windows,
instead using the versions provided by VCRuntime. However VCRuntime
does not yet implement aligned new/delete so these tests fail.

It might be possible for libc++ to provide its own definitions only
for aligned new/delete as long as MSVC doesn't provide it. However
before this can be done libc++ needs to figure out how to implement
std::get_new_handler.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-07 22:10:56 +00:00
Mehdi Amini
907c1196a7 Add markup for libc++ dylib availability
Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 17:08:54 +00:00
Eric Fiselier
f282bc8767 Fix test failures caused by new/delete calls getting optimized away
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 21:16:35 +00:00
Eric Fiselier
ebb9839230 Rename new_handler in tests to avoid conflicts with MSVC symbols.
On Windows the header new.h defines "new_handler" in the global
namespace.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 00:32:08 +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
Eric Fiselier
e5bca2ba66 Fix more uses of dynamic exception specifications in C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289356 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 02:47:36 +00:00
Roger Ferrer Ibanez
aa138aa2a4 Remove spurious token from #endif
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 08:36:43 +00:00
Roger Ferrer Ibanez
a405f45fcd Protect tests for new/delete under libcpp-no-exceptions
Skip the tests that expect an exception be thrown and protect unreachable catch blocks.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285791 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 08:14:57 +00:00
Eric Fiselier
6d36efa497 Attempt to workaround XPASS for aligned allocation tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284691 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 03:31:07 +00:00
Eric Fiselier
9ffd1d56b4 Prevent new/delete replacement tests from being optimized away.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284289 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 22:47:08 +00:00
Eric Fiselier
e630058e90 Clarify XFAIL comments
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 21:30:35 +00:00
Eric Fiselier
f172df1f43 XFAIL aligned allocation tests for older Clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284214 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 08:47:09 +00:00
Eric Fiselier
34c6b805cf XFAIL aligned allocation test failures with UBSAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 07:49:15 +00:00
Eric Fiselier
9acbffa370 Implement P0035R4 -- Add C++17 aligned allocation functions
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 06:46:30 +00:00
Eric Fiselier
7d4a984cea Placate MSVC's unchecked malloc warnings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273374 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 04:23:54 +00:00