Commit Graph

3686 Commits

Author SHA1 Message Date
Stephan T. Lavavej
02af098ef7 [libcxx] [test] Fix Clang -Wdeprecated-declarations with MSVC's CRT.
libcxx's tests use various C Standard Library functions that have been
marked by MSVC's CRT as deprecated by Microsoft (not by ISO).

libcxx's usage is cromulent (just checking with decltype to see if the functions
are being dragged in by various headers as required by the Standard), so
defining _CRT_SECURE_NO_WARNINGS will silence the warnings in a targeted manner.
This needs to be defined before including any CRT headers.

Also, make this file prettier.

Fixes D29138.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:48:02 +00:00
Stephan T. Lavavej
0eb6bb8d2d [libcxx] [test] Fix Clang -Wunused-local-typedef, part 3/3.
test/std/strings/string.classes/typedefs.pass.cpp
Actually test what basic_string's typedefs stand for.

test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
NotDerived and ND were completely unused.

test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
P2 was mistakenly not being used. Yes, that's
right: -Wunused-local-typedef CAUGHT A MISTAKE! AMAZING!

Fixes D29137.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:47:54 +00:00
Stephan T. Lavavej
939607910d [libcxx] [test] Fix Clang -Wunused-local-typedef, part 2/3.
These typedefs were completely unused.

Fixes D29136.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:47:41 +00:00
Stephan T. Lavavej
5597800045 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 1/3.
Guard typedefs and static_asserts with _LIBCPP_VERSION.

test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
Additionally deal with conditional compilation.

test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
Additionally deal with typedefs used by other typedefs.

Fixes D29135.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:47:09 +00:00
Marshall Clow
0becc206e3 Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 20:52:32 +00:00
Eric Fiselier
a1c7fbb6f9 Fix variant build errors with GCC 7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 20:36:07 +00:00
Eric Fiselier
d78b104afa Adjust Apple ABI list after r294133
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 20:17:41 +00:00
Eric Fiselier
d55abe9d82 Adjust Linux ABI list after r294133
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294138 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 20:14:18 +00:00
Marshall Clow
e2261bde80 Change the base class of std::bad_optional_access. This is a (subtle) ABI change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 20:06:38 +00:00
Saleem Abdulrasool
7566869dab filesystem: fix n4100 conformance for temp_directory_path
N4100 states that an error shall be reported if
`!exists(p) || !is_directory(p)`.  We were missing the first half of the
conditional.  Invert the error and normal code paths to make the code
easier to follow.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 17:21:52 +00:00
Eric Fiselier
1138f041fc Remove CMake hack
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294116 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 01:19:02 +00:00
Eric Fiselier
dab86778df Fix typo in docs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294115 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 01:16:25 +00:00
Eric Fiselier
b89eba01e8 Recommit [libcxx] Never use <cassert> within libc++
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`.
This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default,
because the standard library should not be aborting user programs unless explicitly asked to.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294107 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-04 23:22:28 +00:00
Eric Fiselier
236b752f2b Fix inconsistency in tuple's SFINAE. Patch from Andrey Khalyavin"
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-04 22:57:01 +00:00
Eric Fiselier
9e6abfa091 Mark basic_string::assign templates as inline to improve ABI stability.
Visible definitions for basic_string::assign are sometimes emitted in
the dylib depending on the version of LLVM used to compile libc++.
This can cause the check-cxx-abilist target to fail.

This patch attempts marks the basic_string::assign templates as inline
to prevent this. That way the export list is consistent across LLVM
versions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-04 20:38:35 +00:00
Eric Fiselier
b1b1dcf538 Undefine min/max in __tree
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294099 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-04 20:27:46 +00:00
Dan Albert
e520f0b308 Avoid implementation defined behavior in a test.
Summary:
num_put::put uses %p for pointer types, but the exact format of %p is
implementation defined behavior for the C library. Compare output to
snprintf for portability.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293926 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 19:44:11 +00:00
Asiri Rathnayake
1773efdab3 Extend XFAIL to c++98.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293881 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 11:56:26 +00:00
Marshall Clow
90b3732f7a Fix up some no-exception compile failures
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293623 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 13:12:32 +00:00
Alex Lorenz
cb14d02f6d Workaround new -Wshadow warning introduced by r293599
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293619 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 12:37:48 +00:00
Marshall Clow
9247fd2f79 Fix PR#31779: basic_string::operator= isn't exception safe.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 03:40:52 +00:00
Justin Bogner
e70b4ec8af Revert "Adorn __call_once_proxy with inline and _LIBCPP_INLINE_VISIBILITY"
While this change didn't really hurt, it does lead to spurious
warnings about not being able to override weak symbols if you end up
linking objects built with this change to ones built without it.
Furthermore, since __call_once_proxy is called indirectly anyway it
doesn't actually inline ever.

Longer term, it would probably make sense to give this symbol internal
visibility instead.

This reverts r291497

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:26:09 +00:00
Saleem Abdulrasool
445b823bf1 experimental: avoid using raw _WIN32 in filesystem
Use the _LIBCPP_WIN32API macro instead of _WIN32 checks.  Fix a missed
renaming for style conformance.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 19:57:27 +00:00
Saleem Abdulrasool
5c518e17a9 experimental: port directory_iterator to Windows
This adds a basic first cut implementation for directory_iterator on
Windows.  It uses the FindFirstFile/FindNextFile which has the same
restrictions as opendir/readdir where there exists a TOCTOU race
condition.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 18:50:34 +00:00
Saleem Abdulrasool
1d3b737603 experimental: add missing file header
The directory_iterator implementation file was missing the file header.
Add one.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293530 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 18:50:32 +00:00
Saleem Abdulrasool
52241cb511 experimental: remove some extraneous _LIBCPP_FUNC_VIS
These member functions were decorated with `_LIBCPP_FUNC_VIS` when the
class is also decorated with external visibility.  This breaks down when
building for PE/COFF, where the member function cannot be decorated if
it is within a decorated class.  The class attribute will propagate to
the member.  Remove the extraneous decoration.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293454 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 03:58:26 +00:00
Saleem Abdulrasool
eebb4f71e0 experimental: inline single use of a typedef
The typedef is not particularly long, and used in exactly one location.
Just spell it out at the site.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293450 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 00:15:50 +00:00
Saleem Abdulrasool
b35cd98bc1 experimental: tolerate the existence of a __deref macro
Microsoft's SAL has a `__deref` macro which results in a compilation
failure when building the filesystem module on Windows.  Rename the
member function internally to avoid the conflict.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293449 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 00:15:47 +00:00
Saleem Abdulrasool
286816274d experimental: remove dead function
This template was defined inline, within the TU only and had no uses
across the entire repository.  Remove the dead code.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 22:31:28 +00:00
Saleem Abdulrasool
bc116591fd config: prevent the re-definition of a macro
This causes unnecessary warnings when building with `cl`.  Newer
versions of the C standard permit the redefinition of the macro to the
same value (which is the case here), unfortunately, `cl` does not yet
implement this.  Add a check to prevent the redefinition.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 18:16:33 +00:00
Dimitry Andric
362353aa2d Disable thread safety analysis for some functions in __thread_support
Many thread-related libc++ test cases fail on FreeBSD, due to the
following -Werror warnings:

    In file included from test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp:17:
    In file included from include/thread:97:
    In file included from include/__mutex_base:17:
    include/__threading_support:222:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis]
    }
    ^
    include/__threading_support:221:10: note: mutex acquired here
      return pthread_mutex_lock(__m);
             ^
    include/__threading_support:231:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis]
      return pthread_mutex_unlock(__m);
             ^
    include/__threading_support:242:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis]
    }
    ^
    include/__threading_support:241:10: note: mutex acquired here
      return pthread_mutex_lock(__m);
             ^
    include/__threading_support:251:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis]
      return pthread_mutex_unlock(__m);
             ^
    include/__threading_support:272:10: error: calling function 'pthread_cond_wait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis]
      return pthread_cond_wait(__cv, __m);
             ^
    include/__threading_support:278:10: error: calling function 'pthread_cond_timedwait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis]
      return pthread_cond_timedwait(__cv, __m, __ts);
             ^
    6 errors generated.

This is because on FreeBSD, the pthread functions have lock annotations.
Since the functions in __thread_support are internal to libc++ only, add
no_thread_safety_analysis attributes to suppress these warnings.

Reviewers: mclow.lists, EricWF, delesley, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: ed, aaron.ballman, joerg, emaste, cfe-commits
Differential Revision: https://reviews.llvm.org/D28520


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293197 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-26 18:37:18 +00:00
Marshall Clow
da709135c5 Fixed a couple of invalid statuses for 2665 and 2758
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-26 14:36:14 +00:00
Asiri Rathnayake
bcc92d75df Fix chromium build (libcxx)
Remove the reference to pthread_mach_thread_np() in libcxx headers.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293167 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-26 10:40:17 +00:00
Marshall Clow
f783971aa0 Use the new __has_feature(cxx_constexpr_string_builtins) for detection of the C-string intrinsics for constexpr support in std::char_traits. Thanks to Richard for the intrisic support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-26 06:58:29 +00:00
Marshall Clow
19cd3fd00f Fixed a typo in the synopsis (noecept -> noexcept). Thanks to Kim for the catch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-25 20:14:03 +00:00
Mehdi Amini
8a032c59d0 [libcxx] Mentions "targeting C++11 and above" instead of "targeting C++11" in the doc
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@293071 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-25 17:00:30 +00:00
Marshall Clow
9bb0cca646 Implement LWG2556: Wide contract for future::share()
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292992 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 23:28:25 +00:00
Marshall Clow
4e42dc97f3 Change the return type of emplace_[front|back] back to void when building with C++14 or before. Resolves PR31680.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292990 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 23:09:12 +00:00
Marshall Clow
b4d17ade89 Remove auto_ptr in C++17. Get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292986 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 22:22:33 +00:00
Marshall Clow
bef26f787d Add a test to make sure that implicit conversion from error_code to bool will fail
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 19:44:55 +00:00
Marshall Clow
9a89d24bb0 Update status for LWG2733
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 19:37:09 +00:00
Marshall Clow
98494057e8 Implement LWG2733: [fund.ts.v2] gcd / lcm and bool. We already did tbis for C++17, so replicate the changes in experimental.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292962 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 18:15:48 +00:00
Marshall Clow
a5f53d0730 Mark LWG2736 as complete. No code changes, but we have more tests now
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 18:03:32 +00:00
Marshall Clow
b08183bc1f A couple more tests for constexpr stuff in string_view. No changes other than test code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 16:28:02 +00:00
Eric Fiselier
c73c1fc7ae Update Linux ABI lists to reflect inlining change in LLVM. More investigation tomorrow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 13:03:40 +00:00
Eric Fiselier
a49c64f182 Revert "[libcxx] Never use <cassert> within libc++"
This reverts commit r292883. Unfortunately <string_view> uses
_LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib
build. I'll investigate more tomorrow.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292923 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 12:26:01 +00:00
Eric Fiselier
1a3bde19ef Revert yet another accidental change caused by r292684
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292908 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 10:38:46 +00:00
Eric Fiselier
1bd94ed50d Fix bad XFAIL which recent LIT changes diagnosed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292905 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 10:19:32 +00:00
Eric Fiselier
66ed0bc836 Remove all usages of REQUIRES-ANY in the test suite.
Pending LIT changes are about to remove the REQUIRES-ANY keyword
in place of supporting boolean && and || within "REQUIRES". This
patch prepares libc++ for that change so that when applied
the bots don't lose their mind.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 09:11:08 +00:00
Eric Fiselier
2c90d1f776 [libcxx] Never use <cassert> within libc++
Summary:
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default, because the standard library should not be aborting user programs unless explicitly asked to.

Reviewers: mclow.lists, compnerd, smeenai

Reviewed By: mclow.lists

Subscribers: mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292883 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 04:57:33 +00:00