Howard Hinnant
999fc97ef2
Dimitry Andric: FreeBSD only: Add the C11 aligned_alloc to <cstdlib> and adjust the inclusion of quick_exit.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165882 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 18:03:53 +00:00
Argyrios Kyrtzidis
1dc6f7ab97
Don't neglect to "return *this".
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165860 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 02:03:45 +00:00
Howard Hinnant
75536baae7
Holger Arnold: Correct the use and testing of __GNUC__ and __GNUC_MINOR__ in <__config>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165151 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 20:48:05 +00:00
Howard Hinnant
95c0e9f9e1
Make vector::iterator and string::iterator more resilient against overly generic relational operators.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 19:45:42 +00:00
Howard Hinnant
155ff6e95a
Due to a mistake on my own part, I need to burn some version numbers. This does not impact any of the implementation of libc++, and does not impact the ABI in any way.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164832 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-28 17:42:25 +00:00
Howard Hinnant
8d36c432f2
Bump _LIBCPP_VERSION to 1002
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 15:38:09 +00:00
Howard Hinnant
c25d158c62
Apply the emulated nullptr_t with constexpr. This is an unusual configuration that would take advantage of this. But it has popped up in the wild and does no harm to support it.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164575 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-24 23:36:40 +00:00
Howard Hinnant
2d3f4ee99f
Add overflow check to tanh(complex) and reduce to finite answer. Fixes http://llvm.org/bugs/show_bug.cgi?id=13874
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 23:51:47 +00:00
Howard Hinnant
a585de645c
Overloaded __pad_and_output on ostreambuf_iterator and in this overload call sputn instead of dereferencing the iterator which calls sputc. This is intended to be purely a performance optimization, especially for clients who may have overloaded the virtual function xsputn.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164241 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 19:14:15 +00:00
Howard Hinnant
7eb9f1e3a3
Align <atomic> with clang r163964 which disallows const _Atomic types.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164004 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-16 20:33:09 +00:00
Howard Hinnant
33be35effe
Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 00:39:16 +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
460b4cadde
Some minor mingw64 porting tweaks from Glen.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163120 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-03 18:13:11 +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
c417a802ed
Hyeon-bin Jeong: libc++ fails to create any classes inherit from basic_ios if they
...
provided char type other than char or wchar_t. It throw exception during
construction, so there is no chance to imbue own ctype.
This fixes http://llvm.org/bugs/show_bug.cgi?id=13698
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-26 18:05:35 +00:00
Howard Hinnant
a5160283a4
Michel Morin: My previous fix for C++03 was incomplete.
...
It does not consider user-defined conversions that convert an rvalue
into an lvalue and works incorrectly for types with such a conversion
operator.
For example,
struct foo
{
operator int&();
};
returns false_type.
Attached a patch that fixes this problem.
http://llvm.org/bugs/show_bug.cgi?id=13601
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 15:06:50 +00:00
Howard Hinnant
37bdf0e6bd
Have basic_istream seekg, putback and unget first clear eofbit. Fixes http://llvm.org/bugs/show_bug.cgi?id=13089 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 22:03:03 +00:00
Howard Hinnant
d305d3c1a2
Hyeon-Bin Jeong: 1. sync() should reset it’s external buffer pointers.
...
Remaining characters should be discarded once sync() called. If don’t, garbage
characters can be inserted to the front of external buffer in underflow().
Because underflow() copies remaining characters in external buffer to it’s
front. This results wrong characters insertion when seekpos() or seekoff() is
called.
this line should be inserted in sync() just before return:
__extbufnext_ = __extbufend_ = __extbuf_;
2. sync() should use length() rather than out() to calculate offset.
Reversing iterators and calling out() to calculate offset from behind is
working fine in stateless character encoding. However, in stateful encoding,
escape sequences could differ in length. As a result, out() could return wrong
length.
For example, if we have internal buffer converted from this external sequence:
(capital letters mean escape sequence)
… a a a a B b b b b
out() produces this sequence.
b b b b A a a a a
Because out() inserts escape sequence A rather than B, result sequence doesn't
match to external sequence. A and B could have different lengths, result offset
could be wrong value too.
length() method in codecvt is right for calculating offset, but it counts
offset from the beginning of buffer. So it requires another state member
variable to hold state before conversion.
Fixes http://llvm.org/bugs/show_bug.cgi?id=13667
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162601 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 21:20:56 +00:00
Howard Hinnant
ec423cb8d4
Fix basic_filebuf's internal buffer is shrinking when using with some codecvt. http://llvm.org/bugs/show_bug.cgi?id=13602
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 20:37:00 +00:00
Howard Hinnant
e7d59f2601
Fixed order of calling use_facet vs setbuf in basic_filebuf default constructor.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162571 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 18:06:47 +00:00
Howard Hinnant
8540d4c9d2
basic_filebuf needs to delay obtaining a codecvt facet from the global locale to give the client a chance to imbue the proper locale. Fixes http://llvm.org/bugs/show_bug.cgi?id=13663 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 16:52:47 +00:00
Howard Hinnant
ffab05833f
In C++03 mode add an explicit conversion from int to the emulated class enum. Fixes a problem reported by C. Bergström.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162189 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 17:14:47 +00:00
Howard Hinnant
96c60b482e
Patch contributed by Dev Dude for mingw64 port.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 15:13:16 +00:00
Howard Hinnant
a0852ffbe8
Apply patches supplied by Michel Morin in http://llvm.org/bugs/show_bug.cgi?id=13601 to correct bugs in is_convertible for the case that the intrinsic __is_convertible_to is not available.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 17:54:11 +00:00
Howard Hinnant
4ae952ab9a
Consistently label __bit_array as a struct, not a class.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 17:10:18 +00:00
Howard Hinnant
e87514aa94
Patch constributed by Michel Moren in http://llvm.org/bugs/show_bug.cgi?id=13592 . Fixes is_convertible<From, To> when To is an abstract type.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161755 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 12:29:17 +00:00
Howard Hinnant
584db4287b
std::equal operating on non-const __bit_iterators was not working. This fixes it.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161309 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-05 21:43:11 +00:00
Howard Hinnant
4b2f4203a2
Performance tweaking rotate.
...
rotate is a critical algorithm because it is often used by other algorithms,
both std and non-std. The main thrust of this optimization is a specialized
algorithm when the 'distance' to be shifted is 1 (either left or right). To my
surprise, this 'optimization' was not effective for types like std::string.
std::string favors rotate algorithms which only use swap. But for types like
scalars, and especially when the sequence is random access, these new
specializations are a big win. If it is a vector<size_t> for example, the
rotate is done via a memmove and can be several times faster than the gcd
algorithm.
I'm using is_trivially_move_assignable to distinguish between types like int and
types like string. This is obviously an ad-hoc approximation, but I haven't
found a case where it doesn't give good results.
I've used a 'static if' (with is_trivially_move_assignable) in three places.
Testing with both -Os and -O3 showed that clang eliminated all code not be
executed by the 'static if' (including the 'static if' itself).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161247 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 18:01:20 +00:00
Howard Hinnant
5fec82dc0d
Implement [util.smartptr.shared.atomic]. This is the last unimplemented
...
section in libc++. This requires a recompiled dylib. Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.
The implementation is not lock free. After considerable thought, I know of no
way to make the implementation lock free. Ideas welcome along that front. But
changing the ABI of shared_ptr is not on the table at this point.
The mutex used to lock these function is encapsulated by std::__sp_mut. The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members. Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex. That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.
I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks. Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait). In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).
The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr. The constant 16 is a ball-park reasonable space/time
tradeoff.
std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function. I had thought we had already done this, but I was mistaken.
All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160940 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 01:40:57 +00:00
Howard Hinnant
afcac1ac46
Patch by Andrew C. Morrow: shims to work around macroized getc and putc on linux. On my eglibc 2.13 based Debian system 'getc' is a macro defined in
...
/usr/include/stdio.h. This decision to make it a macro doesn't seem to
be guarded by any feature test macro as far as I can see.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160799 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 20:01:13 +00:00
Howard Hinnant
ca8eb830dd
<algorithm> no longer needs to include <cstdlib>, but can get away with just <cstddef>. This was brought to my attention by Salvatore Benedetto in his port to a bare-metal coretex-m3. This exposed two test bugs where an explicit #include <cstdlib> was needed.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 17:09:09 +00:00
Howard Hinnant
f3d62ea57f
locale::id really needs to be constructed at compile time.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160785 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 16:14:37 +00:00
Richard Smith
0405cc4ae0
libc++: switch from using _ATTRIBUTE(noreturn) (which conflicts with a
...
platform-provided macro on some systems) to _LIBCPP_NORETURN.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 02:04:22 +00:00
Howard Hinnant
8131a01a9c
Apple LWG 2067: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3318.html#2067 . This is the only actionable change that has been made to the C++ draft since C++11. In general it has not been decided exactly how libc++ will track changes made to C++11. New features and design changes will probably be #ifdef'd, especially if they are not backwards compatible. Defects and 'dumb mistakes' are more likely to just be put in. Decisions on telling one from the other will be made on a case by case basis.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 19:34:12 +00:00
Howard Hinnant
8bf01ddd30
noexcept applied to <future>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 17:46:55 +00:00
Howard Hinnant
6e1d851be8
noexcept applied to <thread>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160606 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:50:47 +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
46623a09ee
noexcept and constexpr applied to <regex>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 01:31:58 +00:00
Howard Hinnant
f57bd564fd
noexcept and constexpr applied to <ios>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 01:03:40 +00:00
Howard Hinnant
bd143086ac
noexcept applied to <valarray>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160592 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 00:51:28 +00:00
Howard Hinnant
410f2def47
constexpr applied to <complex>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 22:18:27 +00:00
Howard Hinnant
c83960a9e4
noexcept applied to <random>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 21:44:27 +00:00
Howard Hinnant
d06a640ba7
noexcept applied to <iterator>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160565 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:36:34 +00:00
Howard Hinnant
08bce1754d
constexpr applied to <array>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:20:49 +00:00
Howard Hinnant
03d7181b0e
constexpr applied to <string>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160563 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:09:12 +00:00
Howard Hinnant
e41f475a44
Further tweaks on relaxing complete type checking for function.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 18:56:07 +00:00
Howard Hinnant
c425307238
Relax the complete-type checks that are happening under __invokable<Fp, Args...> to only check Fp, and not Args... . This should be sufficient to give the desired high quality diagnostics under both bind and function. And this allows a test reported by Rich E on cfe-dev to pass. Tracked by <rdar://problem/11880602>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160285 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 16:17:34 +00:00
Howard Hinnant
473f838128
Applied constexpr to <chrono>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160184 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 19:17:27 +00:00
Howard Hinnant
1ca23672a0
Fixed a bug in wstring_convert concerning zero-length inputs. Thanks to Jonathan Coxhead for reporting this bug.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160136 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 18:07:41 +00:00
Howard Hinnant
a58402abb9
Change emplace for vector and deque to create the temporary (when necessary) before any changes to the container are made. Nikolay Ivchenkov deserves the credit for pushing this problem and the solution for it.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 23:23:04 +00:00
Howard Hinnant
46e9493c68
Appy constexpr to <memory>. Picked up a few missing noexcepts as well.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159902 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 20:56:04 +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
90d8723476
Apply constexpr to <bitset>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159899 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 17:04:52 +00:00
Howard Hinnant
74f26f251b
Apply noexcept to tuple.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159865 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 21:53:48 +00:00
Howard Hinnant
4eebfc3394
As a conforming extension give tuple a noexcept default constructor conditionalized on its held types.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159858 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 20:50:27 +00:00
Howard Hinnant
5394c1ed30
Give tuple a constexpr default constructor.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 20:39:45 +00:00
Howard Hinnant
9b12f23e30
Apply noexcept to those functions implemented in <cstdlib> as a conforming extension.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:16:56 +00:00
Howard Hinnant
cac0c46abb
Apply noexcept to those functions implemented in <cmath> as a conforming extension.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:13:50 +00:00
Howard Hinnant
7a44515588
This commit establishes a new bucket_count policy in the unordered containers: The policy now allows a power-of-2 number of buckets to be requested (and that request honored) by the client. And if the number of buckets is set to a power of 2, then the constraint of the hash to the number of buckets uses & instead of %. If the client does not specify a number of buckets, then the policy remains unchanged: a prime number of buckets is selected. The growth policy is that the number of buckets is roughly doubled when needed. While growing, either the prime, or the power-of-2 strategy will be preserved. There is a small run time cost for putting in this switch. For very cheap hash functions, e.g. identity for int, the cost can be as high as 18%. However with more typical use cases, e.g. strings, the cost is in the noise level. I've measured cases with very cheap hash functions (int) that using a power-of-2 number of buckets can make look up about twice as fast. However I've also noted that a power-of-2 number of buckets is more susceptible to accidental catastrophic collisions. Though I've also noted that accidental catastrophic collisions are also possible when using a prime number of buckets (but seems far less likely). In short, this patch adds an extra tuning knob for those clients trying to get the last bit of performance squeezed out of their hash containers. Casual users of the hash containers will not notice the introduction of this tuning knob. Those clients who swear by power-of-2 hash containers can now opt-in to that strategy. Clients who prefer a prime number of buckets can continue as they have.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 17:31:14 +00:00
Nuno Lopes
518d150040
mark operator new(std::nothrow) as noalias (aka __attribute__((malloc))
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159359 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 16:47:34 +00:00
Howard Hinnant
2d62229b96
Fixed a bug regarding result_of reported by Sven Behne. The fix is C++11 only mainly because result_of is a variadic beast and working with variadics is just such a problem in C++03 mode. This should bring result_of up to full conformance with the C++11 spec.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 17:37:15 +00:00
Howard Hinnant
fe59276f04
Revert pair constructors back to using is_convertible instead of is_constructible. This should pull things into alignment with the final draft. Fixes http://llvm.org/bugs/show_bug.cgi?id=13063#add_comment .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@158280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-09 20:01:23 +00:00
Howard Hinnant
dbd9eacde0
Fix dangling else clause. Bug found and fixed by Dimitry Andric.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 23:12:03 +00:00
Howard Hinnant
6467aeb7c9
Fix the new _ALIGNAS_TYPE per instructions supplied by Eli Friedman.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157765 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 20:14:00 +00:00
Howard Hinnant
cbdd0896d3
Protect use of alignas against older versions of clang
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157764 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 19:31:14 +00:00
Howard Hinnant
635ce1d127
The rules for emplace in map, multimap, unordered_map and unordered_multimap changed a while back and I'm just now updating to these new rules. In a nutshell, you've got to know you're emplacing to a pair and use one of pair's constructors. I made one extension: If you want to emplace the key and default construct the mapped_type, you can just emplace(key), as opposed to emplace(piecewise_construct, forward_as_tuple(key), forward_as_tuple()).
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157503 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 22:04:21 +00:00
Howard Hinnant
3e3e5ebc72
Fix memory corruption bug found and fixed by Andrew C. Morrow.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157476 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 15:55:46 +00:00
Howard Hinnant
9b763e0945
Revert fix to http://llvm.org/bugs/show_bug.cgi?id=12867 for the reason now included in the code comment.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 20:20:49 +00:00
Douglas Gregor
0855ddeb24
Revert my _LIBCPP_INLINE_VISIBILITY changes, r157097 and r157107
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 07:14:17 +00:00
Douglas Gregor
f20f0d3fc5
valarray resize should not be _LIBCPP_INLINE_VISIBILITY
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157107 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 07:01:14 +00:00
Douglas Gregor
e9e4b855b8
Move _LIBCPP_VISIBLE_INLINE from the out-of-line definitions of member
...
functions to the original declarations, so that Clang will actually
see them. Part of <rdar://problem/11489333>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157097 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 04:41:25 +00:00
Howard Hinnant
762657693d
Protect __shared_weak_count::__get_deleter declaration with _LIBCPP_NO_RTTI. Fixes http://llvm.org/bugs/show_bug.cgi?id=12867
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-18 13:06:21 +00:00
Howard Hinnant
ffa7fbef7b
Fix several bugs in find/count specialized for bits.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 14:55:00 +00:00
Howard Hinnant
b3cf4b5b54
Add friends __count_bool_true and __count_bool_false to __bit_iterator.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156543 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 14:01:40 +00:00
Howard Hinnant
f867f6326b
SFINAE __bit_iterator such that it will only get instantiated with a container that has the nested type __storage_type. This prevents accidental instantiation such as in http://llvm.org/bugs/show_bug.cgi?id=12755 . This fixes http://llvm.org/bugs/show_bug.cgi?id=12755 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156308 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 16:50:38 +00:00
Howard Hinnant
d2da6d2322
Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue. Fixes <rdar://problem/11359080>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156182 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-04 17:21:02 +00:00
Howard Hinnant
f07a529b77
Change std::abs from a template function to three overloads for float, double and long double.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156064 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-03 14:58:34 +00:00
Howard Hinnant
87073e4bfb
Greatly scale back ambitions of emulating move semantics in C++03 mode. It was causing more problems than it solved. This fixes http://llvm.org/bugs/show_bug.cgi?id=12704 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@155918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 15:37:54 +00:00
Howard Hinnant
300c67ab92
Apply noexcept and constexpr to <atomic>.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 20:14:21 +00:00
Richard Smith
6186c7fe6a
Switch libc++ from __atomic_* builtins to __c11_atomic_* builtins.
...
Per discussion with Howard, we are not interested in maintaining
compatibility with older versions of clang.
All tests pass with ToT clang, except for two which assert due to
a pre-existing, unrelated bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 18:55:46 +00:00
David Chisnall
b2292091cb
Now that clang supports doing the right thing with regard to atomic
...
initialisation, do the right thing with regard to atomic initialisation.
Note: clang r154507 or later required for <atomic> to work now.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 17:26:23 +00:00
David Chisnall
0341c820a0
Fix use of __atomic_is_lock_free() intrinsic.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154093 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05 13:13:24 +00:00
Howard Hinnant
616e92d748
Put std::piecewise_construct_t back into the dylib for ABI stability. When clients are in C++11/constexpr mode this will be safely ignored because piecewise_construct is then declared with internal linkage.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153981 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 23:45:46 +00:00
Howard Hinnant
2a5349ba66
constexpr support for <utility>. Patch contributed by Jonathan Sauer.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153968 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 21:09:48 +00:00
Howard Hinnant
8efd3dac5d
Update <random> with constexpr support. Patch contributed by Jonathan Sauer.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 21:00:45 +00:00
Howard Hinnant
60cb7d267f
Update <limits> with constexpr support. Patch contributed by Jonathan Sauer.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 19:23:15 +00:00
Howard Hinnant
27b4fd30ef
This is an initial commit of constexpr support as proposed by Richard Smith. This by no means completes constexpr support. Indeed, it hardly scratches the surface. All it does is lay the foundation in <__config> and changes those few places in the library that are already using that foundation.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 00:40:41 +00:00
Howard Hinnant
dc1345fd44
I believe tuple is still under development in the standard. Daniel Krugler is/will be making convincing arguments that a modified form of LWG 2051 (currently NAD Future) is easily acheivable and desirable. He has demonstrated that a tuple<T...> where all of the T are implicitly convertible from U... should have a tuple constructor that is also implicit, instead of explicit. This would support the use cases in LWG 2051 while not undermining T... with explicit conversions from U.... This check-in is an experimental implementation of Daniel's work. I believe this work to be mature enough to warrant inclusion into libc++. If anyone sees real-world problems that this check in causes, please let me know and I will revert it, and provide the feedback to the LWG.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153855 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-01 23:10:42 +00:00
Howard Hinnant
9aa4e11451
It appears that the standard accidentally removed the default constructor for error_category. I'm putting it back in. This fixes http://llvm.org/bugs/show_bug.cgi?id=12321 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153194 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-21 16:18:57 +00:00
David Chisnall
f2533a8798
Make sure [at_]quick_exit is in std::
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 14:10:37 +00:00
Jeffrey Yasskin
558ae17391
Fix moneypunct_byname algorithm to more accurately represent C locales in C++.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 18:31:43 +00:00
Howard Hinnant
05b57d5cdf
Change some smart_ptr == 0 to smart_ptr == nullptr. Fixes http://llvm.org/bugs/show_bug.cgi?id=12185 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152240 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 20:37:43 +00:00
David Chisnall
b56a4ada33
Define _WCHAR_T in solaris/wchar.h. This fixes a bug where Solaris 10 headers
...
try to define C++ keywords as typedefs (fixed in Solaris 11).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151890 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:56:04 +00:00
David Chisnall
b6e7c305d4
Fix MSVC / Sun #ifdef ordering. Remove another #if-nothing-#endif.
...
Sorry for the churn.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:41:21 +00:00
David Chisnall
26cba271cb
Remove a spurious #ifdef / #endif pair with nothing between them.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151729 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:22:33 +00:00
David Chisnall
ea2741973a
Add support files required for building on Solaris.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151721 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:17:28 +00:00
David Chisnall
997e454139
Solaris port. Currently sees around 200 test failures, mostly related to
...
Solaris not providing some of the locales that the test suite uses.
Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers. These will be committed to a branch later
today.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:05:08 +00:00
David Chisnall
8fa14e97ca
Don't define __locale_raii if we are not going to be using it.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:00:07 +00:00
Howard Hinnant
4a13b2dce9
Reduce the number of move constructions when constructing a std::function. This fixes http://llvm.org/bugs/show_bug.cgi?id=12105 .
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 19:47:38 +00:00