Commit Graph

1711 Commits

Author SHA1 Message Date
Eric Fiselier
29151f64e4 Only link tests against -ldl on linux
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 20:45:37 +00:00
Justin Bogner
a0ab096796 Make headers available in the build directory
This essentially re-does r194825 and makes it possible to run clang
with libc++ without having to install it, even if you don't have any
version of libc++ installed in /usr/.

This behaviour broke in r210577/r211629, which fixed pr18681.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220489 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 16:51:12 +00:00
Eric Fiselier
4d2413ca4b Add support for "fancy" pointers to promise and packaged_task.
Summary:
This patch is very closely related to D4859. Please see http://reviews.llvm.org/D4859 for more information.

This patch adds support for "fancy" pointers and allocators to promise and packaged_task. The changes made to support this are exactly the same as in D4859.



Test Plan: "fancy" pointer tests were added to each constructor affected by the change.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220471 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 06:24:45 +00:00
Eric Fiselier
4e7d53664d Add support for "fancy" pointers to shared_ptr. Fixes PR20616
Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.

Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.

There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers. 
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.

Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 04:12:28 +00:00
Marshall Clow
9b82e151fe Fix a couple of failing tests for C++03 by checking for rvalue reference support first.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220465 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 03:57:52 +00:00
Eric Fiselier
3de9baafba Add -ldl to libc++ tests when sanitizers are used.
Clang 3.6 no longer links the sanitizer runtime library dependancies when
-nodefaultlibs is used. This patch manually links in a missing dependancy.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220463 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 02:54:15 +00:00
Marshall Clow
4a655fdde5 Some tests used __typeof__ instead of decltype. Replace these usages.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220296 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 15:07:09 +00:00
Marshall Clow
8148fdb5d2 LWG #2212 (not yet adopted) mandates that tuple_size/tuple_element are available if <array> or <utility> are included (not just <tuple>). We already do this. Add some tests to make sure that this remains true.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 15:05:31 +00:00
Eric Fiselier
499b1ad671 Remove dead buildbot link
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220260 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 02:46:31 +00:00
Eric Fiselier
cb7e32c290 [libcxx] Redo adding support for building and testing with an ABI library not along linker paths
Summary:
This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach:

- `find_library` didn't work with cmake targets (ie in-tree libcxxabi build)
- It wasn't always possible to determine where `find_library` actually found your library.
- `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used.
- Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple. 

After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.






Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert

Reviewed By: chandlerc, danalbert

Subscribers: chandlerc, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220157 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 00:42:41 +00:00
Eric Fiselier
f4c53dacaf Fix unused variables in tests to placate scan-build. Patch from Steve MacKenzie.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220154 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 00:10:15 +00:00
Marshall Clow
38d9005902 Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 11:03:33 +00:00
Eric Fiselier
9b53c1095f Add special case for finding the in-tree ABI library.
When libcxx is built in-tree with libcxxabi it links against libcxxabi using
the name of the cmake target and not the actual library name. The cmake target
will not work with `find_library()`, so it needs special case handling.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220121 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 02:19:28 +00:00
Eric Fiselier
9071bc098b [libcxx] Add support for building and testing with an ABI library not along linker paths
Summary:
This patch adds support for building/testing libc++ with an ABI library that the linker would not normally find.

- `CMAKE_LIBRARY_PATH` is used to specify the list of search directories.
- The ABI library is now found using `find_library` instead of assuming its along the linker's search path.
- `CMAKE_LIBRARY_PATH` is passed to our LIT config as `library_paths`.
- For each path in `library_paths` the following flags are added `-L<path> -Wl,-rpath -Wl,<path>`

Some changes in existing behavior were also added:
- `target_link_libraries` is now passed the ABI library file instead of the library name. Ex `target_link_libraries(cxx "/usr/lib/libc++abi.so")` vs `target_link_libraries(cxx "c++abi")`.
- `-Wl,-rpath -Wl,<path>` is now used on OSX to link to libc++ instead of env['DYLD_LIBRARY_PATH'] if `use_system_lib=False`.




Reviewers: mclow.lists, danalbert, EricWF

Reviewed By: EricWF

Subscribers: emaste, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220118 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 01:15:17 +00:00
Eric Fiselier
950ee77d24 [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.
Delay instantiation of `__numeric_type` within <cmath>, 
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219998 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 00:31:47 +00:00
Eric Fiselier
66d529f0ad [libcxx] Add support for LLVM_USE_SANITIZER=Undefined
LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration.
Update libc++'s handling of LLVM_USE_SANITIZER to support this as well.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219987 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 23:21:59 +00:00
Eric Fiselier
798b2ac28f Fix bad link in documentation. Thanks to rsmith
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219898 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 03:15:31 +00:00
Eric Fiselier
a43d1141b9 Add my buildbot to list of libc++ buildbots in documentation
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 02:48:59 +00:00
Marshall Clow
bbc7c74fbb Fixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis Dionne for the bug report and the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219785 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-15 10:33:02 +00:00
Marshall Clow
df9722ecf1 Fix for PR 19616: 'tuple_cat of nested tuples fails in noexcept specification'. Thanks to Louis Dionne for the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-07 21:42:12 +00:00
Dan Albert
4c88839716 Fix win32 support header for mingw32.
These functions are defined as static in the mingw32 headers.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219140 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-06 20:06:33 +00:00
Nico Weber
8758796fc9 Mark module atomic as cplusplus11.
With clang, the header atomic requires __has_feature(cxx_atomic), which is only
true in c++11 mode. Because of this, when using modules in c++98 with libc++
compilation of the std module would fail without this change, PR21002.

(With gcc, only gcc4.7+ is needed, no c++11. But gcc doesn't have modules yet,
and the module.modulemap language can't express things like "this is only
required if the compiler is clang". If gcc gets module support, we'd probably
have a module.modulemap file for each compiler that libc++ supports?)


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:44:54 +00:00
Eric Fiselier
300da4f9b0 [libcxx] Fix installation of ABI headers. Fixes PR20936
Summary:
I changed the build so that each ABI header gets its own install rule. This gives us the flexibility to install different headers in different directories. 
This also fixes the problem where libstdc++ bits/<header>'s were not being installed under a bits directory.

Test Plan: I tested this patch on linux against libstdc++ and libcxxabi.

Reviewers: danalbert, mclow.lists, jroelofs

Reviewed By: jroelofs

Subscribers: jhunold, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-23 14:42:28 +00:00
Marshall Clow
d132bf4ef1 Fix some type-traits (is_assignable, etc) dealing with classes that take non-const references as 'right hand side'. Add tests. Fixes PR# 20836
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22 23:58:00 +00:00
Jonathan Roelofs
6a5a8abe2f Support newlib as libc++'s C library [locale part]
http://reviews.llvm.org/D5385


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218144 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 20:09:12 +00:00
Marshall Clow
5ffb8d0fbe Fix PR#20843: binomial_distribution<unsigned> is broken. Add test to ensure that signed and unsigned verstions produce the same sequence.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 18:33:58 +00:00
Dan Albert
6d9505ad8a Fix char_traits functions for GCC compatibility.
GCC 4.9 fails to inline these functions at -O1 because they are used
indirectly. Declare them as inline instead of always_inline. Discussion
in GCC bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63220


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217961 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 16:34:29 +00:00
Marshall Clow
01c6bbd947 Add include of <cassert> for the operator comma
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217938 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 04:09:35 +00:00
Marshall Clow
bb9902ec97 K-ballo pointed out *another* mistype in my change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217936 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 01:58:15 +00:00
Marshall Clow
d402a4da6b Fix for mismatch to handle evil iterators which overload operator comma
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 20:40:05 +00:00
Marshall Clow
270f8e01e8 Create a 'comma_iterator' class that overloads operator, and asserts when it's called. Add tests to mismatch to make sure it can't be blindsided by such an evil iterator. More tests for other algorithms forthcoming. Thanks to STL for pointing this out at CppCon and Yakov Galka for opening LWG issue #2133
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217902 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 20:38:11 +00:00
Marshall Clow
4413ab09d5 Fix a bug in the move-assigment operator for basic_stringbuf. Thanks to Johnathan Wakeley for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 18:57:52 +00:00
Marshall Clow
86d311c5f3 Thanks to K-ballo for noting a second incorrect noexcept clause in tuple - and suggesting a more correct way to write the first
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217884 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 17:08:21 +00:00
Marshall Clow
12929a957b Fix a bad noexcept clause in tuple's move constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217878 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 15:36:14 +00:00
Marshall Clow
d1fae17224 Forgot 'const' on my last checkin
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217877 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 15:33:53 +00:00
Marshall Clow
546eca8dc6 Some of the synopsis was left out of these headers, and the copy construction/assignment should have been marked as deleted. Done. No functionality change, because the base class (base_ios) was marked as non-copyable already.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217876 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 15:27:01 +00:00
Dan Albert
7ba3c57565 PR20546: Fix tests for compare_exchange_weak.
These calls are allowed to fail spuriously.

29.6.5.25:

    Remark: A weak compare-and-exchange operation may fail spuriously.
    That is, even when the contents of memory referred to by expected
    and object are equal, it may return false and store back to expected
    the same memory contents that were originally there. [ Note: This
    spurious failure enables implementation of compare and-exchange on a
    broader class of machines, e.g., load-locked store-conditional
    machines. A consequence of spurious failure is that nearly all uses
    of weak compare-and-exchange will be in a loop.

To fix this, we replace any assert() that expects
std::atomic::compare_exchange_weak() to return true with a loop. If the
call does not return true within N runs (with N currently equal to 10),
then the test fails.

http://llvm.org/bugs/show_bug.cgi?id=20546


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06 20:38:25 +00:00
Jonathan Roelofs
baed05dd37 Address some post-commit review comments on r217261
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217276 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 20:28:44 +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
Jonathan Roelofs
d634a2c404 Bugfix: allow additional_features to be empty
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217268 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 19:03:46 +00:00
Jonathan Roelofs
217bdc189a Set -D_LIBCPP_HAS_NO_THREADS and -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK based on available_features
http://reviews.llvm.org/D5214


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217261 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 17:21:57 +00:00
Viktor Kutuzov
60a74bd69d Define ELAST in libcxx's config header on FreeBSD
Differential Revision: http://reviews.llvm.org/D5165


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217146 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 13:25:46 +00:00
Marshall Clow
26f472d1dd Make the ASAN RAII object a nop when building w/o ASAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 21:37:43 +00:00
Jonathan Roelofs
0f4ca8b340 Detection for _LIBCPP_HAS_NO_MONOTONIC_CLOCK caused several more build breakages
Remove it for now. This flag can be set in build scripts instead.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217061 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 18:48:28 +00:00
Alexey Volkov
5907f03123 Allow libc++ to be built with GCC 5.0 compiler
Differential Revision: http://reviews.llvm.org/D5169


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 14:30:39 +00:00
Justin Bogner
464da3b76c test: Make it possible to opt in to use_clang_verify per test
This modifies the use_clang_verify parameter I added in r217009 to
only apply to tests that specifically ask for it via // USE_VERIFY.
This allows us to incrementally convert tests, but start enjoying the
benefits right away.

Suggested by Eric Fiselier in code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 06:01:52 +00:00
Eric Fiselier
438d2cb25d Fix buffer overflow issue in valarray test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217012 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 05:47:35 +00:00
Justin Bogner
837cfe50fe test: Allow using clang -verify for failures rather than exit 1
Currently, failure tests work by checking that compilation exits 1.
This can lead to tests that fail for the wrong reason, so it'd be
preferable to convert them to check for specific errors.

This adds use_clang_verify parameter that runs failure tests using
clang's -verify flag. I'll convert some tests in subsequent commits,
and once all of the tests are converted we should key this on whether
cxx_under_test is clang.

I've also converted one of the unique.ptr tests, since it's the one
that motivated the idea of using clang -verify when possible in the
review of r216317.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217009 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 04:32:08 +00:00
Jonathan Roelofs
fc685481dc Fix yet another aspect of the build breakage caused by r216949
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 00:29:02 +00:00
Jonathan Roelofs
cb093955e9 Fix comment that was obsoleted by r216949
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@216999 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 23:52:46 +00:00