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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Refactor the header to allow us to implement alternate threading models
with alternate data structures. Take the opportunity to clang-format
the area. This will allow us to avoid re-declaring the interfaces for
Win32 threading. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290850 91177308-0d34-0410-b5e6-96231b3b80d8
This patch re-commits a previous attempt to support building libc++ w/o
an ABI library. That patch was originally reverted because:
1) It forgot to teach the test suite about "default" ABI libraries.
2) Some LLVM builders don't clear the CMake cache between builds. The previous
patch caused those builders to fail since their old cache entry for
LIBCXX_CXX_ABI="" is no longer valid.
The updated patch addresses both issues. It works around (2) by adding
a hack to force the builders to update their cache entries. The hack will
be removed shortly once all LLVM builders have run.
Original commit message
-----------------------
Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).
The main changes in this patch are:
1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.
Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290849 91177308-0d34-0410-b5e6-96231b3b80d8
This patch implements the correct PR for LWG 2770. It also makes the primary
tuple_size template incomplete again which fixes part of llvm.org/PR31513.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290846 91177308-0d34-0410-b5e6-96231b3b80d8
Currently libc++ compiles a special version of error_category()
into the dylib. This definition is no longer needed, and doesn't
work on Windows due to dllimport/dllexport semantics.
For those reasons this patch introduces an option to
disable/enable this definition. By default the definition
is provided in ABI v1 except on windows. This patch
also addresses D28210.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290840 91177308-0d34-0410-b5e6-96231b3b80d8
Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).
The main changes in this patch are:
1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.
Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290839 91177308-0d34-0410-b5e6-96231b3b80d8
Move the windows specific macro definitions for compiling c++ into the
target. Add a number of newer options that are necessary to properly
build libc++ for windows. This ensures that we do not accidentally
autolink msvcprt (Microsoft's C++ runtime library), do not define linker
pragmas which are msvcprt specific, and do not accidentally encode the
incorrect version of the msvc compatibility version.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290837 91177308-0d34-0410-b5e6-96231b3b80d8
Disable the manifest bundling on Windows when cross-compiling on
not-Windows. With this, it is possible to execute the link command from
CMake which will use cmake to invoke the manifest tool to generate a
manifest and pass that to the linker.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290836 91177308-0d34-0410-b5e6-96231b3b80d8
The locale structures have been made opaque in CRT 14+. This currently
prevents building libc++ for Windows. We can re-enable this in the
future when we have replicated the structure to access the private field
for the name (unless there exists a better supported mechanism to query
the name of a locale given the locale_t).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290835 91177308-0d34-0410-b5e6-96231b3b80d8
In the previous fix I used a PMF type as a semi-safe bool type in C++03.
However immediately after committing I realized clang offered explicit
conversion operators as an extension. This patch removes the old fix and
enables _LIBCPP_EXPLICIT using __has_extension instead.
This change also affects the following other classes, which have
'_LIBCPP_EXPLICIT operator bool()'.
* shared_ptr
* unique_ptr
* error_condition
* basic_ios
* function (already C++11 only)
* istream::sentry
* experimental::string_view.
In all of the above cases I believe it is safe to enable the extension, except
in the experimental::string_view case. There seem to be some Clang bugs
affecting the experimental::string_view conversion to std::basic_string. To
work around that I manually disabled _LIBCPP_EXPLICIT in that case.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290831 91177308-0d34-0410-b5e6-96231b3b80d8
As pointed out by Howard, this is actually 134774 days (* 24 * 3600),
and therefore seconds, not 100ns units. Adjust the units to reflect
reality.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290824 91177308-0d34-0410-b5e6-96231b3b80d8