summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
* Also enable the default rune table on CloudABI.Ed Schouten2015-03-121-1/+1
| | | | | | CloudABI does not expose a table on its own. llvm-svn: 232050
* Add option to disable access to the global filesystem namespace.Ed Schouten2015-03-123-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Systems like FreeBSD's Capsicum and Nuxi CloudABI apply the concept of capability-based security on the way processes can interact with the filesystem API. It is no longer possible to interact with the VFS through calls like open(), unlink(), rename(), etc. Instead, processes are only allowed to interact with files and directories to which they have been granted access. The *at() functions can be used for this purpose. This change adds a new config switch called _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE. If set, all functionality that requires the global filesystem namespace will be disabled. More concretely: - fstream's open() function will be removed. - cstdio will no longer pull in fopen(), rename(), etc. - The test suite's get_temp_file_name() will be removed. This will cause all tests that use the global filesystem namespace to break, but will at least make all the other tests run (as get_temp_file_name will not build anyway). It is important to mention that this change will make fstream rather useless on those systems for now. Still, I'd rather not have fstream disabled entirely, as it is of course possible to come up with an extension for fstream that would allow access to local filesystem namespaces (e.g., by adding an openat() member function). Differential revision: http://reviews.llvm.org/D8194 Reviewed by: jroelofs (thanks!) llvm-svn: 232049
* Fix ctype_byname<wchar_t>::do_is() mask checking.... againJonathan Roelofs2015-03-111-0/+4
| | | | | | | | | 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
* Disable cat*() on CloudABI. Also make tiny cleanups.Ed Schouten2015-03-112-11/+17
| | | | | | | | | | | | | | | | On a new platform that I am working on (https://github.com/NuxiNL/cloudlibc) I am not implementing the cat{open,close,gets}() API, just like Android, Newlib, etc. Instead of adding yet another operating system name to the #ifs, introduce _LIBCPP_HAS_CATOPEN in include/__config. Also adjust the code to only pull in nl_types.h when _LIBCPP_HAS_CATOPEN is set. We only needed this header for the cat*() API. Differential Revision: http://reviews.llvm.org/D8163 Reviewed by: marshall llvm-svn: 231937
* Move Android to the builtin rune table.Dan Albert2015-03-112-7/+5
| | | | llvm-svn: 231897
* Also use LC_C_LOCALE on CloudABI.Ed Schouten2015-03-101-1/+1
| | | | | | | | | Before I discovered that NetBSD provides a permanent handle to the C locale called LC_C_LOCALE, I also added support for this to CloudABI under the name LC_POSIX_LOCALE. I've renamed it to LC_C_LOCALE to improve compatibility. llvm-svn: 231780
* Enable _LIBCPP_LOCALE__L_EXTENSIONS on CloudABI.Ed Schouten2015-03-101-1/+2
| | | | | | | | CloudABI provides the _l() functions that are part of POSIX.1-2008, but also the extensions that are available on systems like OS X and *BSD (scanf_l, printf_l, etc). llvm-svn: 231777
* Print log/error messages on stderr, not stdoutEd Schouten2015-03-101-1/+1
| | | | | | | | | | | | 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-102-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [libcxx] Fix __RAII_IncreaseAnnotator for increases >= 1Eric Fiselier2015-03-101-3/+3
| | | | | | | | | | | | | | Summary: Fix suggested by @mclow.lists on D8109. Store the size of the un-poisoned vector upon construction instead of calculating it later. Reviewers: titus, mclow.lists, kcc, EricWF Reviewed By: EricWF Subscribers: mclow.lists, cfe-commits Differential Revision: http://reviews.llvm.org/D8172 llvm-svn: 231729
* Fix another -Wunused-local-typedef warning in include/__tree.Dimitry Andric2015-03-091-1/+0
| | | | | | | | | The _Pp typedef in __tree<_Tp, _Compare, _Allocator>::__count_multi() isn't used anywhere, so adding _LIBCPP_UNUSED is unecessary. Differential Revision: http://reviews.llvm.org/D8140 llvm-svn: 231705
* Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the ↵Marshall Clow2015-03-091-26/+16
| | | | | | bug because there's more work to do here llvm-svn: 231672
* Rework reverse_iterator::operator[] so as not to use the base iterators ↵Marshall Clow2015-03-051-1/+1
| | | | | | operator [], which can cause constness problems. Fixes PR17883 llvm-svn: 231375
* Allow declaration of map and multimap iterator with incomplete mapped type. ↵Eric Fiselier2015-03-032-31/+58
| | | | | | Patch from eugenis llvm-svn: 231119
* cmath: account for MSVCRT 12.0 changesSaleem Abdulrasool2015-02-282-3/+13
| | | | | | | | | | | | | | MSVCRT 12.0 introduces better compatibility for C99. This includes a number of math routines that were previously undefined. Use the crtversion.h header to detect the version of MSVCRT being targeted and avoid re-declaring the variables. Since copysign has been introduced in MSVCRT, importing the definition via using makes it difficult to provide overloads (due to minor differences between throw () and noexcept. Avoid defining the overloads on newer MSVCRT targets. llvm-svn: 230867
* libc++: support newlib's ctypeJF Bastien2015-02-251-7/+20
| | | | | | | | | | | | 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
* Add trailing return types (and noexcept specifications) to the 'diamond ↵Marshall Clow2015-02-252-19/+57
| | | | | | operators'. Fixes PR#22600. llvm-svn: 230484
* Make the forward declaration for array swap have the same inline/visibility ↵Marshall Clow2015-02-241-0/+1
| | | | | | attributes as the definition. Thanks to Steven Wu for the catch. llvm-svn: 230330
* Change string_view::at to make it work with gcc and VC++. Thanks to K-ballo ↵Marshall Clow2015-02-231-4/+1
| | | | | | for the bug report, and Jonathan Wakeley for the code review in the bar. llvm-svn: 230260
* [libc++] Try and prevent evaluation of `is_default_constructible` on tuples ↵Eric Fiselier2015-02-212-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default constructor if it is not needed. Summary: Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should. ``` #include <type_traits> template <class T> struct IllFormedDefaultImp { IllFormedDefaultImp(T x) : value(x) {} constexpr IllFormedDefaultImp() {} T value; }; typedef IllFormedDefaultImp<int &> IllFormedDefault; template <class T, class U> struct pair { template <bool Dummy = true, class = typename std::enable_if< std::is_default_constructible<T>::value && std::is_default_constructible<U>::value && Dummy>::type > constexpr pair() : first(), second() {} pair(T const & t, U const & u) : first(t), second(u) {} T first; U second; }; int main() { int x = 1; IllFormedDefault v(x); pair<IllFormedDefault, IllFormedDefault> p(v, v); } ``` One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple. Reviewers: mclow.lists, rsmith, K-ballo, EricWF Reviewed By: EricWF Subscribers: ldionne, cfe-commits Differential Revision: http://reviews.llvm.org/D7569 llvm-svn: 230120
* More on adding sized deallocation functions in libc++: Continuing from ↵Larisse Voufo2015-02-201-2/+6
| | | | | | r229281, this adds version guards and test cases. llvm-svn: 229968
* Make basic_streambuf::xsputn write characters in chunks whenever possible, ↵Marshall Clow2015-02-191-5/+16
| | | | | | instead of one at a time. References PR#10193 llvm-svn: 229866
* Remove several unused forward declarations. Fixes PR22605.Marshall Clow2015-02-183-13/+1
| | | | llvm-svn: 229728
* Move the default template arguments into the forward declarations for the ↵Marshall Clow2015-02-182-4/+4
| | | | | | container adapters: stack and queue. References PR#22605. llvm-svn: 229708
* Move the default template arguments into the forward declarations for the ↵Marshall Clow2015-02-183-5/+6
| | | | | | containers: deque, forwardlist and list. References PR#22605. llvm-svn: 229705
* Enable testing with _LIBCPP_DEBUG and fix bad assertions in string_view.Eric Fiselier2015-02-181-2/+2
| | | | llvm-svn: 229698
* [libc++] Fix PR20084 - std::is_function<void() const> failed.Eric Fiselier2015-02-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces some black magic to detect const and volatile qualified function types such as `void () const`. The patch works in the following way: We first rule out any type that satisfies on of the following. These restrictions are important so that the test below works properly. * `is_class<_Tp>::value` * `is_union<_Tp>::value` * `is_void<_Tp>::value` * `is_reference<_Tp>::value` * `__is_nullptr_t<_Tp>::value` If none of the above is true we perform overload resolution on `__source<_Tp>(0)` to determine the return type. * If `_Tp&` is well-formed we select `_Tp& __source(int)`. `_Tp&` is only ill formed for cv void types and cv/ref qualified function types. * Otherwise we select `__dummy_type __source(...)`. Since we know `_Tp` cannot be void then it must be a function type. let `R` be the returned from `__source<_Tp>(0)`. We perform overload resolution on `__test<_Tp>(R)`. * If `R` is `__dummy_type` we call `true_type __test(__dummy_type)`. * if `R` is `_Tp&` and `_Tp&` decays to `_Tp*` we call `true_type __test(_Tp*)`. Only references to function types decay to a pointer of the same type. * In all other cases we call `false_type __test(...)`. `__source<_Tp>(0)` will try and form `_Tp&` in the return type. if `_Tp&` is not well formed the return type of `__source<_Tp>(0)` will be dummy type. `_Tp&` is only ill-formed for cv/ref qualified function types (and void which is dealt with elsewhere). This fixes PR20084 - http://llvm.org/bugs/show_bug.cgi?id=20084 Reviewers: rsmith, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7573 llvm-svn: 229696
* [libcxx] Add <experimental/ratio>Eric Fiselier2015-02-171-0/+77
| | | | | | | | | | | | | | | | | Summary: This patch is pretty simple. It just adds the _v traits from <ratio>. The draft can be found here. Reviewers: jroelofs, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7351 llvm-svn: 229509
* Implement C++14's sized deallocation functions, since there are no longer ↵Larisse Voufo2015-02-151-0/+10
| | | | | | implicitly defined by clang, as of r229241. llvm-svn: 229281
* Handle function name conflicts in _LIBCPP_MSVCRT modeSaleem Abdulrasool2015-02-138-0/+28
| | | | | | | | | | Visual Studio's SAL extension uses a macro named __deallocate. This macro is used pervasively, and gets included through various different ways. This conflicts with the similarly named interfaces in libc++. Introduce a undef header similar to __undef_min_max to handle this. This fixes a number of errors due to the macro replacing the function name. llvm-svn: 229162
* cctype: tweak inclusions for _LIBCPP_MSVCRT caseSaleem Abdulrasool2015-02-131-0/+1
| | | | | | | | cctype uses ctype functions such as isblank. However, when building against msvcrt, this is provided by the support header. Include the support header if building for Windows to ensure that the definition is properly visible. llvm-svn: 229161
* Rooting out more undefined behavior in char_traits.Marshall Clow2015-02-131-8/+8
| | | | llvm-svn: 229119
* Move the test for zero-length into the char_traits (from string_view). Add ↵Marshall Clow2015-02-122-3/+3
| | | | | | tests to char_traits specializations llvm-svn: 228981
* Fixed a problem that UBSAN found, where we were calling memcmp(null, p, 0) - ↵Marshall Clow2015-02-121-1/+1
| | | | | | which is undefined behavior llvm-svn: 228952
* Change some template parameter names from _C and _N to _Cont and _Sz. No ↵Marshall Clow2015-02-111-14/+14
| | | | | | functionality change. llvm-svn: 228843
* Fix PR 22541: When values are equal, minmax should return the rightmost one ↵Marshall Clow2015-02-111-6/+6
| | | | | | in the initializer_list llvm-svn: 228839
* Add pragma system header to some experimental headers and add newlines to files.Eric Fiselier2015-02-105-2/+21
| | | | llvm-svn: 228712
* Fix more issues exposed by -pedantic-errors in c++03 modeEric Fiselier2015-02-102-2/+2
| | | | llvm-svn: 228711
* [libcxx] Fix PR 22468 - std::function<void()> does not accept ↵Eric Fiselier2015-02-104-6/+88
| | | | | | | | | | | | | | | | | | | non-void-returning functions Summary: The bug can be found here: http://llvm.org/bugs/show_bug.cgi?id=22468 `__invoke_void_return_wrapper` is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause `function::operator()(...)` to not compile. Reviewers: eugenis, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7444 llvm-svn: 228705
* [libcxx] Properly convert the count arguments to the *_n algorithms before use.Eric Fiselier2015-02-102-6/+56
| | | | | | | | | | | | | | | | | Summary: The requirement on the `Size` type passed to *_n algorithms is that it is convertible to an integral type. This means we can't use a variable of type `Size` directly. Instead we need to convert it to an integral type first. The problem is finding out what integral type to convert it to. `__convert_to_integral` figures out what integral type to convert it to and performs the conversion, It also promotes the resulting integral type so that it is at least as big as an integer. `__convert_to_integral` also has a special case for converting enums. This should only work on non-scoped enumerations because it does not apply an explicit conversion from the enum to its underlying type. Reviewers: chandlerc, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7449 llvm-svn: 228704
* Remove use of _[A-Z] identifiers and poison them to detect usageEric Fiselier2015-02-052-19/+19
| | | | llvm-svn: 228353
* Get tests running with warnings. Fix warnings in headers and testsEric Fiselier2015-02-052-5/+0
| | | | llvm-svn: 228344
* Fix unused private field warning in stdexcept after r207695.Dimitry Andric2015-02-052-1/+7
| | | | | | | | | | | | | | Add a new _LIBCPP_UNUSED define in __config, which can be used to indicate explicitly unused items, and apply it to the __imp__ field of __libcpp_refstring. Somebody who knows about Microsoft C++ and IBM C++ should fill in the unused attribute syntax appropriate for those compilers, if there is any. Differential Revision: http://reviews.llvm.org/D6836 llvm-svn: 228281
* Fix some -Wundef issues.Dan Albert2015-02-051-2/+2
| | | | llvm-svn: 228266
* [libcxx] Add <experimental/system_error>Eric Fiselier2015-02-031-0/+59
| | | | | | | | | | | | | | | | | | Summary: This patch just adds the variable templates in <experimental/system_error>. see: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#syserror Reviewers: jroelofs, danalbert, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: chandlerc, cfe-commits Differential Revision: http://reviews.llvm.org/D7353 llvm-svn: 227973
* Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib ↵Jonathan Roelofs2015-02-032-3/+8
| | | | | | | | is the libc EricWF has updated the compilers on his buildbots. Hopefully they won't crash now. llvm-svn: 227971
* Rename pow2 functions in __hash_table to reflect that they are hash specificEric Fiselier2015-02-021-8/+8
| | | | llvm-svn: 227866
* [libcxx] Add <experimental/chrono>Eric Fiselier2015-02-022-0/+59
| | | | | | | | | | | | | | | | | Summary: This patch adds <experimental/chrono> which only contains a single variable template. See: https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#time Reviewers: jroelofs, danalbert, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7352 llvm-svn: 227860
* Fix PR#22433. The algorithm is_partitioned was testing an item in the middle ↵Marshall Clow2015-02-021-0/+3
| | | | | | of the sequence twice. llvm-svn: 227824
* Fix PR#22427. The implementation of inplace_merge had a \'small data set\' ↵Marshall Clow2015-02-021-13/+3
| | | | | | optimization; if either half of the merge was small (i.e, less than 9 items), it did an inplace merge rather than allocating a buffer and doing a faster/smarter merge. However, this failed to satisfy the complexity requirements in the standard. Remove that code. Add tests to check the complexity, and add the same tests for std::merge, since we are in that section of the test suite anyway. llvm-svn: 227811
OpenPOWER on IntegriCloud