summaryrefslogtreecommitdiffstats
path: root/libcxx/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Hide some internal symbols for memory resource.Eric Fiselier2016-07-111-0/+5
| | | | llvm-svn: 275089
* Remove workarounds for C++17 inline variable ABI break. It has been fixed in ↵Eric Fiselier2016-07-022-11/+0
| | | | | | clang. llvm-svn: 274419
* Add another workaround for C++17 inline variable ABI breakage.Eric Fiselier2016-07-011-1/+4
| | | | llvm-svn: 274408
* Remove accidental change committed in r274403.Eric Fiselier2016-07-011-1/+1
| | | | llvm-svn: 274407
* Work around ABI break caused by C++17 inline variables.Eric Fiselier2016-07-011-1/+8
| | | | llvm-svn: 274403
* [libcxx] Fix a bug in strstreambuf::overflow.Akira Hatanaka2016-06-291-2/+1
| | | | | | | | | | | The end pointer should point to one past the end of the newly allocated buffer. rdar://problem/24265174 Differential Revision: http://reviews.llvm.org/D20334 llvm-svn: 274132
* Implement LWG 2488 - Make the placeholders constexpr.Eric Fiselier2016-06-261-10/+11
| | | | | | | | | | | | | | | | | | | This patch makes the bind placeholders in std::placeholders both (1) const and (2) constexpr (See below). This is technically a breaking change for any code using the placeholders outside of std::bind and depending on them being non-const. However I don't think this will break any real world code. (1) Previously the placeholders were non-const extern globals in all dialects. This patch changes these extern globals to be const in all dialects. Since the cv-qualifiers don't participate in name mangling for globals this is an ABI compatible change. (2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only applies to C++17 I don't see any reason not to backport this change. llvm-svn: 273824
* Cleanup filesystem::permissions ever more.Eric Fiselier2016-06-221-20/+15
| | | | llvm-svn: 273392
* Avoid unnecessary stat call in filesystem::permissions implementation.Eric Fiselier2016-06-221-1/+2
| | | | llvm-svn: 273391
* Implement LWG issue 2720. Replace perms::resolve_symlinks with ↵Eric Fiselier2016-06-211-2/+6
| | | | | | | | | | | | | | | perms::symlink_nofollow. This changes how filesystem::permissions(p, perms) handles symlinks. Previously symlinks were not resolved by default instead only getting resolved when "perms::resolve_symlinks" was used. After this change symlinks are resolved by default and perms::symlink_nofollow must be given to change this. This issue has not yet been moved to Ready status, and I will revert if it doesn't get moved at the current meeting. However I feel confident that it will and it's nice to have implementations when moving issues. llvm-svn: 273328
* Fix various undefined behavior found by UBSan.Eric Fiselier2016-06-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | * Fix non-null violation in strstream.cpp Overflow was calling memcpy with a null parameter and a size of 0. * Fix std/atomics/atomics.flag/ tests: a.test_and_set() was reading from an uninitialized atomic, but wasn't using the value. The tests now clear the flag before performing the first test_and_set. This allows UBSAN to test that clear doesn't read an invalid value. * Fix std/experimental/algorithms/alg.random.sample/sample.pass.cpp The tests were dereferencing a past-the-end pointer to an array so that they could do pointer arithmetic with it. Instead of dereference the iterator I changed the tests to use the special 'base()' test iterator method. * Add -fno-sanitize=float-divide-by-zero to suppress division by zero UBSAN diagnostics. The tests that cause float division by zero are explicitly aware that they are doing that. Since this is well defined for IEEE floats suppress the warnings for now. llvm-svn: 273107
* Fix bugs in last_write_time implementation.Eric Fiselier2016-06-191-17/+56
| | | | | | | | | | | | | | | * Fix passing a negative number as either tv_usec or tv_nsec. When file_time_type is negative and has a non-zero sub-second value we subtract 1 from tv_sec and make the sub-second duration positive. * Detect and report when 'file_time_type' cannot be represented by time_t. This happens when using large/small file_time_type values with a 32 bit time_t. There is more work to be done in the implementation. It should start to use stat's st_mtim or st_mtimeval if it's provided as an extension. That way we can provide a better resolution. llvm-svn: 273103
* Remove Apple specific guard for utimensat. Use !defined(UTIME_OMIT) instead.Eric Fiselier2016-06-181-5/+4
| | | | | | | As pointed out by @majnemer this is a better way to detect utimensat on all platforms. The Apple specific guard is unneeded. llvm-svn: 273093
* Use utimes instead of utimensat when !defined(UTIME_OMIT). Fixes build for ↵Eric Fiselier2016-06-181-1/+3
| | | | | | older GLIBC versions llvm-svn: 273088
* Enable building and using atomic shared_ptr for GCC.Eric Fiselier2016-06-181-2/+2
| | | | | | | | | | | | | | | | | Summary: Currently the implementation of [util.smartptr.shared.atomic] is provided only when using Clang, and not with GCC. This is a relic of not having a GCC implementation of <atomic>, even though <atomic> isn't actually used in the implementation. This patch enables support for atomic shared_ptr functions when using GCC. Note that this is not a header only change. Previously only Clang builds of libc++.so would provide the required symbols. There is no reason for this restriction. After this change both Clang and GCC builds should be binary compatible with each other WRT these symbols. Reviewers: mclow.lists, rmaprath, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21407 llvm-svn: 273076
* Add additional tests in an attempt to diagnose ARM test failures.Eric Fiselier2016-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Currently 4 tests are failing on the ARM buildbot. To try and diagnose each of the failures this patch does the following: 1) path.itr/iterator.pass.cpp * Temporarily print iteration sequence to see where its failing. 2) path.native.obs/string_alloc.pass.cpp * Remove test that ::new is not called when constructing a short string that requires a conversion. Since during the conversion global locale objects might be constructed. 3) fs.op.funcs/space.pass.cpp * Explicitly use uintmax_t in the implementation of space, hopefully preventing possible overflows. * Add additional tests that check for overflow is the calculation of the space_info values. * Add additional tests for the values returned from statfvs. 4) fs.op.funcs/last_write_time.pass.cpp * No changes made yet. llvm-svn: 273075
* Fix bugs in recursive_directory_iterator::increment(ec) implementation and ↵Eric Fiselier2016-06-171-9/+6
| | | | | | | | | | | | | | | tests. r273060 didn't completely fix the issues in recursive_directory_iterator and the tests. This patch follows up with more fixes * Fix bug where recursive_directory_iterator::increment(ec) did not reset the error code if no failure occurred. * Fix bad assertion in the recursive_directory_iterator::increment(ec) test that would only fire for certain iteration orders. llvm-svn: 273070
* Fix bugs in recursive_directory_iterator implementation and tests.Eric Fiselier2016-06-171-0/+3
| | | | | | | | | | | There are two fixes in this patch: * Fix bug where the constructor of recursive_directory_iterator did not reset the error code if no failure occurred. * Fix tests were dependent on the iteration order of the test directories. llvm-svn: 273060
* Add Filesystem TS -- CompleteEric Fiselier2016-06-173-0/+1402
| | | | | | | | | | | | | | Add the completed std::experimental::filesystem implementation and tests. The implementation supports C++11 or newer. The TS is built as part of 'libc++experimental.a'. Users of the TS need to manually link this library. Building and testing the TS can be disabled using the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'. Currently 'libc++experimental.a' is not installed by default. To turn on the installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'. llvm-svn: 273034
* Remove CloudABI specific workaround.Ed Schouten2016-06-161-2/+0
| | | | | | | | CloudABI has gained the mblen_l() function in the meantime that does properly return whether the character set has shift-states (read: never). llvm-svn: 272886
* Add an Android version check for GNU strerror_r.Dan Albert2016-06-151-1/+6
| | | | | | | | | | | | | | | | Summary: Android didn't gain GNU's strerror_r until Marshmallow. If we're building libc++ against something older (we build the NDK library against the oldest release we support, currently Gingerbread), fall back to the POSIX version. Reviewers: mclow.lists, EricWF Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D21402 llvm-svn: 272827
* Fix syntax error in r272640.Eric Fiselier2016-06-141-1/+2
| | | | llvm-svn: 272641
* Fix error checking for strerror_r implementations that return the error code.Eric Fiselier2016-06-141-2/+4
| | | | llvm-svn: 272640
* Make system_error::message() thread safe. Fixes PR25598.Eric Fiselier2016-06-141-1/+48
| | | | | | | | | | | | | | | | | | | | Summary: system_error::message() uses `strerror` for the generic and system categories. This function is not thread safe. The fix is to use `strerror_r`. It has been available since 2001 for GNU libc and since BSD 4.4 on FreeBSD/OS X. On platforms with GNU libc the extended version is used which always returns a valid string, even if an error occurs. In single-threaded builds `strerror` is still used. See https://llvm.org/bugs/show_bug.cgi?id=25598 Reviewers: majnemer, mclow.lists Subscribers: erik65536, cfe-commits, emaste Differential Revision: http://reviews.llvm.org/D20903 llvm-svn: 272633
* [libcxx] Fix thread join.pass.cpp segfault after r271475Asiri Rathnayake2016-06-031-4/+7
| | | | | | | | | | | | | | | Some pthread implementations do not like being called pthead_join() with the pthread_t argument set to 0, and causes a segfault. This patch fixes this issue by validating the pthread_t argument before invoking pthread_join(). NFC. Differential revision: http://reviews.llvm.org/D20929 Change-Id: Ief817c57bd0e1f43cbaa03061e02417d6a180c38 Reviewers: EricWF llvm-svn: 271634
* Fix memory_resource build for _LIBCPP_HAS_NO_THREADSEric Fiselier2016-05-071-2/+12
| | | | llvm-svn: 268850
* Fix one more usage of _LIBCPP_HAS_NO_EXCEPTIONSEric Fiselier2016-05-071-1/+1
| | | | llvm-svn: 268839
* Add <experimental/memory_resource>Eric Fiselier2016-05-072-14/+129
| | | | | | | | | | Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20007 llvm-svn: 268829
* Refactor pthread usage of libcxx.Asiri Rathnayake2016-05-065-63/+41
| | | | | | | | | | | | | This patch extracts out all the pthread dependencies of libcxx into the new header __threading_support. The motivation is to make it easy to re-target libcxx into platforms that do not support pthread. Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781 Applied with tweaks - D19412 Change-Id: I301111f0075de93dd8129416e06babc195aa936b llvm-svn: 268734
* Create new library 'libc++experimental.a' for packaging TS symbols.Eric Fiselier2016-05-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Out-of-line symbols for <experimental/...> headers are not ABI or API stable and cannot live in the 'libc++.dylib'. Currently they have nowhere to live. I would like to add a new library target `libc++experimental.a` to fix this. Previously I had suggested different libraries for different TS's (`libc++filesystem.a`, 'libc++LFTS.a`, ect). I no longer think this is the right approach. Instead `c++experimental` will hold *all* TS implementations as a single monolithic library. I see two main benefits to this: 1. Users only have to know about and manually link one library. 2. It makes it easy to implement TS's with one or two out-of-line symbols. (Ex. PMRs) `c++experimental` provides NO ABI compatibility. Symbols can freely be added/removed/changed without concern for ABI stability. I will add documentation for this after landing this patch (but before adding anything to it). `c++experimental` only builds as a static library. By default CMake will build/test this library but will *NOT* install it. This patch adds the CMake and LIT logic needed to build/test the new library. Once this lands I plan on using it to implement parts of `<experimental/memory_resource>`. Reviewers: mclow.lists Subscribers: cfe-commits, theraven, krememek, dexonsmith, bcraig, beanz, danalbert Differential Revision: http://reviews.llvm.org/D19856 llvm-svn: 268443
* Fix most GCC attribute ignored warningsEric Fiselier2016-04-211-3/+3
| | | | llvm-svn: 267074
* Reorganize _LIBCPP_LOCALE__L_EXTENSIONSBen Craig2016-03-091-178/+38
| | | | | | | | | | | | | | | | Instead of checking _LIBCPP_LOCALE_L_EXTENSIONS all over, instead check it once, and define the various *_l symbols once. The private redirector symbol names are all prefixed with _libcpp_* so that they won't conflict with user symbols, and so they won't conflict with future C library symbols. In particular, glibc likes providing private symbols such as __locale_t, so we should follow a different naming pattern (like _libcpp_*) to avoid problems on that front. Tested on Linux with glibc. Hoping for the best on OSX and the various BSDs. http://reviews.llvm.org/D17456 llvm-svn: 263016
* [libcxx] Whitelist inclusion of sysctl.h instead of blacklistingBen Craig2016-01-291-3/+8
| | | | | | | | | | | Instead of excluding all known operating systems that are not derived from BSD, I now include all operating systems that claim to be derived from BSD. Hopefully, that will make it so that this check doesn't need to change for every new operating system that comes along. http://reviews.llvm.org/D16634 llvm-svn: 259193
* [libcxx] Remove pragmas that were needed to suppress warnings producedAkira Hatanaka2016-01-282-27/+0
| | | | | | | | | by -Wpadded. We don't need these pragmas anymore because -Wpadded was removed from buildit in r258900. llvm-svn: 259023
* Add more missing license headersEric Fiselier2016-01-191-0/+9
| | | | llvm-svn: 258198
* 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
OpenPOWER on IntegriCloud