Commit Graph

69 Commits

Author SHA1 Message Date
Louis Dionne
534d2b1146 [libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0
In r368882, I enabled those tests for all AppleClang's above version 9.
However, it turns out that the feature is only supported starting with
AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 16:45:27 +00:00
Louis Dionne
5e6dc8fc98 [libc++] Mark <chrono> test as unsupported on AppleClang 9
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368914 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 20:27:56 +00:00
Louis Dionne
c31d5a4ef3 [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up
AppleClang supports those literals starting in version 10.0.1.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:04:31 +00:00
Louis Dionne
72109f5b3e [libc++] Mark two <chrono> tests as unsupported on AppleClang 11
The operator""y and operator""d will eventually be supported by
AppleClang, but no released version supports them at the moment.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368749 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 21:34:49 +00:00
Marshall Clow
a6ac321f01 Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08 14:36:07 +00:00
Marshall Clow
4bd3f7d588 Fix a bug in std::chrono::abs where it would fail when the duration's period had not been reduced.s
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367120 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-26 15:10:46 +00:00
Marshall Clow
ce2a5ab4c4 Implement change #4 of P1466: Change weekday to accept both 0 and 7 as Sunday. Add accessors 'c_encoding' and 'iso_encoding' to provide different interpretations of the weekday. Remove 'operator unsigned'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366981 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-25 03:26:05 +00:00
Marshall Clow
a5a011702c Add tests for LWG 3206. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363589 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-17 18:06:30 +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
Marshall Clow
eec31ce77c Fix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks to Zulan for the report, and Howard for the direction of the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357410 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-01 16:38:02 +00:00
Louis Dionne
4ff4db7f84 [libc++] Remove unnecessary <iostream> #includes in tests
Some tests #include <iostream> but they don't use anything from the
header. Those are probably artifacts of when the tests were developped.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357181 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 16:38:15 +00:00
Louis Dionne
0ec48a9e30 [libc++] Remove too-stringent XFAILs for file_clock tests
Those tests actually pass because we don't use anything that's marked
as unavailable.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356719 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 21:07:33 +00:00
Louis Dionne
080f06df54 [libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas
Summary:
Also add the corresponding XFAILs to tests that require filesystem.
The approach taken to mark <filesystem> as unavailable in this patch
is to mark all the header as unavailable using #pragma clang attribute.
Marking each declaration using the attribute is more intrusive and
does not provide a lot of value right now because pretty much everything
in <filesystem> requires dylib support, often transitively.

This is an alternative to https://reviews.llvm.org/D59093.
A similar (but partial) patch was already applied in r356558.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356616 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 21:18:14 +00:00
Louis Dionne
51ecd6cd07 [libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.

This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356558 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 14:34:00 +00:00
Louis Dionne
2fa9a05abf [libc++] Flag file_clock test as expected to fail with ASAN
This silences a known issue, as can be seen by looking at similar
tests for other clocks, like time.clock.steady/consistency.pass.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356528 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 21:53:32 +00:00
Louis Dionne
3b886a1ce8 [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Unlike the previous attempt (r356500), this doesn't remove all the
filesystem tests.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356518 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 20:56:13 +00:00
Louis Dionne
e76d13a487 Revert "[libc++] Build <filesystem> support as part of the dylib"
When I applied r356500 (https://reviews.llvm.org/D59152), I somehow
deleted all of filesystem's tests. I will revert r356500 and re-apply
it properly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356505 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:27:29 +00:00
Louis Dionne
582679a3fe [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356500 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:09:33 +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
ef48e7bcce Don't use the form '2017y' in tests, since some gcc versions don't allow it
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350930 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-11 15:45:56 +00:00
Marshall Clow
8d42566e70 Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350929 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-11 15:12:04 +00:00
Eric Fiselier
350f501ab7 Mark two UDL tests as being unsupported with Clang 7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350739 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 16:34:17 +00:00
Marshall Clow
7de83dce41 De-tab a couple tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350330 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 17:18:40 +00:00
Eric Fiselier
fdb4802a74 Fix copy paste error in file_clock tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 04:27:45 +00:00
Eric Fiselier
874280d14d Implement LWG 3145: file_clock breaks ABI for C++17 implementations.
This patch adds std::chrono::file_clock, but without breaking the
existing ABI for std::filesystem.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349883 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:54:57 +00:00
Eric Fiselier
dfa283e2cf Fix FP comparisons when SSE isn't available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349387 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 20:17:43 +00:00
Michal Gorny
36feb1b037 [test] [ctime] Ignore -Wformat-zero-length warnings
Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349294 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-16 09:18:31 +00:00
Louis Dionne
55a56d2370 [libcxx] Fix incorrect XFAILs for chrono tests on old macos deployment targets
The tests were marked to fail based on the 'availability' LIT feature.
However, those tests should really only be failing when we run them
against the dylibs that were deployed on macosx10.7 and macosx10.8,
which the deployment target has nothing to do with.

This caused the tests to unexpectedly pass when running the tests
with deployment target macosx10.{7,8} but running with a recent dylib.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348520 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 19:24:20 +00:00
Eric Fiselier
c2c6c1de6b Get tests compiling with -Wunused-local-typedef
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346914 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-15 00:11:02 +00:00
Stephan T. Lavavej
439de45011 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 03:06:06 +00:00
Marshall Clow
98d4ace735 Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 17:22:41 +00:00
Mikhail Maltsev
0423faff95 Adjust unsupported C++ versions in some tests
Summary:
Some tests (mainly the new C++20 calendar library) fail when libc++ is
tested with '--param=std=c++98'. The failures happen because the tests
actually don't support C++98, but don't mention C++98 in the
'UNSUPPORTED:' line.

This change fixes the issue.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: arphaman, michaelplatings, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345148 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 15:09:08 +00:00
Louis Dionne
4104ebe22a [libcxx] Mark chrono literal unit tests as being unsupported on AppleClang 10
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-17 00:34:13 +00:00
Marshall Clow
cc5c12d9de Recommit <chrono> changes with a couple xtra tests marked to fail on apple's clang. Reviewed as D51762
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344627 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 17:27:54 +00:00
Artem Dergachev
7f20dc6854 Revert r344529 "Implement the first part of the calendar support for C++20"
Revert r344535 "Wrap up the new chrono literals in an #ifdef..."
Revert r344546 "Mark a couple of test cases as 'C++17-only'..."

Some of the buildbot failures were masked by another error,
and this one was probably missed.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-16 02:40:42 +00:00
Marshall Clow
1b8e200470 Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344535 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 17:33:20 +00:00
Marshall Clow
fc25eebcac Implement the first part of the calendar support for C++20. This is still incomplete; there will be more patches coming. Reviewed as D51762
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 16:06:37 +00:00
Marshall Clow
8220dac54c Last week, someone noted that a couple of the time_point member functions were not constexpr. I looked, and they were right. They were made constexpr in p0505, so I looked at all the other bits in that paper to make sure that I didn't miss anything else. There were a couple methods in the synopsis that should have been marked constexpr, but the code was correct.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340992 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 23:02:15 +00:00
Marshall Clow
43d7c79aae Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339816 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 21:19:08 +00:00
Marshall Clow
8a16d40991 import timespec and timespec_get into namespace std if we're under c++17 or later AND the underlying C library has them. Fixes PR#38220, but doesn't implement all of P0063 yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 19:25:00 +00:00
Stephan T. Lavavej
302557b724 [libcxx] [test] Rename _Tp to T. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 20:53:53 +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
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
d311b3c55a Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the utilities library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300635 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 00:56:32 +00:00
Marshall Clow
6b6874c8e2 Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298422 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 19:12:21 +00:00
Marshall Clow
6ccca38d07 Add a bit more to one of the chrono tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298418 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 18:40:46 +00:00
Marshall Clow
cf6e0db0b9 Implement P0548: 'common_type and duration' This involves a subtle change in the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will notice.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 18:38:57 +00:00
Mehdi Amini
e807cbcd5b Add deployment knobs to tests (for Apple platforms)
The tests for libc++ specify -target on the command-line to the
compiler, but this is problematic for a few reasons.

Firstly, the -target option isn't supported on Apple platforms. Parts
of the triple get dropped and ignored. Instead, software should be
compiled with a combination of the -arch and -m<name>-version-min
options.

Secondly, the generic "darwin" target references a kernel version
instead of a platform version. Each platform has its own independent
versions (with different versions of libc++.1.dylib), independent of the
version of the Darwin kernel.

This commit adds support to the LIT infrastructure for testing against
Apple platforms using -arch and -platform options.

If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC.
If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC.
If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>].
By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx".
If the platform doesn't have a version:
For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts.
Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path.
-arch <arch> -m<name>-version-min=<version> is added to the compiler flags.
The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>).
For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features.
There were a number of tests marked to XFAIL on x86_64-apple-darwin11
and x86_64-apple-darwin12. I updated these to
x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 00:59:54 +00:00
Stephan T. Lavavej
51eb1be9ec [libcxx] [test] Strip trailing whitespace. NFC, no code review.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 01:12:15 +00:00