summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Use __is_identifier to detect Clang extensions instead of __has_extension.Eric Fiselier2017-01-141-3/+5
| | | | | | | | | | | | | | | | | | | | | When -pedantic-errors is specified `__has_extension(<feature>)` is always false when it would otherwise be true. This causes C++03 <atomic> to break along with other issues. This patch avoids the above problem by using __is_identifier(...) instead since it is not affected by -pedantic-errors. For example instead of checking for __has_extension(c_atomics) we now check `!__is_identifier(_Atomic)`, which is only true when _Atomic is not a keyword provided by the compiler. This patch applies similar changes to the detection logic for __decltype and __nullptr as well. Note that it does not apply this change to the C++03 `static_assert` macro since -Wc11-extensions warnings generated by expanding that macro will appear in user code, and will not be suppressed as part of a system header. llvm-svn: 291995
* Remove unused parameters in C++03Eric Fiselier2017-01-141-4/+4
| | | | llvm-svn: 291986
* Diagnose invalid memory orderings in <atomic>Eric Fiselier2017-01-132-2/+34
| | | | llvm-svn: 291976
* Diagnose non-const-callable hash functions and comparatorsEric Fiselier2017-01-134-23/+41
| | | | llvm-svn: 291969
* Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.Eric Fiselier2017-01-134-4/+53
| | | | | | | | | | | | | | | | | | Clang recently added a `diagnose_if(cond, msg, type)` attribute which can be used to generate diagnostics when `cond` is a constant expression that evaluates to true. Otherwise no attribute has no effect. This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which use this new attribute. Additionally this patch implements a diagnostic message when a non-const-callable comparator is given to a container. Note: For now the warning version of the diagnostic is useless within libc++ since warning diagnostics are suppressed by the system header pragma. I'm going to work on fixing this. llvm-svn: 291961
* Update version to 5.0Eric Fiselier2017-01-132-2/+2
| | | | llvm-svn: 291928
* Fix merge conflict caused by r291921Eric Fiselier2017-01-131-1/+1
| | | | llvm-svn: 291925
* Revert "Rework fix for PR19460 - Use explicit bool as an extension instead."Eric Fiselier2017-01-133-7/+19
| | | | | | This reverts commit 3a1b90a866b6d5d62a5f37fbfb3a1ee36cc70dd1. llvm-svn: 291921
* Add new macro _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR to use in std::char_traits. Marshall Clow2017-01-121-0/+9
| | | | | | | This tells whether or not the builtin function __builtin_memcmp is constexpr. Only defined for clang 4.0 and later, and not true for any shipping version of Apple's clang. llvm-svn: 291773
* disable use of __builtin_memcmp temporarily to get the tests passing againMarshall Clow2017-01-121-3/+24
| | | | llvm-svn: 291742
* Implement P0426: Constexpr for std::char_traitsMarshall Clow2017-01-121-51/+135
| | | | llvm-svn: 291741
* Qualify some type names that I thought were fine, but some of the bots don't ↵Marshall Clow2017-01-101-2/+3
| | | | | | like. llvm-svn: 291580
* Fix up some mismatched SFINAE conditionsin shared_ptr; some used '_Tp*', ↵Marshall Clow2017-01-101-15/+17
| | | | | | others used 'element_type *'. Today, they're the same - but soon they won't be. No functional change. llvm-svn: 291572
* threading_support: delete the critical sectionSaleem Abdulrasool2017-01-101-1/+1
| | | | | | | Although the CriticalSection itself doesnt need to be destroyed, there may be debug data associated with it. Plug a possible small leak. llvm-svn: 291536
* Adorn __call_once_proxy with `inline` and `_LIBCPP_INLINE_VISIBILITY`Justin Bogner2017-01-091-0/+1
| | | | | | | As per discussion with mclow and EricWF on irc, this is small and simple enough to deserve being inlined. llvm-svn: 291497
* Swap two lines in __mutex_base. On systems with high clock rates, we could ↵Marshall Clow2017-01-091-1/+1
| | | | | | mistakenly return no_timeout when a mutex had timed out if we got a tick between these two lines. Thanks to Brian Cain for the bug report. llvm-svn: 291492
* Move _PairT declaration out of __hash_combine to avoid warning under C++98Dimitry Andric2017-01-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Some parts of the FreeBSD tree are still compiled with C++98, and until rL288554 this has always worked fine. After that, a complaint about the newly introduced local _PairT is produced: /usr/include/c++/v1/memory:3354:27: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] typedef __scalar_hash<_PairT> _HashT; ^~~~~~ /usr/include/c++/v1/memory:3284:29: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args] : public unary_function<_Tp, size_t> ^~~ /usr/include/c++/v1/memory:3356:12: note: in instantiation of template class 'std::__1::__scalar_hash<_PairT, 2>' requested here return _HashT()(__p); ^ As far as I can see, there should be no problem moving the _PairT struct to just before the __hash_combine() function, which fixes this particular warning. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D28472 llvm-svn: 291476
* Implement P0403R1 - 'Literal suffixes for basic_string_view'. Requires clang ↵Marshall Clow2017-01-091-0/+37
| | | | | | 4.0 (specifically, r290744) llvm-svn: 291457
* Replace identifiers called `__out` because Windows.h #defines it.Eric Fiselier2017-01-074-51/+51
| | | | | | | | Windows is greedy and it defines the identifier `__out` as a macro. This patch renames all conflicting libc++ identifiers in order to correctly work on Windows. llvm-svn: 291345
* provide Win32 native threadingSaleem Abdulrasool2017-01-073-9/+263
| | | | | | | | | | | 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. llvm-svn: 291333
* [libc++] Tolerate presence of __deallocate macroEric Fiselier2017-01-078-51/+20
| | | | | | | | | | | | | | | 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 llvm-svn: 291332
* Add _LIBCPP_ABI_[ITANIUM|MICROSOFT] macros.Eric Fiselier2017-01-071-0/+9
| | | | | | | | | | 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. llvm-svn: 291329
* Fix breakage caused when _LIBCPP_HAS_THREAD_API_PTHREAD is manually definedEric Fiselier2017-01-061-4/+3
| | | | llvm-svn: 291298
* Add _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] macros.Eric Fiselier2017-01-064-31/+31
| | | | | | | | | | | | 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. llvm-svn: 291286
* Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANGEric Fiselier2017-01-067-41/+16
| | | | llvm-svn: 291278
* [libc++] Cleanup and document <__threading_support>Eric Fiselier2017-01-063-41/+21
| | | | | | | | | | | | | | | 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 llvm-svn: 291275
* typeinfo: style adjustments for adding MS ABI RTTISaleem Abdulrasool2017-01-051-43/+62
| | | | | | | | 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 llvm-svn: 291174
* thread_support: split out {,non-}recursive mutexSaleem Abdulrasool2017-01-052-4/+39
| | | | | | | | 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). llvm-svn: 291145
* [libcxx] Fix PR31402: map::__find_equal_key has undefined behavior.Eric Fiselier2017-01-052-68/+20
| | | | | | | | | | | | | | | | 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 llvm-svn: 291087
* Fix PR26961 - Add default constructor to std::pointer_safety struct.Eric Fiselier2017-01-051-0/+3
| | | | | | | | 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. llvm-svn: 291059
* Fix std::pointer_safety type in ABI v2Eric Fiselier2017-01-052-1/+29
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 291046
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-0467-764/+764
| | | | | | | | | | | | | 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. llvm-svn: 291035
* Fix private inheritance in C++03 tuple_sizeEric Fiselier2017-01-041-3/+3
| | | | llvm-svn: 291032
* Implement P0505: 'Wording for GB 50'Marshall Clow2017-01-041-18/+18
| | | | llvm-svn: 291028
* [libcxx] Re-implement LWG 2770 again: Fix tuple_size to work with structured ↵Eric Fiselier2017-01-041-17/+22
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 291019
* Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to ↵Marshall Clow2017-01-042-47/+47
| | | | | | reverse_iterator, move_iterator, array and Range Access' for C++17 llvm-svn: 290976
* config: MSVC 19+ has unicode charsSaleem Abdulrasool2017-01-041-0/+2
| | | | | | | MSVC 19+ and clang-cl with emulation version >= 19.00 will provide char{16,32}_t as builtin types. Adjust the configuration accordingly. llvm-svn: 290940
* Refactor bitscan64 checkSaleem Abdulrasool2017-01-042-3/+5
| | | | | | | | 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. llvm-svn: 290924
* clean up use of _WIN32Saleem Abdulrasool2017-01-034-21/+29
| | | | | | | | | 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. llvm-svn: 290910
* [libcxx] Add build/test support for the externally threaded libc++abi variantAsiri Rathnayake2017-01-031-5/+32
| | | | | | | Differential revision: https://reviews.llvm.org/D27576 Reviewers: EricWF llvm-svn: 290889
* [libcxx] Fix testing of the externally-threaded library buildAsiri Rathnayake2017-01-031-3/+17
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 290878
* Simplify CMake target for the __generated_config headerEric Fiselier2017-01-031-4/+1
| | | | llvm-svn: 290875
* build: remove now unused UNIX_CATSaleem Abdulrasool2017-01-031-4/+0
| | | | | | | THe previous change replaced the use of `cat` or `type` with a custom python script. Remove the now unused command determining. llvm-svn: 290856
* Fix creating __generated_config on WindowsEric Fiselier2017-01-031-2/+7
| | | | llvm-svn: 290853
* threading_support: refactor for Win32 threadingSaleem Abdulrasool2017-01-031-81/+113
| | | | | | | | | 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 llvm-svn: 290850
* Re-implement LWG 2770 - Fix tuple_size with structured bindings.Eric Fiselier2017-01-022-5/+18
| | | | | | | 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. llvm-svn: 290846
* Fix use of throw(...) spec with GCC in C++17Eric Fiselier2017-01-021-1/+1
| | | | llvm-svn: 290845
* Introduce _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR ABI option.Eric Fiselier2017-01-022-1/+6
| | | | | | | | | | | | | 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. llvm-svn: 290840
* Rework fix for PR19460 - Use explicit bool as an extension instead.Eric Fiselier2017-01-023-19/+7
| | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 290831
* locale: update ctype access for MSVC CRT 14+Saleem Abdulrasool2017-01-021-1/+5
| | | | | | | | | | | Visual C++ 14 and newer split msvcrt into msvcrt and ucrt with flavours of the ucrt for different environments. This changed the access to the ctype table by introducing the `__pctype_func` and `__pwctype_func` accessors. Use this rather than directly accessing `_ctype` which allows us to be safer in threaded situations by going through the libc locking. llvm-svn: 290823
OpenPOWER on IntegriCloud