Commit Graph

3735 Commits

Author SHA1 Message Date
Saleem Abdulrasool 3444e9fa15 config: disable thread safety analysis on COFF
clang cannot properly handle __declspec and __attribute__ on classes
right now.  This prevents the shared_mutex tests from working.  Disable
the use of the annotation on COFF targets.

llvm-svn: 294958
2017-02-13 15:26:51 +00:00
Saleem Abdulrasool 8a5789ebd1 math: actually pull the declarations/overloads into std
The previous changes missed the change to include/cmath.  These changes
allow some of the rand.distribution tests to pass on Windows.

llvm-svn: 294957
2017-02-13 15:26:50 +00:00
Saleem Abdulrasool 4715d12345 test: mark another test as requiring pthreads
This is checking pthread specific behaviour.  Add a requirement on
pthreads.

llvm-svn: 294956
2017-02-13 15:26:47 +00:00
Saleem Abdulrasool ce5ce02604 math: follow up to SVN r294902
Pull in the math functions from ucrt 14+ after auditing the library.  It
seems that they are now complete for C99 math.  Fixes more windows
tests!

llvm-svn: 294918
2017-02-12 21:42:37 +00:00
Saleem Abdulrasool b2684a52c6 test: use char32_t rather than wchar_t
wchar_t is not as portable as char32_t.  On Windows, wchar_t is
16-bytes and on Linux 32-bits.  The conversion to utf8 causes the
characters to exceed the limits on char16_t, resulting in tautological
comparisons.

llvm-svn: 294917
2017-02-12 21:42:35 +00:00
Saleem Abdulrasool 633c3b0756 test: mark requirement for pthread test
This test explicitly is checking the behaviour of std::thread and
pthread interactions.  This requires pthreads.  Add an appropriate
requirement.

llvm-svn: 294903
2017-02-12 17:37:48 +00:00
Saleem Abdulrasool 2fe5658d9a math: pull more C functions from std
The newer ucrt version provides the gamma meth routines.  Includede them
when building the library.

llvm-svn: 294902
2017-02-12 17:37:45 +00:00
Saleem Abdulrasool 0d467ff53f test: squelch -Wreturn-type error
Add an unreachable marker to avoid a -Wreturn-type error when building
on Windows.

llvm-svn: 294901
2017-02-12 17:37:44 +00:00
Saleem Abdulrasool a24d7dff09 cmath: adjust math forwards for Windows
The newer versions of ucrt have the math routines.  Use the CRT version
to determine if we should include the math routines.  Fixes two tests
for Windows.

llvm-svn: 294899
2017-02-12 16:44:17 +00:00
Ed Schouten 252da3b3b4 Remove a now unneeded __CloudABI__ check.
CloudABI has gained the setlocale() function in the meantime, meaning
there is no longer a need to conditionalize this.

llvm-svn: 294833
2017-02-11 08:33:16 +00:00
Ed Schouten de5669e46c Fix the build of thread.cpp on CloudABI.
CloudABI does provide unistd.h, but doesn't define __unix__. We need to
include this header file to make hardware_concurrency work.

llvm-svn: 294832
2017-02-11 08:30:18 +00:00
Marshall Clow 3bc2e08429 Fix a bug I introduced in the tests for experimental::lcm and experimental::gcd.
llvm-svn: 294798
2017-02-10 22:44:14 +00:00
Marshall Clow 58fc1b50d8 Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.
llvm-svn: 294779
2017-02-10 20:49:08 +00:00
Eric Fiselier 2279ee3144 Fix yet another Apple buildit bug
llvm-svn: 294732
2017-02-10 09:25:15 +00:00
Eric Fiselier 637160c55a Attempt to fix Apple buildit bots
llvm-svn: 294731
2017-02-10 09:16:29 +00:00
Eric Fiselier d22c9dc422 Recommit "Split exception.cpp and new.cpp implementation into different files for different runtimes."
This recommits r294707 with additional fixes. The main difference is
libc++ now correctly builds without any ABI library.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294730
2017-02-10 08:57:35 +00:00
Eric Fiselier 8dcdeaeb35 Revert "Split exception.cpp and new.cpp implementation into different files for different runtimes."
The compiler-rt CMake configuration needs some tweaking before this can land.

llvm-svn: 294727
2017-02-10 07:43:08 +00:00
Eric Fiselier 328bcc5e2b Properly escape ShellTest subsitutions on Windows. Try 2
llvm-svn: 294721
2017-02-10 06:59:07 +00:00
Saleem Abdulrasool 738a3f97a6 test: XFAIL windows for non-portable test
This test validates that the lock_guard is declared variadically across
C++03 and C++11.  Given the lack of stable ABI on Windows and the fact
that the RTTI encoding on Windows is different, XFAIL it on that target.

llvm-svn: 294720
2017-02-10 06:51:21 +00:00
Saleem Abdulrasool a7c72894f8 test: fix test under Windows
When running the test under clang-cl, we do not report `__GNUC__`, which
is needed to supress the warnings which are being treated as errors.

llvm-svn: 294719
2017-02-10 06:51:19 +00:00
Eric Fiselier 7b9da0c480 properly escape compiler path in .sh.cpp tests
llvm-svn: 294718
2017-02-10 06:38:02 +00:00
Saleem Abdulrasool d7bd094716 test: allow -target usage on Windows
When running the tests on Windows with a debug build, _DEBUG must be
added to the flags prior to the -target as the forced inclusion of a
header will prevent the compile test for the flag to fail.

llvm-svn: 294716
2017-02-10 06:24:34 +00:00
Eric Fiselier 7f15e08ca1 Correctly default to using the system libc++abi on Apple.
This patch fixes a regression where libc++ didn't correctly
select the system libc++abi when no in-tree version was found.

llvm-svn: 294712
2017-02-10 05:07:03 +00:00
Eric Fiselier def60acdf5 Split exception.cpp and new.cpp implementation into different files for different runtimes.
exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294707
2017-02-10 04:25:33 +00:00
Saleem Abdulrasool fb9ae0e3fe docs: add some documentation for building on Windows
This covers how to build libc++ for Windows.  This allows others to
replicate the MS ABI style build for libc++.  It only depends on msvcrt
as it uses the Windows threading model and the Windows ABI and can serve
as an ABI compatible replacement for msvcprt.

llvm-svn: 294705
2017-02-10 03:58:20 +00:00
Eric Fiselier 5955cbd5dd Attempt to fix finding clang++ on Windows
llvm-svn: 294699
2017-02-10 03:20:02 +00:00
Saleem Abdulrasool 9e08f9a9ad __threading_support: fix windows build
The build was broken as there was no overload for long and
std::chrono::nanoseconds.  Add an explicit conversion to use the
operator+.

llvm-svn: 294698
2017-02-10 02:49:52 +00:00
Mehdi Amini 48b4b04700 Fully qualify (preprend ::) calls to math functions from libc
Summary:
This can cause a compile failure in cases like:

double log(double);
namespace foo {
  namespace log {}
}
using namespace foo;
void bar(int i) {
  log((double)i);
}

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 294696
2017-02-10 02:44:23 +00:00
David L. Jones 4b22736222 Check for musl-libc's max_align_t in addition to other variants.
Summary:
Libcxx will define its own max_align_t when it is not available. However, the
availability checks today only check for Clang's definition and GCC's
definition. In particular, it does not check for musl's definition, which is the
same as GCC's but guarded with a different macro.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: chandlerc, cfe-commits

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

llvm-svn: 294683
2017-02-10 01:27:42 +00:00
Eric Fiselier 8882eeece9 Add missing libc++ import
llvm-svn: 294673
2017-02-10 00:01:01 +00:00
Eric Fiselier d57282791d add missing python import
llvm-svn: 294660
2017-02-09 23:29:08 +00:00
Eric Fiselier 4f258efad7 Move libcxx/test/libcxx python package into libcxx/utils/libcxx.
This patch merges the test python package with the newly
created package in utils.

llvm-svn: 294651
2017-02-09 23:18:11 +00:00
Eric Fiselier 0b37f209bf Start libc++ python cleanup and consolidation.
Libc++ frequently creates and uses utilities written in python.
Currently there are python modules under both libcxx/test and
libcxx/util. My goal with these changes is to consolidate them
into a single package under libcxx/utils/libcxx.

llvm-svn: 294644
2017-02-09 22:53:14 +00:00
Eric Fiselier a18ef6f1f9 Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
A static assertion was misfiring since it checked
is_callable<Visitor, decltype(__variant_alt<T>.value)>. However
the decltype expression doesn't capture the value category as
required. This patch applies extra braces to decltype to fix
that.

llvm-svn: 294612
2017-02-09 19:01:22 +00:00
Joerg Sonnenberger 9e8a082db4 Use protected name for the prototype arguments.
llvm-svn: 294585
2017-02-09 14:12:29 +00:00
Asiri Rathnayake 54a987e1f1 Threading support: externalize sleep_for() function.
Different platforms implement the wait/sleep functions in difrerent ways.
It makes sense to externalize this into the threading API.

Differential revision: https://reviews.llvm.org/D29630

Reviewers: EricWF, joerg
llvm-svn: 294573
2017-02-09 09:31:41 +00:00
Petr Hosek b494288b9e [libcxx][CMake] Support in-tree libunwind when building as part of runtimes
When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_<name> variables
instead in that case.

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

llvm-svn: 294553
2017-02-09 02:19:43 +00:00
Eric Fiselier 4ae0369b8e Update info for LWG 2665 in upcoming_meeting.html
llvm-svn: 294501
2017-02-08 19:04:18 +00:00
Michal Gorny f7132c83f1 [test] Fix hard_link_count test to account for fs with dir nlink==1
Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.

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

llvm-svn: 294431
2017-02-08 09:57:32 +00:00
Marshall Clow a2e54b632e Temporarily disable the LCM/GCD tests under UBSAN.
llvm-svn: 294417
2017-02-08 07:40:59 +00:00
Eric Fiselier d35528b3e7 Add missing include in <numeric>
llvm-svn: 294393
2017-02-08 00:14:13 +00:00
Eric Fiselier 4cdd915fda Prevent UBSAN from generating unsigned overflow diagnostics in the hashing internals
llvm-svn: 294391
2017-02-08 00:10:10 +00:00
Eric Fiselier c0d5590a3b Fix bugs in filesystem detected by _LIBCPP_ASSERT.
Recently I turned on libc++'s debug mode assertions when
CMake is configured with -DLIBCXX_ENABLE_ASSERTIONS=ON. This
change exposed assertion failures caused by bugs in filesystem.
This patch fixes those failures.

The first bug was that `PathParser` was using front()/back()
on empty string views in order to get the address of the character.
However this is UB on empty strings. Those operations now use data()
to obtain the pointer.

The second bug was that directory_iterator attempted to capture errno when it
was unset and there was an assertion to detect this.

llvm-svn: 294360
2017-02-07 21:51:58 +00:00
Eric Fiselier 357120e8a2 fix python3 syntax error
llvm-svn: 294355
2017-02-07 21:21:17 +00:00
Eric Fiselier d8f7f31121 Fix test failures when using modules.
llvm-svn: 294353
2017-02-07 21:20:31 +00:00
Dan Albert 71478363d5 Use copy.deepcopy instead of doing it manually.
Reviewers: EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 294350
2017-02-07 21:04:19 +00:00
Marshall Clow 4513057d66 Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
llvm-svn: 294328
2017-02-07 18:41:25 +00:00
Marshall Clow 891239e64f Mark LWG2784 as ready
llvm-svn: 294311
2017-02-07 15:34:20 +00:00
Saleem Abdulrasool 833cf8bdb6 filesystem: return the constructed object
This really should get identified properly by the compiler to convert to
a NVRO, but compress the code anyways.  This makes the implementation
identical to directory_iterator.cpp

llvm-svn: 294270
2017-02-07 02:46:59 +00:00
Marshall Clow 7a1c0efff4 Add some tests to verify that we implement LWG#2837 correctly. No functional change.
llvm-svn: 294194
2017-02-06 16:03:23 +00:00