3079 Commits

Author SHA1 Message Date
Eric Fiselier
daa895f887 Add missing <memory> include in test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283633 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:59:16 +00:00
Eric Fiselier
ef9e52bc90 Add missing include in test_allocator.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:57:56 +00:00
Eric Fiselier
124ed406e5 [libc++] Fix stack_allocator
Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283631 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:56:22 +00:00
Marshall Clow
9c4dfbe55c Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 23:19:04 +00:00
Eric Fiselier
a62e1dd729 Fix PR30642 - libc++ leaks always-visible symbols into programs
This was caused by r281673, specifically changing `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`
from `__attribute__((__type_visibility__("default")))` to
`__attribute__((__visibility("default")))`.

I made that change because I thought the external instantiations needed
their members to have default visibility. However since libc++ never builds
with -fvisibility=hidden this appears not to be needed. Instead this change
caused previously hidden inline methods to become un-hidden, which is a regression.

This patch reverts the problematic change and fixes PR30642.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 23:07:59 +00:00
Eric Fiselier
ee0db89aee Fix shadow warnings. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283618 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 22:10:35 +00:00
Eric Fiselier
2c429bee79 Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 21:27:45 +00:00
Eric Fiselier
45a9570f5d Remove MSVC workarounds. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 18:51:33 +00:00
Marshall Clow
1a38ecc7e1 Mark issues 2514, 2519, 2536 and 2475 as done
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 13:59:18 +00:00
Asiri Rathnayake
e3a71a295e [libcxx] Recover no-exceptions XFAILs - I
First batch of changes to get some of these XFAILs working in the
no-exceptions libc++ variant.

Changed some XFAILs to UNSUPPORTED where the test is all about exception
handling. In other cases, used the test macros TEST_THROW and
TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test
that concerns exception handling behaviour.

Reviewers: EricWF, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 11:15:41 +00:00
Eric Fiselier
1d6b5d3ed1 Fix strict-aliasing violation in typeinfo::hash_code()
Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 22:55:10 +00:00
Marshall Clow
f5293bc6ac Comment out failing test while I figure out who is at fault
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 18:47:18 +00:00
Marshall Clow
8df21c935f Mark LWG#2679 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283356 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 18:36:24 +00:00
Marshall Clow
3d19a9da96 Mark LWG#2358 as done
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 17:02:43 +00:00
Marshall Clow
aead8da085 Make tests for is_empty better. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 17:01:16 +00:00
Marshall Clow
6f5d5948ef Add another append test for basic_string
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 15:47:13 +00:00
Marshall Clow
f257c26ec7 Mark LWG issues 2221, 2556 and 2589 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 15:21:11 +00:00
Eric Fiselier
8f972f6538 [libcxx] [test] Guard __has_include usage with a macro
Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283260 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 21:25:51 +00:00
Marshall Clow
cc30c0b9f3 Mark #2759 as ready and #2755 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283222 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 14:39:58 +00:00
Marshall Clow
10ff23dc02 Mark #2598 as ready
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283220 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 14:08:50 +00:00
Marshall Clow
8332f9b5d1 Mark #2739 as ready
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283218 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 13:41:56 +00:00
Marshall Clow
1770a8c118 Mark a couple more Issaquah issues as done: 2578 and 2738
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283163 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 23:42:31 +00:00
Marshall Clow
42a87db999 Change a couple of 'template <typename's to 'template <class' which is what we use in the rest of the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 23:40:48 +00:00
Marshall Clow
ec81081c3c Add tests to make sure that is_constructible<cv-void> is false. We already checked 'unqualified void'. This was brought up by LWG#2738
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 23:39:52 +00:00
Marshall Clow
7d06a50a51 Mark a couple issues as done (2742 and 2760)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283124 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 17:35:08 +00:00
Logan Chien
8fe453ab55 [lit] Allow more file extensions for test cases.
This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283118 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 16:00:22 +00:00
Marshall Clow
83050e50f7 Change titie of page from Oulu to Issaquah
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 14:24:21 +00:00
Marshall Clow
a39b868f53 List tentatively ready issues for Issaquah
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 14:23:04 +00:00
Hal Finkel
d24aba4220 Remove some additional unnecessary std:: in cmath
Unlike in math.h, as Eric pointed out in the review of D18639, we don't need
the std:: in cmath.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 20:38:44 +00:00
Hal Finkel
970af07a3c Use __builtin_isnan/isinf/isfinite in complex
The libc-provided isnan/isinf/isfinite macro implementations are specifically
designed to function correctly, even in the presence of -ffast-math (or, more
specifically, -ffinite-math-only). As such, on most implementation, these
either always turn into external function calls (e.g. glibc) or are
specifically function calls when FINITE_MATH_ONLY is defined (e.g. Darwin).

Our implementation of complex arithmetic makes heavy use of isnan/isinf/isfinite
to deal with corner cases involving non-finite quantities. This was problematic
in two respects:

  1. On systems where these are always function calls (e.g. Linux/glibc), there was a
     performance penalty
  2. When compiling with -ffast-math, there was a significant performance
     penalty (in fact, on Darwin and systems with similar implementations, the code
     may in fact be slower than not using -ffast-math, because the inline
     definitions provided by libc become unavailable to prevent the checks from
     being optimized out).

Eliding these inf/nan checks in -ffast-math mode is consistent with what
happens with libstdc++, and in my experience, what users expect. This is
critical to getting high-performance code when using complex<T>. This change
replaces uses of those functions on basic floating-point types with calls to
__builtin_isnan/isinf/isfinite, which Clang will always expand inline. When
using -ffast-math (or -ffinite-math-only), the optimizer will remove the checks
as expected.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 20:38:31 +00:00
Eric Fiselier
89e826a160 Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 10:46:01 +00:00
Eric Fiselier
cdac787ae8 Replace test_throw.h header with a single test macro
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 10:34:13 +00:00
Shoaib Meenai
56919fcf4e [libc++] Add missing locale aliases
Add underscore aliases for strtof_l and strtod_l. _strtold_l exists in
VS 2013 and above, so fix that definition as a drive-by fix.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 03:35:41 +00:00
Eric Fiselier
c0f860c946 Partially revert overflow checking in last_write_time
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282660 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29 01:01:26 +00:00
Shoaib Meenai
b160392eb7 [libc++] Clarify _LIBCPP_NEW_DELETE_VIS for Windows
Replace a stale reference to cxx_EXPORTS with _LIBCPP_BUILDING_LIBRARY,
and clarify why the operator new and delete family of functions are
marked dllexport when building but *not* dllimport when including the
header externally.

The new code is identical to the intent of the old code (and would be
functionally equivalent were cxx_EXPORTS still defined when building
libc++). The overall behavior is not ideal, since Microsoft's operator
new and delete functions will get called instead of libc++'s, but I
think consistently calling msvcrt's functions is better than either
calling msvcrt's or libc++'s functions depending on header inclusion.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282644 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 22:28:51 +00:00
Eric Fiselier
ff4f298780 Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.
This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals,
most of which are locking primitives, in order to ensure that they can
safely be used during program startup.

This patch also fixes an unsafe static init issue with the global locks
used to implement atomic operations on shared pointers. Previously the
locks were initialized using a dynamically initialized pointer, so it was
possible that the pointer was uninitialized.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282640 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 22:08:13 +00:00
Eric Fiselier
d5fc5ca37f Improve 'last_write_time(...)' accuracy and detect overflow errors.
The ::stat struct on Linux, FreeBSD, and OS X  provides the access and
modification times as an instance of 'timespec', which has a nanosecond
resolution. The 'st_mtime' and 'st_atime' members simply reference the 'tv_sec'
value of the timespec struct. This patch changes 'last_write_time(...)' so that
it extracts both the seconds and nanoseconds values of the last modification
time, providing a more accurate implementation of 'last_write_time(...)'.

Additionally this patch fixes a possible signed integer overflow bug. The
'file_time_type' type cannot represent all possible values returned by
the filesystem. Attempting to construct a 'file_time_type' from one of these
values is undefined behavior. This patch avoids that UB by detecting possible
overflows before the conversion.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 21:16:58 +00:00
Michal Gorny
c3e00f6d37 Revert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone build
Revert r282483 as it causes build failures due to missing symbols when
not linking to -lgcc_s (i.e. doing pure LLVM stack build). The patch can
be reintroduced when the build system is fixed to add all needed
libraries (libunwind, compiler-rt).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 18:54:02 +00:00
Michal Gorny
0e5fbd4d40 [cmake] Add linker option "-Wl,-z,defs" in standalone build
Add the "-Wl,-z,defs" linker option that is used to prevent
underlinking. It is already used by LLVM itself but does not get
propagated into stand-alone build of libc++. This patch ensures
that the option is passed in independently of whether libc++ is built
in-tree or out-of-tree.

Patch by Lei Zhang.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282483 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 12:15:35 +00:00
Michal Gorny
b79ca0a818 [cmake] Strip possibly-inherited compiler flags in in-tree build only
Strip the set of flags (including debug defs, -m32) that could
be inherited from top-level LLVM build only when in-tree build is
performed. This prevents libcxx from confusingly and undesiredly
stripping user-supplied flags e.g. when performing packaging system
controlled multi-ABI build.

Otherwise, in order to perform 32-bit builds the build scripts would
have to use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many
different ABI flags for different targets, and it really makes no sense
to add separate CMake options for each possible -m* flag and then keep
a mapping from well-known flags to the custom CMake options.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 07:55:26 +00:00
Eric Fiselier
fbdbb36015 Fix possible division by zero
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 02:13:27 +00:00
Eric Fiselier
b81bbd204b Remove out of date items in TODO.txt
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 01:28:47 +00:00
Eric Fiselier
74c9857af9 Expect DLL builds on Windows by default and require a custom __config for static
builds.

On Windows the __declspec(dllimport) and __declspec(dllexport) attributes
require linking to a DLL, not a static library. Previously these annotations
were disabled by default unless _LIBCPP_DLL was defined. However the DLL
configuration is probably the more common one, so it should be supported by
default.

This patch enables import/export attributes by default and adds a
_LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this
behavior. If libc++ is built as a static library on Windows then a custom __config
header will be generated that predefines this macro.

This patch is based off work by Shoaib Meenai.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 22:19:41 +00:00
Oleg Ranevskyy
3ba3ad4ea7 [libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2
Summary: This patch fixes a couple of typos that cause compilation errors when application includes <unordered_map> and enables the libc++'s debugging capabilities.

Reviewers: EricWF

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 21:39:38 +00:00
Eric Fiselier
66bdfe223e [libc++] Extension: Make move and forward constexpr in C++11.
Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be very damaging because it makes otherwise constant expressions non-constant. For example:

```
#include <utility>
template <class T>
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe. 

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.




Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 20:55:02 +00:00
Michal Gorny
08fa01095a [include] Declare __STDC_*_MACROS for C++11 compat in old libc
Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when
the wrapper-header is included in C++11, in order to enable
the necessary macros in C99-compliant libc.

The C99 standard defined that the format macros in inttypes.h should be
defined by the C++ implementations only when __STDC_FORMAT_MACROS is
defined, and the limit and constant macros in stdint.h should be defined
only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined
appropriately. Following this specification, multiple old versions of
glibc up to 2.17 do not define those macros by default for C++,
rendering the libc++ headers non-compliant to the C++11 standard.

In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is
defined in wrapped inttypes.h just before including the system
inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS
and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This
fixes the C++11 compliance while preserving the current behavior for
C++03.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 20:20:00 +00:00
Eric Fiselier
8dc5b6eba9 Update -verify test to use new static assert message
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-25 08:30:05 +00:00
Eric Fiselier
01c3b629ce Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-25 04:05:46 +00:00
Eric Fiselier
4e3e15ad99 [libc++] Remove various C++03 feature test macros
Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-25 03:34:28 +00:00
Eric Fiselier
1deaf196f4 Use __attribute__((internal_linkage)) when available.
Summary:
This patch has been a long time coming (Thanks @eugenis). It changes `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` instead of `__attribute__((visibility("hidden"), always_inline))`.

The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from being exported from both the libc++ library and from user libraries. This helps libc++ better manage it's ABI.
Previously this was done by forcing inlining and modifying the symbols visibility. However inlining isn't guaranteed and symbol visibility only affects shared libraries making this an imperfect solution.  `internal_linkage` improves this situation by making all symbols local to the TU they are emitted in, regardless of inlining or visibility. IIRC the effect of applying `__attribute__((internal_linkage))` to an inline function is the same as applying `static`.

For more information about the attribute see: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html

Most of the work for this patch was done by @eugenis.


Reviewers: mclow.lists, eugenis

Subscribers: eugenis, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282345 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-25 03:14:13 +00:00