Commit Graph

57 Commits

Author SHA1 Message Date
Ilya Biryukov
29a4eab8c5 Revert r372777: [libc++] Implement LWG 2510 and its follow-ups
This also reverts:
 - r372778: [libc++] Implement LWG 3158
 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older
 - r372787: Purge mentions of GCC 4 from the test suite

Reason: the change breaks compilation of LLVM with libc++, for details see
http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372832 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 09:10:38 +00:00
Louis Dionne
3d85029503 [libc++] Implement LWG 2510
Summary:
LWG2510 makes tag types like allocator_arg_t explicitly default
constructible instead of implicitly default constructible. It also
makes the constructors for std::pair and std::tuple conditionally
explicit based on the explicit-ness of the default constructibility
for the pair/tuple's elements.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372777 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 20:18:54 +00:00
Dan Albert
a4ccec7e8e Revert "Revert "Implement std::condition_variable via pthread_cond_clockwait() where available""
With the fix for non-Linux.

This reverts commit c1c519d2f1a66dd2eeaa4c321d8d7b50f623eb71.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372242 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-18 18:13:32 +00:00
Dan Albert
77ce2c648e Revert "Implement std::condition_variable via pthread_cond_clockwait() where available"
This reverts commit 5e37d7f9ff257ec62d733d3d94b11f03e0fe51ca.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372034 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-16 21:20:32 +00:00
Dan Albert
74a9c964df Implement std::condition_variable via pthread_cond_clockwait() where available
std::condition_variable is currently implemented via
pthread_cond_timedwait() on systems that use pthread. This is
problematic, since that function waits by default on CLOCK_REALTIME
and libc++ does not provide any mechanism to change from this
default.

Due to this, regardless of if condition_variable::wait_until() is
called with a chrono::system_clock or chrono::steady_clock parameter,
condition_variable::wait_until() will wait using CLOCK_REALTIME. This
is not accurate to the C++ standard as calling
condition_variable::wait_until() with a chrono::steady_clock parameter
should use CLOCK_MONOTONIC.

This is particularly problematic because CLOCK_REALTIME is a bad
choice as it is subject to discontinuous time adjustments, that may
cause condition_variable::wait_until() to immediately timeout or wait
indefinitely.

This change fixes this issue with a new POSIX function,
pthread_cond_clockwait() proposed on
http://austingroupbugs.net/view.php?id=1216. The new function is
similar to pthread_cond_timedwait() with the addition of a clock
parameter that allows it to wait using either CLOCK_REALTIME or
CLOCK_MONOTONIC, thus allowing condition_variable::wait_until() to
wait using CLOCK_REALTIME for chrono::system_clock and CLOCK_MONOTONIC
for chrono::steady_clock.

pthread_cond_clockwait() is implemented in glibc (2.30 and later) and
Android's bionic (Android API version 30 and later).

This change additionally makes wait_for() and wait_until() with clocks
other than chrono::system_clock use CLOCK_MONOTONIC.<Paste>

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372016 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-16 17:57:48 +00:00
Louis Dionne
22eff1a94a [libc++] Use [[nodiscard]] for lock_guard, as an extension
Summary:
D64914 added support for applying [[nodiscard]] to constructors. This
commit uses that capability to flag incorrect uses of std::lock_guard
where one forgets to actually create a variable for the lock_guard.

rdar://45790820

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368664 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 11:12:28 +00:00
Eric Fiselier
8279a1399e Revert "Suppress -Wctad-maybe-unsupported on types w/o deduction guides."
Some modules builds are issuing buggy diagnostics. The cause of which is
TBD.

This reverts commit r@367770.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367777 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-04 07:13:43 +00:00
Eric Fiselier
de267ad1f1 Suppress -Wctad-maybe-unsupported on types w/o deduction guides.
There are a handful of standard library types that are intended
to support CTAD but don't need any explicit deduction guides to
do so.

This patch adds a dummy deduction guide to those types to suppress
-Wctad-maybe-unsupported (which gets emitted in user code).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367770 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-03 23:54:29 +00:00
Eric Fiselier
a386369f02 Make ~mutex and ~condition_variable trivial on Windows.
The implementations of __libcpp_mutex_destroy and __libcpp_condvar_destroy
are already NOPs, so this optimization is safe to perform.

See r365273 and PR27658 for more information.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365281 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-07 17:24:03 +00:00
Eric Fiselier
47e6bb8620 Fix PR27658 - Make ~mutex trivial when possible.
Currently std::mutex has a constexpr constructor, but a non-trivial
destruction.

The constexpr constructor is required to ensure the construction of a
mutex with static storage duration happens at compile time, during
constant initialization, and not during dynamic initialization.
This means that static mutex's are always initialized and can be used
safely during dynamic initialization without the "static initialization
order fiasco".

A trivial destructor is important for similar reasons. If a mutex is
used during dynamic initialization it might also be used during program
termination. If a static mutex has a non-trivial destructor it will be
invoked during termination. This can introduce the "static
deinitialization order fiasco".

Additionally, function-local statics emit a guard variable around
non-trivially destructible types. This results in horrible codegen and
adds a runtime cost to every call to that function. non-local static's
also result in slightly worse codegen but it's not as big of a problem.

Example codegen can be found here: https://goo.gl/3CSzbM

Note: This optimization is not safe with every pthread implementation.
Some implementations allocate on the first call to pthread_mutex_lock
and free the allocation in pthread_mutex_destroy.

Also, changing the triviality of the destructor is not an ABI break.
At least to the best of my knowledge :-)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365273 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-07 01:20:54 +00:00
Richard Smith
8a590a4c20 Fix buildbot failures after r359159.
std::mutex was not actually is_nothrow_default_constructible in C++98/C++03,
because the variable declaration

  std::mutex M;

... could throw an exception from the mutex destructor. Fix it by marking the
destructor as non-throwing. This has no effect in C++11 onwards, because
destructors are non-throwing by default in those language modes.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359229 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-25 20:00:06 +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
Louis Dionne
07f95bd10d [libc++] Make sure we can build libc++ with -fvisibility=hidden
Summary:
When building with -fvisibility=hidden, some symbols do not get exported from
libc++.dylib. This means that some entities are not explicitly given default
visibility in the source code, and that we rely on the fact -fvisibility=default
is the default. This commit explicitly gives default visibility to those
symbols to avoid being dependent on the command line flags used.

The commit also remove symbols from the dylib -- those symbols do not
actually need to be exported from the dylib and this should not be an
ABI break.

Finally, in the future, we may want to mark the whole std:: namespace as
having hidden visibility (to switch from opt-out to opt-in), in which
case the changes done in this commit will be required.

Reviewers: EricWF

Subscribers: mgorny, christof, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345260 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25 12:13:43 +00:00
Louis Dionne
6952d1478d [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since _LIBCPP_BUILDING_LIBRARY
Summary: As suggested by Marshall in https://reviews.llvm.org/D49914

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338475 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 02:08:59 +00:00
Marshall Clow
97adf8a38e One more (should be) inline variable that is defined in the dylib
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 19:23:30 +00:00
Marshall Clow
c58e4723e7 Implement most of P0607: Inline Variables for the Standard Library. This involved marking a lot of variables as inline (but only for C++17 and later).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321658 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 17:17:01 +00:00
Eric Fiselier
276a69c18b Fix compile error with Bionic's PTHREAD_MUTEX_INITIALIZER
On Bionic PTHREAD_MUTEX_INITIALIZER contains the expression "<enum-type> & <integer-type>",
which causes ADL to perform name lookup for operator&. During this lookup Clang decides
that it requires the default member initializer for std::mutex while defining the DMI
for std::mutex::__m_.

If I'm not mistaken this is caused by the explicit noexcept declaration on the defaulted
constructor.

This patch removes the explicit noexcept and instead allows the compiler to declare
the default constructor implicitly noexcept. It also adds a static_assert to ensure
that happens.

Unfortunatly because it's not easy to change the value of _LIBCPP_MUTEX_INITIALIZER
for a single test there is no good way to test this patch.

The Clang behavior causing the trouble here was introduced in r287713, which first
appears in the 4.0 release.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304942 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 20:47:42 +00:00
Eric Fiselier
018a3d51a4 [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro`  to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.

Reviewers: mclow.lists, bcraig, compnerd, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, krytarowski

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31 22:07:49 +00:00
Eric Fiselier
41af64afad [libc++] Refactor Windows support headers.
Summary:
This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers.

The changes in this patch are:

* remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers.

* Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles.

* Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang.

I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check?

This refactor is needed to support upcoming fixes to `<locale>` on Windows.



Reviewers: bcraig, rmaprath, compnerd, EricWF

Reviewed By: EricWF

Subscribers: majnemer, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302727 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 20:57:45 +00:00
Eric Fiselier
690d999934 Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in thread.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300622 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:05:08 +00:00
Marshall Clow
59bcc879ab Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as https://reviews.llvm.org/D31163.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298681 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 03:40:36 +00:00
Shoaib Meenai
6b7349243e [libc++] Make _LIBCPP_TYPE_VIS export members
Summary:
Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some
of their members exported, otherwise we have a lot of link errors when
linking against a libc++ built with hidden visibility. This also makes
_LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it
already exports members.

With this change made, any template methods of a class marked
_LIBCPP_TYPE_VIS will also get default visibility when instantiatied,
which is not desirable for clients of libc++ headers who wish to control
their visibility; this is the same issue as PR30642. Annotate all
problematic methods with an explicit visibility specifier to avoid this.

The problematic methods were found by running bad-visibility-finder [1]
against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The
small methods were marked for inlining; the larger ones hidden.

[1] https://github.com/smeenai/bad-visibility-finder

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296732 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 03:22:18 +00:00
Marshall Clow
f3e7677540 Swap two lines in __mutex_base. On systems with high clock rates, we could mistakenly return no_timeout when a mutex had timed out if we got a tick between these two lines. Thanks to Brian Cain for the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291492 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 22:32:11 +00:00
Eric Fiselier
c3589a8305 [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS
The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both
_LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to
__attribute__((__type_visibility__)) with Clang. The only remaining difference
is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas
_LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on
templates).

This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 23:56:00 +00:00
Eric Fiselier
8c57032b52 Remove _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
libc++ no longer supports C++11 compilers that don't implement `= default`.
This patch removes all instances of the feature test macro
_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS as well as the potentially dead code it hides.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 06:42:17 +00:00
Marshall Clow
65eb1e90fa Don't use pthread initializers in constexpr constructors. Patch by elram. Reviewed at https://reviews.llvm.org/D21637.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275819 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:23:06 +00:00
Eric Fiselier
10b52a0e56 Implement variadic lock_guard.
Summary:
This patch implements the variadic `lock_guard` paper. 

Making `lock_guard` variadic is a ABI breaking change because the specialization `lock_guard<_Mutex>` mangles differently then when it was the primary template. This change only provides variadic `lock_guard` in ABI V2 or when `_LIBCPP_ABI_VARIADIC_LOCK_GUARD` is defined.

Note that in ABI V2 `lock_guard` must always be declared as a variadic template, even in C++03, in order to keep the ABI consistent. For this reason `lock_guard` is forward declared as a variadic template in all standard dialects and therefore depends on variadic templates being provided as an extension in C++03. All supported versions of Clang and GCC provide this extension.




Reviewers: mclow.lists

Subscribers: K-ballo, mclow.lists, cfe-commits

Differential Revision: http://reviews.llvm.org/D21260

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 03:48:09 +00:00
Asiri Rathnayake
35ff03b7c2 Refactor pthread usage of libcxx.
This patch extracts out all the pthread dependencies of libcxx into the
new header __threading_support. The motivation is to make it easy to
re-target libcxx into platforms that do not support pthread.

Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781

Applied with tweaks - D19412

Change-Id: I301111f0075de93dd8129416e06babc195aa936b

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 14:06:29 +00:00
Marshall Clow
8165249d39 Qualify calls to addressof to avoid getting ADL. Fixes PR#27254.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266209 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13 17:02:23 +00:00
Eric Fiselier
a15e8c3a18 Add clang thread safety annotations to mutex and lock_guard. Patch by jamesr@google.com.
This adds clang thread safety annotations to std::mutex and
std::lock_guard so code using these types can use these types directly
instead of having to wrap the types to provide annotations. These checks
when enabled by -Wthread-safety provide simple but useful static
checking to detect potential race conditions.
See http://clang.llvm.org/docs/ThreadSafetyAnalysis.html for details.

This patch was reviewed in http://reviews.llvm.org/D14731.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 02:30:06 +00:00
Marshall Clow
e22d9e58d3 Implement LWG2577: {shared,unique}_lock</tt> should use std::addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 23:07:32 +00:00
Evgeniy Stepanov
a3b25f81d1 Cleanup: move visibility/linkage attributes to the first declaration.
This change moves visibility attributes from out-of-class method
definitions to in-class declaration. This is needed for a switch to
attribute((internal_linkage)) (see http://reviews.llvm.org/D13925)
which can only appear on the first declaration.

This change does not touch istream/ostream/streambuf. They are
handled separately in http://reviews.llvm.org/D14409.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07 01:22:13 +00:00
Jonathan Roelofs
044df63102 Do not include pthread.h and sched.h when threads are disabled
Patch by Philippe Daouadi!

http://reviews.llvm.org/D9639


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246168 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 17:47:34 +00:00
Jonathan Roelofs
8d86b2e686 Allow libc++ to be built on systems without POSIX threads
If you're crazy enough to want this sort of thing, then add
-D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and
--param=additiona_features=libcpp-has-no-threads to your lit commnad line.

http://reviews.llvm.org/D3969


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217271 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 19:45:05 +00:00
Marshall Clow
b0767852f7 Implement LWG issue #2135. If something goes wrong in condition_variable::wait, call terminate() rather than throwing an error. Do this indirectly, by marking the call as 'noexcept'. This is better than just calling terminate() directly, because it gives a better error message on the console.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204778 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 02:45:04 +00:00
Marshall Clow
239bc42b53 Make cv_status a class enum. Fixes PR18314. Thanks to Andersca for the report and the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@197921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-23 22:14:27 +00:00
Howard Hinnant
ba898e4208 N3659: Shared locking in C++ Revision 2, c++1y only
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-21 01:49:28 +00:00
Howard Hinnant
0f678bd69e Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188192 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 18:38:34 +00:00
Howard Hinnant
83eade6abb No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 23:30:19 +00:00
Howard Hinnant
9c0df1416f Rename uses of _ and __ because these are getting stepped on by macros from other system code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167038 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 19:06:59 +00:00
Howard Hinnant
5c90cbad38 Dimitry Andric: FreeBSD porting tweaks for PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 16:10:20 +00:00
Howard Hinnant
cf115d2cc6 Change sleep_for, sleep_until, and the condition_variable timed wait
functions to protect against duration and time_point overflow.  Since
we're about to wait anyway, we can afford to spend a few more cycles on
this checking.  I purposefully did not treat the timed try_locks with
overflow checking.  This fixes
http://llvm.org/bugs/show_bug.cgi?id=13721 .  I'm unsure if the standard
needs clarification in this area, or if this is simply QOI.  The
<chrono> facilities were never intended to overflow check, but just to
not overflow if durations stayed within +/- 292 years.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162925 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 19:14:33 +00:00
Howard Hinnant
c8f7413908 noexcept applied to <condition_variable>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160605 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:32:53 +00:00
Howard Hinnant
499c61f999 noexcept and constexpr applied to <mutex>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:13:09 +00:00
Howard Hinnant
384608e90d Apply constexpr to the mutex constructor. As a conforming extension, apply constexpr to the condition_variable constructor. These are important because it enables the compiler to construct these types at compile time, even though the object will be non-const. Since they are constructed at compile time, there is no chance of a data race before they are constructed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159901 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 20:01:52 +00:00
Howard Hinnant
7786188d15 Modernize conversion to bool to the explicit bool conversion operator (library wide). This fixes http://llvm.org/bugs/show_bug.cgi?id=12058.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151088 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-21 21:46:43 +00:00
Howard Hinnant
08e17472e4 Windows support by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 20:05:10 +00:00
Howard Hinnant
0949eedbd6 _STD -> _VSTD to avoid macro clash on windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 21:18:19 +00:00
Howard Hinnant
2b1b2d40d7 Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133008 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 19:58:17 +00:00
Howard Hinnant
ac417faebc Minor fixup in <ratio> and add optional support for shared_mutex and upgrade_mutex which must be opted into with #define _LIBCPP_SHARED_LOCK
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 19:41:07 +00:00