Commit Graph

3532 Commits

Author SHA1 Message Date
Saleem Abdulrasool
678eadd13f provide Win32 native threading
Add an implementation for the Win32 threading model as a backing API for
the internal c++ threading interfaces.  This uses the Fls* family for
the TLS (which has the support for adding termination callbacks),
CRITICAL_SECTIONs for the recursive mutex, and Slim Reader/Writer locks
(SRW locks) for non-recursive mutexes.  These APIs should all be
available on Vista or newer.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 03:07:45 +00:00
Eric Fiselier
32b19c3d9f [libc++] Tolerate presence of __deallocate macro
Summary:
On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK.

This patch renames all usages of `__deallocate` internally as to not conflict with the macro.

Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 03:01:24 +00:00
Saleem Abdulrasool
cc1d780758 thread: implement sleep_for on Windows
Windows does not provide an implementation of `nanosleep`.  Round up the
time duration to the nearest ms and use `Sleep`.  Although this may
over-sleep, there is no hard real-time guarantee on the wake, so
sleeping a bit more is better than under-sleeping as it within the
specification.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 02:48:30 +00:00
Shoaib Meenai
2342c11c50 [libc++] Correct macro name in documenation
The macro is named `_LIBCPP_TEMPLATE_VIS`, not `_LIBCPP_TEMPLATE_ONLY`.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 02:45:35 +00:00
Eric Fiselier
32ff3279eb Add _LIBCPP_ABI_[ITANIUM|MICROSOFT] macros.
This patch adds a libc++ configuration macro for the ABI we
are targeting, either Itanium or Microsoft. For now we configure
for the Microsoft ABI when on Windows with a compiler that defines
_MSC_VER. However this is only temporary until Clang implements
builtin macros we can use.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291329 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 02:43:58 +00:00
Stephan T. Lavavej
51eb1be9ec [libcxx] [test] Strip trailing whitespace. NFC, no code review.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 01:12:15 +00:00
Eric Fiselier
5616ee5bac Get all tuple tests passing on Windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 00:10:42 +00:00
Eric Fiselier
afd7cc87ce Fix linking of DLL's on Windows
On Windows the runtime search path for DLL's is the same as PATH.
This patch changes the test suite to add the libc++ build directory
to the runtime PATH.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291309 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 00:01:55 +00:00
Eric Fiselier
bab7b41d2e Configure default ABI library as NONE on Windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291306 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 23:59:52 +00:00
Eric Fiselier
1572c468b3 Fix breakage caused when _LIBCPP_HAS_THREAD_API_PTHREAD is manually defined
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 23:15:16 +00:00
Eric Fiselier
5170d7d88f Add _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] macros.
This patch refactors the compiler detection done in `__config` by creating a
set of `_LIBCPP_COMPILER_<TYPE>` macros. The goal of this patch is to make
it easier to detect what compiler is being used outside of `__config`.

Additionally this patch removes workarounds for GCC in `__bit_reference`. I
tested GCC 4.8 and 4.9 without the workaround and neither seemed to need it
anymore.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291286 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 21:42:58 +00:00
Eric Fiselier
8eb066a106 Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 20:58:25 +00:00
Eric Fiselier
66134e8a5f [libc++] Cleanup and document <__threading_support>
Summary:
This patch attempts to clean up the macro configuration mess in `<__threading_support>`, specifically the mess involving external threading variants. Additionally this patch adds design documentation for `<__threading_support>` and the configuration macros it uses.

The primary change in this patch is separating the idea of an "external API" provided by `<__external_threading>` and the idea of having an external threading library. Now `_LIBCPP_HAS_THREAD_API_EXTERNAL` means that libc++ should use `<__external_threading>` and that the header is expected to exist.  Additionally the new macro `_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL` is now used to configure for using an "external library"  with the default threading API.

Reviewers: compnerd, rmaprath

Subscribers: smeenai, cfe-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 20:05:40 +00:00
Saleem Abdulrasool
f3de2448e9 config_elast: fix typo (NFC)
Missed the original typo which was duplicated.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291192 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 23:25:44 +00:00
Saleem Abdulrasool
aa6429dc41 typeinfo: style adjustments for adding MS ABI RTTI
This is motivated by adding a third RTTI scheme to libc++.  Split out
the two forms of the itanium RTTI representation.  This is based on
suggestions from Eric Fiselier.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291174 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 21:22:22 +00:00
Saleem Abdulrasool
3451a65e1b thread_support: split out {,non-}recursive mutex
Split out the recursive and non-recursive mutex.  This split is needed
for platforms which may use differing types for the two mutex (e.g.
Win32 threads).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291145 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 17:54:45 +00:00
Eric Fiselier
dceaa0e352 Add gcc-[56] clang-3.[678] to list of XFAILS for variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 09:06:30 +00:00
Eric Fiselier
704ed27a81 Use C++11 static_assert in variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291093 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 09:03:43 +00:00
Eric Fiselier
20f0c0f3a6 Get tests linking on Windows.
This patch is a temporary hack to get the tests passing on
Windows.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 08:07:17 +00:00
Eric Fiselier
856712bda2 [libcxx] Fix PR31402: map::__find_equal_key has undefined behavior.
Summary:
This patch fixes llvm.org/PR31402 by replacing `map::__find_equal_key` with `__tree::__find_equal`, which has already addressed the same undefined behavior.

Unfortunately I haven't been able to write a test case which causes the UBSAN diagnostic mentioned in the bug report. I can write tests which exercise the UB but for some reason they do not cause UBSAN to fail. Any help writing a test case would be appreciated.


Reviewers: mclow.lists, vsk, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291087 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 06:06:18 +00:00
Eric Fiselier
976f3f3ea0 Fix test suite configuration when no lit.site.cfg is available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291081 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 05:18:37 +00:00
Eric Fiselier
85294a2fac Get test-suite configuring on Windows with clang-cl
This patch gets the test suite "working" on Windows, although
none of the tests pass.

In order to reuse the existing configuration, which uses UNIX
style flags not accepted by clang-cl, this patch only works with clang++.
When clang-cl is specified the test harness secretly looks for
clang++ and then it configures it using the INCLUDE and LIB enviroment
variables.

This is very much a work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291072 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 03:57:40 +00:00
Richard Smith
5a60459a22 PR31540: install libc++abi headers into include/c++/v1 in build area.
This allows an in-build-area clang binary to find <cxxabi.h>.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291065 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 02:55:10 +00:00
Eric Fiselier
d0f20b2b08 Fix XPASS buildbot failure related to structured bindings
The test was previously set to XFAIL if __cpp_structured_bindings
wasn't defined. However there are Clang 4.0 versions which do not
define this macro but do provide structured bindings, which causes
the test to pass unexpectedly.

This patch changes the XFAIL to an UNSUPPORTED.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291060 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 01:34:14 +00:00
Eric Fiselier
c3dfeced41 Fix PR26961 - Add default constructor to std::pointer_safety struct.
In ABI v1 libc++ implements std::pointer_safety as a class type instead
of an enumeration. However this class type does not provide
a default constructor as it should. This patch adds that default constructor.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 01:28:40 +00:00
Eric Fiselier
46a0c2ef0c Fix std::pointer_safety type in ABI v2
In the C++ standard `std::pointer_safety` is defined
as a C++11 strongly typed enum. However libc++ currently defines
it as a class type which simulates a C++11 enumeration. This
can be detected in valid C++ code.

This patch introduces an the _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE ABI option.
When defined `std::pointer_safety` is implemented as an enum type.
Unfortunatly this also means it can no longer be provided as an extension
in C++03.

Additionally this patch moves the definition for `get_pointer_safety()`
out of the dylib, and into the headers. New usages of `get_pointer_safety()`
will now use the inline version instead of the dylib version. However in
order to keep the dylib ABI compatible the old definition is explicitly
compiled into it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 01:15:42 +00:00
Eric Fiselier
a2e3d1e8ad Fix Sphinx build error caused by bad indentation
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291039 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 00:04:37 +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
2d2247d0da Fix private inheritance in C++03 tuple_size
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 23:35:51 +00:00
Eric Fiselier
2b3c8a28b4 Fix verify test on 32 bit systems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291031 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 23:30:06 +00:00
Marshall Clow
3df90c94a3 Implement P0505: 'Wording for GB 50'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 23:03:24 +00:00
Eric Fiselier
9c6b70a0af Use C++11 static_assert in variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291021 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 22:43:08 +00:00
Eric Fiselier
06a0febbbd [libcxx] Re-implement LWG 2770 again: Fix tuple_size to work with structured bindings
Summary:
This patch attempts to re-implement a fix for LWG 2770, but not the actual specified PR. 

The PR for 2770 specifies tuple_size<T const> as only conditionally providing a `::value` member. However C++17 structured bindings require `tuple_size<T const>` to be complete only if  `tuple_size<T>` is also complete. Therefore this patch implements only provides the specialization `tuple_size<T CV>` iff `tuple_size<T>` is a complete type.

This fixes http://llvm.org/PR31513.

Reviewers: mclow.lists, rsmith, mpark

Subscribers: mpark, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291019 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 22:38:46 +00:00
Marshall Clow
e22af6b758 Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access' for C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290976 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 17:58:17 +00:00
Saleem Abdulrasool
1fbd97cfd5 fix elast configuration on Windows targets
A typo and missing header inclusion was obscured by the litany of user
defined literal warnings.  This fixes the detection of ELAST on windows.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:50:01 +00:00
Saleem Abdulrasool
4508216a70 config: MSVC 19+ has unicode chars
MSVC 19+ and clang-cl with emulation version >= 19.00 will provide
char{16,32}_t as builtin types.  Adjust the configuration accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290940 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:49:59 +00:00
Saleem Abdulrasool
1f2d77816b build: use the platform dependent library prefix/suffix
Use the cmake variables to get the platform dependent values for the
static library prefix and suffix, which can be different from the Unix
preference for "lib", ".a" (e.g. Windows uses "", ".lib" respectively).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:49:57 +00:00
Saleem Abdulrasool
8ddd2697ae build: use more portable spelling for flag
Use `CMAKE_LIBRARY_PATH_FLAG` instead of hard-coding it to -L.  This
silences a warning with cl which expects `/LIBPATH` instead.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290938 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:49:55 +00:00
Saleem Abdulrasool
5c737d8395 Refactor bitscan64 check
Introduce a `_LIBCPP_HAS_BITSCAN64` macro to specify if the 64-bit
variant of the bitscan family of APIs is available.  This avoids
duplicating the check in the support header.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 01:53:24 +00:00
Stephan T. Lavavej
dcac520ce4 [libcxx] [test] Strip trailing whitespace.
Fixes D27786.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 00:53:41 +00:00
Stephan T. Lavavej
3169d4a451 [libcxx] [test] Fix recently introduced warnings emitted by MSVC.
These tests were using malloc()'s return value without checking for null,
which MSVC's /analyze rightly warns about. Asserting that the pointer is
non-null both expresses the test's intention and silences the warning.

Fixes D27785.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 00:53:31 +00:00
Saleem Abdulrasool
e34f9d5ef3 clean up use of _WIN32
Replace the use of _WIN32 in libc++. Replace most use with a C runtime
check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are
using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we
are on an environment that has a short wchar_t.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290910 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 21:53:51 +00:00
Asiri Rathnayake
e262e7b914 [libcxx] Add build/test support for the externally threaded libc++abi variant
Differential revision: https://reviews.llvm.org/D27576

Reviewers: EricWF

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290889 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 12:59:50 +00:00
Asiri Rathnayake
e29d9ff936 [libcxx] Fix testing of the externally-threaded library build
after r290850

Before r290850, building libcxx with -DLIBCXX_HAS_EXTERNAL_THREAD_API=ON had two
uses:
  - Allow platform vendors to plug-in an __external_threading header which
    should take care of the entire threading infrastructure of libcxx

  - Allow testing of an externally-threaded library build; where the thread API
    is declared using pthread data structures, and the implementation of this
    API is provided as a separate library (test/support/external_threads.cpp)
   and linked-in when running the test suite.

r290850 breaks the second use case (pthread data structures are no longer
available). This patch re-stores the ability to build+test an
externally-threaded library variant on a pthread based system.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 11:32:31 +00:00
Eric Fiselier
d28b523b58 Update year to 2017
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 11:20:43 +00:00
Eric Fiselier
a53a02b0da Simplify CMake target for the __generated_config header
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 11:18:17 +00:00
Saleem Abdulrasool
c79fa0442a clang-format: tweak configuration
Update the configuration to reflect the style more accurately.  Pointers
are tied to the left.  Braces are split on classes/structs and
functions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 04:23:52 +00:00
Saleem Abdulrasool
849b0c804c build: remove now unused UNIX_CAT
THe previous change replaced the use of `cat` or `type` with a custom
python script.  Remove the now unused command determining.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 04:23:50 +00:00
Eric Fiselier
1591b37ffb Fix creating __generated_config on Windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 03:55:29 +00:00
Saleem Abdulrasool
ba161f4034 system_error: provide a thread safe stringification for Windows
Provide a strerror_r replacement for Windows.  This is needed to build
libc++ for Windows with threading.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 02:00:33 +00:00