summaryrefslogtreecommitdiffstats
path: root/libcxx/src
Commit message (Collapse)AuthorAgeFilesLines
* Use libcxx's default rune table with the Musl C library.Vasileios Kalintiris2015-11-241-12/+12
| | | | | | | | | | | | | | | | | Summary: Also, there are no exported character type tables from Musl so we have to Fallback to the standard functions. This reduces the number of libcxx's test-suite failures down to ~130 for MIPS. Most of the remaining failures come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and thread tests. Reviewers: mclow.lists, EricWF, dalias, jroelofs Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D14926 llvm-svn: 253972
* Make it possible to build a no-exceptions variant of libcxx.Asiri Rathnayake2015-11-101-0/+2
| | | | | | | | | | | | Fixes a small omission in libcxx that prevents libcxx being built when -DLIBCXX_ENABLE_EXCEPTIONS=0 is specified. This patch adds XFAILS to all those tests that are currently failing on the new -fno-exceptions library variant. Follow-up patches will update the tests (progressively) to cope with the new library variant. Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a llvm-svn: 252598
* Add initial support for the MUSL C library.Vasileios Kalintiris2015-11-091-13/+17
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the LIBCXX_LIBC_IS_MUSL cmake option to allow the building of libcxx with the Musl C library. The option is necessary as Musl does not provide any predefined macro in order to test for its presence, like GLIBC. Most of the changes specify the correct path to choose through the various #if/#else constructs in the locale code. Depends on D13407. Reviewers: mclow.lists, jroelofs, EricWF Subscribers: jfb, tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D13673 llvm-svn: 252457
* Fix an unfortunate yet old typo that never got attention before r250507.Benjamin Kramer2015-10-161-1/+1
| | | | | | Should fix the xcode libc++ build. llvm-svn: 250508
* Remove a long-standing __has_include hack.Benjamin Kramer2015-10-164-25/+8
| | | | | | | | | This was put in to get libc++ building without libcxxabi. We now have macros that show that we are building against libcxxabi so use that instead. This guards against existing but broken cxxabi.h headers on the system. llvm-svn: 250507
* Add placeholder __libcpp_relaxed_store() for when atomic builtins are not ↵Dimitry Andric2015-09-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | available. Summary: In rL241532, atomic_support.h was added, which provides handling of atomic operations for libc++. When atomic builtins are not available, it emits a warning about being unsupported, but it still provides a number of stubs for the required functions. However, it misses a stub for `__libcpp_relaxed_store()`. Add it, by using the same implementation as for `__libcpp_atomic_store()`. (Note that I encountered this on arm-freebsd, which still defaults to armv4, and does not have the runtime libcalls to support atomic builtins. For now, I have simply disabled using them.) Reviewers: mclow.lists, EricWF Subscribers: theraven, cfe-commits, jroelofs, majnemer, aemerson Differential Revision: http://reviews.llvm.org/D13051 llvm-svn: 248313
* Fix a typo: overidden -> overridden - Patch from Kai ZhaoEric Fiselier2015-08-201-1/+1
| | | | llvm-svn: 245539
* [libcxx] Allow use of <atomic> in C++03. Try 3.Eric Fiselier2015-08-192-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: After putting this question up on cfe-dev I have decided that it would be best to allow the use of `<atomic>` in C++03. Although static initialization is a concern the syntax required to get it is C++11 only. Meaning that C++11 constant static initialization cannot silently break in C++03, it will always cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` remain defined in C++03 even though they cannot be used because C++03 usages will cause better error messages. The main change in this patch is to replace `__has_feature(cxx_atomic)`, which only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns true whenever clang supports the required atomic builtins. This patch adds the following macros: * `_LIBCPP_HAS_C_ATOMIC_IMP` - Defined on clang versions which provide the C `_Atomic` keyword. * `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback atomic implementation. * `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include `<atomic>`. `_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually exclusive, only one should be defined. If neither is defined then `<atomic>` is not implemented and including `<atomic>` will issue an error. Reviewers: chandlerc, jroelofs, mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11555 llvm-svn: 245463
* Remove commented out TODOs. They defined unneeded methods.Eric Fiselier2015-08-191-4/+0
| | | | llvm-svn: 245411
* Move atomic_support.h and config_elast.h into src/includeEric Fiselier2015-08-186-4/+4
| | | | llvm-svn: 245354
* Mark any as done and comment out extra methods until speaking to MarshallEric Fiselier2015-07-311-3/+3
| | | | llvm-svn: 243729
* [libcxx] Add <experimental/any> v2.Eric Fiselier2015-07-311-0/+22
| | | | | | | | | | | | | | | | Summary: This patch adds the second revision of <experimental/any>. I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any Reviewers: danalbert, jroelofs, K-ballo, mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6762 llvm-svn: 243728
* [libcxx] Add atomic_support.h header to src that handles needed atomic ↵Eric Fiselier2015-07-073-10/+159
| | | | | | | | | | | | | | | | | | | | | operations. Summary: In some places in libc++ we need to use the `__atomic_*` builtins. This patch adds a header that provides access to those builtins in a uniform way from within the dylib source. If the compiler building the dylib does not support these builtins then a warning is issued. Only relaxed loads are needed within the headers. A singe function to do these relaxed loads has been added to `<memory>`. This patch applies the new atomic builtins to `__shared_count` and `call_once`. Reviewers: mclow.lists Subscribers: majnemer, jroelofs, cfe-commits Differential Revision: http://reviews.llvm.org/D10406 llvm-svn: 241532
* Make locale code compile on CloudABI.Ed Schouten2015-07-061-10/+13
| | | | | | | | | | | | | | | | | | | After r241454 landed, libc++'s locale code compiles on CloudABI, with the exception of the following two bits: - CloudABI doesn't have setlocale(), as the C library does not keep track of any global state. The global locale is always set to "C". Disable the call to setlocale() on this system. - Similarly, mbtowc_l() is also not present, as it is also not thread-safe. As CloudABI does not support state-dependent encodings, simply disable that part of the logic. The locale code now compiles out of the box on CloudABI. Differential Revision: http://reviews.llvm.org/D10729 Reviewed by: jroelofs llvm-svn: 241455
* Cleanup: prefer _LIBCPP_GET_C_LOCALE over __cloc().Ed Schouten2015-07-061-11/+11
| | | | | | | | | | | | | The __cloc() function is only present in case the environment does not provide a way to refer to the C locale using a compile-time constant expression. _LIBCPP_GET_C_LOCALE seems to be defined unconditionally. This improves compilation of the locale code on CloudABI. Differential Revision: http://reviews.llvm.org/D10690 Reviewed by: jroelofs llvm-svn: 241454
* Implement N4508: shared_mutex. Reviewed as http://reviews.llvm.org/D10480Marshall Clow2015-06-301-7/+18
| | | | llvm-svn: 241067
* When building libc++, we use '"' as a delimiter instead of '<' when ↵Marshall Clow2015-06-232-4/+4
| | | | | | including libc++ header files. This is so that the dylib gets built with our headers; rather than the system-installed ones. We do this in most places already, just fixing a couple of inconsistent uses. llvm-svn: 240412
* Fix PR23293 - Do not unlock shared state before notifying consumers.Eric Fiselier2015-06-121-5/+0
| | | | | | | | Within the shared state methods do not unlock the lock guards manually. This could cause a race condition where the shared state is destroyed before the method is complete. llvm-svn: 239577
* Avoid C-style cast.Joerg Sonnenberger2015-06-051-1/+1
| | | | llvm-svn: 239160
* Move uncaught_exeption() definition inside the #ifdef block like ↵Marshall Clow2015-06-021-1/+1
| | | | | | uncaught_exceptions() llvm-svn: 238879
* Implement uncaught_exceptions() using the newly added hooks in libc++abi, ↵Marshall Clow2015-06-021-5/+11
| | | | | | when available llvm-svn: 238846
* Fix building and testing libc++ with GCC.Eric Fiselier2015-05-201-1/+1
| | | | | | | | | | | | | | | | The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a bug when building libc++ with GCC. Because GCC does not support __has_include we need to explicitly tell it that we are building against libc++abi via the preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`. The changes in include/ratio are to work around CWG defect 1712 (constexpr variable template declarations). GCC 4.8 and before has not adopted the resolution to this defect. The changes in include/exception work around an issue where is_final is used without it being defined in type_traits. llvm-svn: 237767
* Fix for LWG Issue 2458: N3778 and new library deallocation signatures.Marshall Clow2015-05-181-14/+0
| | | | llvm-svn: 237592
* Use clock_gettime()'s CLOCK_REALTIME instead of gettimeofday().Ed Schouten2015-05-141-24/+40
| | | | | | | | | | | | | | | | | | | | | The system_clock::now() function currently uses gettimeofday(). The problem with gettimeofday() is that it is an obsolete XSI function, hence unavailable on CloudABI. See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html Change this code to use clock_gettime() with CLOCK_REALTIME instead, which is more consistent, as clock_gettime() is already used for steady_clock. A previous version of this change actually attempted to change system_clock::duration, but I reverted this part as it breaks the existing ABI. Differential Revision: http://reviews.llvm.org/D8253 Approved by: jroelofs llvm-svn: 237390
* Fix -Wpessimizing-move warning by remove the call to std::move.Richard Trieu2015-04-301-1/+1
| | | | llvm-svn: 236265
* Make the presence of stdin and stdout optional.Ed Schouten2015-03-261-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea behind Nuxi CloudABI is that it is targeted at (but not limited to) running networked services in a sandboxed environment. The model behind stdin, stdout and stderr is strongly focused on interactive tools in a command shell. CloudABI does not support the notion of stdin and stdout, as 'standard input/output' does not apply to services. The concept of stderr does makes sense though, as services do need some mechanism to log error messages in a uniform way. This patch extends libc++ in such a way that std::cin and std::cout and the associated <cstdio>/<cwchar> functions can be disabled through the flags _LIBCPP_HAS_NO_STDIN and _LIBCPP_HAS_NO_STDOUT, respectively. At the same time it attempts to clean up src/iostream.cpp a bit. Instead of using a single array of mbstate_t objects and hardcoding the array indices, it creates separate objects that declared next to the iostream objects and their buffers. The code is also restructured by interleaving the construction and setup of c* and wc* objects. That way it is more obvious that this is done identically. The c* and wc* objects already have separate unit tests. Make use of this fact by adding XFAILs in case libcpp-has-no-std* is set. That way the tests work in both directions. If stdin or stdout is disabled, these tests will therefore test for the absence of c* and wc*. Differential Revision: http://reviews.llvm.org/D8340 llvm-svn: 233275
* Remove the state_types array.Ed Schouten2015-03-261-8/+12
| | | | | | | | | | | | | | | If we want to add support for making std::cin and std::cout optional, it is impractical to have all of the mbstate_t objects in one array. This would mean that if std::cin and std::cout are omitted, the state_types array is only used partially. Solve this by using separate global variables. These are placed right next to the iostream object and the buffer, meaning we can easily #ifdef them away. Differential Revision: http://reviews.llvm.org/D8359 llvm-svn: 233274
* Fix incorrect error handling of call to mbrtowc. This is PR#13759. Leaving ↵Marshall Clow2015-03-231-1/+1
| | | | | | the bug open because (1) I'm not sure that we're correct here, only better than before, and (2) no tests llvm-svn: 233012
* Fix use after free and calls to operator comma in debug modeEric Fiselier2015-03-191-1/+1
| | | | llvm-svn: 232703
* Clean up iostream creation in preparation for conditionalizing streams.Ed Schouten2015-03-171-18/+20
| | | | | | | | | | | | Interleave the code for narrow and wide character streams. This makes it more obvious that the two pieces of code are identical. Furthermore, it makes it easier to conditionally compile support for certain streams, as less #ifdef blocks are needed. Differential Revision: http://reviews.llvm.org/D8342 Reviewed by: marshall llvm-svn: 232516
* Fix build break on Solaris introduced by r231940Jonathan Roelofs2015-03-131-0/+2
| | | | | | | | | Solaris apparently doesn't have iswblank_l. Thanks to C Bergstrom for the report! llvm-svn: 232172
* Fix ctype_byname<wchar_t>::do_is() mask checking.... againJonathan Roelofs2015-03-111-30/+38
| | | | | | | | | This basically reverts the revert in r216508, and fixes a few more cases while I'm at it. Reading my commit message on that commit again, I think it's bupkis. http://reviews.llvm.org/D8237 llvm-svn: 231940
* Move Android to the builtin rune table.Dan Albert2015-03-111-2/+0
| | | | llvm-svn: 231897
* Don't include <sys/sysctl.h> on CloudABI.Ed Schouten2015-03-101-2/+2
| | | | | | | As CloudABI does not provide sysctl(), this header is not present. Make thread.cpp build correctly (and pass all tests) by not including the header. llvm-svn: 231768
* Print log/error messages on stderr, not stdoutEd Schouten2015-03-102-9/+9
| | | | | | | | | | | | There are a couple of places where libc++ prints log/error messages to stdout on its own. This may of course interfere with the output generated with applications. Log/error messages should be directed to stderr instead. Differential Revision: http://reviews.llvm.org/D8135 Reviewed by: marshall llvm-svn: 231767
* Add support for arc4random() to random_device.Ed Schouten2015-03-101-35/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | Nuxi CloudABI (https://github.com/NuxiNL/cloudlibc) does not allow processes to access the global filesystem namespace. This breaks random_device, as it attempts to use /dev/{u,}random. This change adds support for arc4random(), which is present on CloudABI. In my opinion it would also make sense to use arc4random() on other operating systems, such as *BSD and Mac OS X, but I'd rather leave that to the maintainers of the respective platforms. Switching to arc4random() does change the ABI. This change also attempts to make some cleanups to the code. It adds a single #define for every random interface, instead of testing against operating systems explicitly. As discussed, also validate the token argument to be equal to "/dev/urandom" on all systems that only provide pseudo-random numbers. This should cause little to no breakage, as "/dev/urandom" is also the default argument value. Reviewed by: jfb Differential Revision: http://reviews.llvm.org/D8134 llvm-svn: 231764
* Nbjoerg suggested a better name for the macro for the default rune table: ↵Marshall Clow2015-03-041-1/+1
| | | | | | _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE llvm-svn: 231255
* Create a default rune table for libc++. Initial setting - never enabled. The ↵Marshall Clow2015-03-041-0/+82
| | | | | | expectation is that some targets (Android, cough) will enable it. Note that this is an implementation detail, not an interface change. llvm-svn: 231252
* libc++: support newlib's ctypeJF Bastien2015-02-251-0/+3
| | | | | | | | | | | | Summary: Newlib supports ctype differently from other platforms, this patch teaches libc++ about yet another platform that does ctype differently. Reviewers: jroelofs Subscribers: cfe-commits, danalbert, EricWF, jvoung, jfb, mclow.lists Differential Revision: http://reviews.llvm.org/D7888 llvm-svn: 230557
* Reword ELAST warningJF Bastien2015-02-241-1/+1
| | | | | | | | | | | | | | | | Summary: GCC emits a pretty amusing warning when there are apostrophes in a #warning: ```warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]``` Reword the warning to avoid this, and be more consistent with other warnings in libc++. Reviewers: danalbert Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7818 llvm-svn: 230298
* More on adding sized deallocation functions in libc++: Continuing from ↵Larisse Voufo2015-02-201-8/+8
| | | | | | r229281, this adds version guards and test cases. llvm-svn: 229968
* Implement C++14's sized deallocation functions, since there are no longer ↵Larisse Voufo2015-02-151-1/+29
| | | | | | implicitly defined by clang, as of r229241. llvm-svn: 229281
* libc++: remove unused variable in random_device::operator()()JF Bastien2015-02-041-1/+0
| | | | | | | | | | Reviewers: jvoung Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7416 llvm-svn: 228183
* Get libc++ building on Sun Solaris. Patch from C Bergstrom.Eric Fiselier2015-01-231-200/+13
| | | | llvm-svn: 226947
* [libcxx] Set _LIBCPP_ELAST for mingw.Dan Albert2015-01-063-7/+50
| | | | | | | | | | | | Reviewers: K-ballo, mclow.lists, EricWF Reviewed By: EricWF Subscribers: jfb, jroelofs, majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D6558 llvm-svn: 225273
* Fix building and running tests when LIBCXX_ENABLE_EXCEPTIONS or ↵Eric Fiselier2014-12-121-1/+1
| | | | | | LIBCXX_ENABLE_RTTI are turned off. llvm-svn: 224095
* Add all the relational operators to std::experimental::optional. Also update ↵Marshall Clow2014-12-091-3/+2
| | | | | | bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though. llvm-svn: 223775
* libc++: support NaCl when building thread.cppJF Bastien2014-12-021-4/+4
| | | | | | | | | | | | | | Summary: NaCl shouldn't include sysctl.h when trying to determine std::thread::hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std::thread::hardware_concurrency > 0. Test Plan: make check-libcxx Reviewers: dschuff, danalbert Subscribers: jfb, cfe-commits Differential Revision: http://reviews.llvm.org/D6470 llvm-svn: 223128
* libc++: add NaCl and PNaCl support for std::random_deviceJF Bastien2014-12-011-6/+43
| | | | | | | | | | | | | | | | | Summary: The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random. This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided). Test Plan: ninja check-libcxx Reviewers: dschuff, mclow.lists, danalbert Subscribers: jfb, cfe-commits Differential Revision: http://reviews.llvm.org/D6442 llvm-svn: 223068
* Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.Eric Fiselier2014-11-251-1/+1
| | | | llvm-svn: 222794
OpenPOWER on IntegriCloud