summaryrefslogtreecommitdiffstats
path: root/libcxx/include/locale
Commit message (Collapse)AuthorAgeFilesLines
* [NFC][libcxx] Remove trailing whitespaceLouis Dionne2019-05-291-3/+3
| | | | | | It's incredibly annoying when trying to create diffs llvm-svn: 361981
* [libc++] Unconditionally enable the __pad_and_output optimizationLouis Dionne2019-04-181-6/+0
| | | | | | | | | | This used to be guarded on whether the deployment target was greater than macosx10.8, however testing against the dylibs for 10.8 and earlier with the function enabled works too. The revision that introduced __pad_and_output is r164241 and it does not mention a reason for the guard. llvm-svn: 358677
* add a test and a couple minor bug fixes for the ↵Marshall Clow2019-02-011-1/+1
| | | | | | implicit-signed-integer-truncation sanitizer. This is PR#40566 llvm-svn: 352926
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is ↵Petr Hosek2019-01-131-0/+6
| | | | | | | | | | | | missing When catopen is missing, do_open, do_get and do_close end up being no-op, and as such their parameters will be unused which triggers a warning/error when building with -Wunused-parameter. Differential Revision: https://reviews.llvm.org/D56023 llvm-svn: 351027
* Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308Marshall Clow2018-12-111-0/+1
| | | | llvm-svn: 348828
* [libcxx] Make sure we can build with -fvisibility=hidden on LinuxLouis Dionne2018-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit marks a few functions as hidden and removes them from the ABI list on Linux such that libc++ can be built with -fvisibility=hidden. The functions marked as hidden by this patch were exported from the shared object only because they were implicitly instantiated function templates. It is safe to stop exporting those symbols from the shared object because nobody could actually depend on them: implicit instantiations are not taken from shared objects. The symbols removed in this commit are basically the same that had been removed in https://reviews.llvm.org/D53868, but that patch had to be reverted because it broke the build (because the functions were not marked as hidden like this patch does). Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54639 llvm-svn: 347395
* [libc++] Make sure we can build libc++ with -fvisibility=hiddenLouis Dionne2018-10-251-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: When building with -fvisibility=hidden, some symbols do not get exported from libc++.dylib. This means that some entities are not explicitly given default visibility in the source code, and that we rely on the fact -fvisibility=default is the default. This commit explicitly gives default visibility to those symbols to avoid being dependent on the command line flags used. The commit also remove symbols from the dylib -- those symbols do not actually need to be exported from the dylib and this should not be an ABI break. Finally, in the future, we may want to mark the whole std:: namespace as having hidden visibility (to switch from opt-out to opt-in), in which case the changes done in this commit will be required. Reviewers: EricWF Subscribers: mgorny, christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D52662 llvm-svn: 345260
* [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-111-88/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Note that this commit had originally been applied in r336369 and then reverted in r336382 because of unforeseen problems. Both of these problems have now been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, erikvanderpoel Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336866
* Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-051-88/+88
| | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY" This reverts commit r336369. The commit had two problems: 1. __pbump was marked as _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY instead of _LIBCPP_INLINE_VISIBILITY, which lead to two symbols being added in the dylib and the check-cxx-abilist failing. 2. The LLDB tests started failing because they undefine `_LIBCPP_INLINE_VISIBILITY`. I need to figure out why they do that and fix the tests before we can go forward with this change. llvm-svn: 336382
* [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITYLouis Dionne2018-07-051-88/+88
| | | | | | | | | | | | | | | | | | | | Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Reviewers: EricWF Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336369
* Fix PR36914 - num_get::get(unsigned) incorrectly handles negative numbers.Eric Fiselier2018-03-291-7/+8
| | | | | | | | | This patch corrects num_get for unsigned types to support strings with a leading `-` character. According to the standard the number should be parsed as an unsigned integer and then negated. llvm-svn: 328751
* Make pbump (internally) handle sizes bigger than MAX_INT. Fixes PR#33725 - ↵Marshall Clow2017-09-121-1/+1
| | | | | | thanks to Jonathan Wakely for the report llvm-svn: 313031
* [locale] Avoid copy of __atoms when char_type is charAditya Kumar2017-06-141-6/+66
| | | | | | | | | | | | | | | The function num_get<_CharT>::stage2_int_prep makes unnecessary copy of src into atoms when char_type is char. This can be avoided by creating a switch on type and just returning __src when char_type is char. Added the test case to demonstrate performance improvement. In order to avoid ABI incompatibilities, the changes are guarded with a macro _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET Differential Revision: https://reviews.llvm.org/D30268 Reviewed by: EricWF llvm-svn: 305427
* Add some const_casts in places where we were implicitly casting away ↵Marshall Clow2017-06-141-2/+3
| | | | | | constness. No functional change, but now they're explicit llvm-svn: 305410
* Fix Libc++ build with MinGW64Eric Fiselier2017-05-311-8/+1
| | | | | | | | | | | | | | Summary: This patch corrects the build errors I encountered when building on MinGW64. Reviewers: mati865, rnk, compnerd, smeenai, bcraig Reviewed By: mati865, smeenai Subscribers: martell, chapuni, cfe-commits Differential Revision: https://reviews.llvm.org/D33082 llvm-svn: 304360
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-6/+10
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Refactor <locale> RAII guards to aid upcoming Windows locale changes.Eric Fiselier2017-05-081-3/+0
| | | | | | | | | | | | | | | | | | | Previously <locale> used std::unique_ptr<remove_ptr<locale_t>, locale-mgmt-function> as a scope guard for (A) creating new locales, and (B) setting the thread specific locale in RAII safe manner. However using unique_ptr has some problems, first it requires that locale_t is a pointer type, which may not be the case (Windows will need a non-pointer locale_t type that emulates _locale_t). The second problem is that users of the guards had to supply the locale management function to the custom deleter at every call site. However these locale management functions don't exist natively Windows, making a good Windows implementation of locale more difficult. This patch creates distinct and simply RAII guards that replace unique_ptr. These guards handle calling the correct locale management function so that callers don't have too. This simplification will aid in upcoming Windows fixes. llvm-svn: 302474
* Fix DLL import for __time_get_c_storage member functions.Eric Fiselier2017-05-081-0/+16
| | | | llvm-svn: 302390
* Ensure showbase does not overflow do_put buffersDimitry Andric2017-05-061-0/+4
| | | | | | | | | | | | | | | | | | | | | Summary: In https://bugs.freebsd.org/207918, Daniel McRobb describes how using std::showbase with ostreams can cause truncation of unsigned long long when output format is octal. In fact, this can even happen with unsigned int and unsigned long. To ensure this does not happen, add one additional character to the do_put buffers if std::showbase is on. Also add a test case. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D32670 llvm-svn: 302362
* Fix new warnings emitted by GCC 7Eric Fiselier2017-05-051-1/+1
| | | | llvm-svn: 302280
* Cleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <bitset>, <ios>, ↵Eric Fiselier2017-04-191-3/+3
| | | | | | <locale>, and <iterator> llvm-svn: 300648
* [libc++] Explicitly mark specializations as dllexportShoaib Meenai2017-04-031-4/+4
| | | | | | | | | Method specializations don't get exported even if there's an exported extern template instantiation on Windows. Explicitly mark the methods for export. They're already exported on Linux and Darwin, so there's no ABI change on those platforms. llvm-svn: 299348
* [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export membersShoaib Meenai2017-03-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building libc++ with hidden visibility, we want explicit template instantiations to export members. This is consistent with existing Windows behavior, and is necessary for clients to be able to link against a hidden visibility built libc++ without running into lots of missing symbols. An unfortunate side effect, however, is that any template methods of a class with an explicit instantiation will get default visibility when instantiated, unless the methods are explicitly marked inline or hidden visibility. This is not desirable for clients of libc++ headers who wish to control their visibility, and led to PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running https://github.com/smeenai/bad-visibility-finder against the libc++ headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The methods were marked with the new _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS macro, which was created for this purpose. It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally intended to expand to default visibility, and was changed to expanding to default type visibility to fix PR30642. The visibility macro documentation was not updated accordingly, however, so this change makes the macro consistent with its documentation again, while explicitly fixing the methods which resulted in that PR. Differential Revision: https://reviews.llvm.org/D29157 llvm-svn: 296731
* [libc++] Mark some std::num_get method templates inlineShoaib Meenai2017-03-021-3/+3
| | | | | | | | | | | | | | | | | D29157 will make explicit template instantiations expand to default visibility, at which point these method templates will need to be explicitly marked hidden visibility to avoid leaking into other DSOs. Unfortunately, because of clang PR32114, they must be marked inline (in conjunction with `-fvisibility-inlines-hidden`) to actually hide them, since clang doesn't respect the hidden visibility annotation. Since this involves an ABI change, mark these methods inline in a separate change, so that the ABI changes can be reviewed separately and verified to be safe. Differential Revision: https://reviews.llvm.org/D30523 llvm-svn: 296729
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-16/+16
| | | | | | | | | | | | | 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
* [libc++] Make __num_get_float hiddenShoaib Meenai2016-12-241-0/+1
| | | | | | | | | | | It's an internal function and shouldn't be exported. It's also a source of discrepancy in the published ABI list; these symbols aren't exported for me on CentOS 7 or Ubuntu 16.04, leading to spurious check-cxx-abilist failures. Differential Revision: https://reviews.llvm.org/D27153 llvm-svn: 290503
* Fix unused parameters and variablesEric Fiselier2016-12-231-1/+2
| | | | llvm-svn: 290459
* [libc++] Fix and document visibility attributes for Clang, GCC and Windows.Eric Fiselier2016-09-151-36/+36
| | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a number of problems with the visibility macros across GCC (on Unix) and Windows (DLL import/export semantics). All of the visibility macros are now documented under `DesignDocs/VisibilityMacros.rst`. Now I'll no longer forget the subtleties of each! This patch adds two new visibility macros: * `_LIBCPP_ENUM_VIS` for controlling the typeinfo of enum types. Only Clang supports this. * `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` for redefining visibility on explicit instantiation declarations. Clang and Windows require this. After applying this patch GCC only emits one -Wattribute warning opposed to 30+. Reviewers: mclow.lists, EricWF Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24602 llvm-svn: 281673
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-6/+6
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* Fix PR28079 - std::wstring_convert move constructor broken.Eric Fiselier2016-06-261-1/+1
| | | | | | | | | | | | | The move constructor for wstring_convert accidentally copied the state member into the converted count member in the move constructor. This patch fixes the typo. While working on this I discovered that wstring_convert doesn't actually provide a move constructor according to the standard and therefore this constructor is a libc++ extension. I'll look further into whether libc++ should provide this constructor at all. Neither libstdc++ or MSVC's STL provide it. llvm-svn: 273831
* Implement LWG issue 1169. num_get not fully compatible with strto*Eric Fiselier2016-06-191-3/+28
| | | | | | | | | | | Use strtof and strtod for floats and doubles respectively instead of always using strtold. The other parts of the change are already implemented in libc++. This patch also has a drive by fix to wbuffer_convert::underflow() which prevents it from calling memmove(buff, null, 0). llvm-svn: 273106
* Fix PR21428 for long. Buffer was one byte too small in octal formatting ↵Eric Fiselier2016-04-291-1/+1
| | | | | | case. Rename previously added test llvm-svn: 268009
* Reorganize _LIBCPP_LOCALE__L_EXTENSIONSBen Craig2016-03-091-260/+21
| | | | | | | | | | | | | | | | 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
* Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov2015-11-071-3/+6
| | | | | | | | | | | | This change moves visibility attributes from out-of-class method definitions to in-class declaration. This is needed for a switch to attribute((internal_linkage)) (see http://reviews.llvm.org/D13925) which can only appear on the first declaration. This change does not touch istream/ostream/streambuf. They are handled separately in http://reviews.llvm.org/D14409. llvm-svn: 252385
* Remove a switch statement, and replace with a bunch of ifs to silence a ↵Marshall Clow2015-08-271-11/+2
| | | | | | warning about 'all the enumeration values covered'. No functional change. llvm-svn: 246150
* [libcxx] Disable -Wnon-virtual-dtor warning in <locale>Eric Fiselier2015-08-181-0/+3
| | | | | | | | | | | | | | | | Summary: Normally people won't see warnings in libc++ headers, but if they compile with "-Wsystem-headers -Wnon-virtual-dtor" they will likely see issues in <locale>. In the libc++ implementation `time_get' has a private base class, `__time_get_c_storage`, with virtual methods but a non-virtual destructor. `time_get` itself can safely be used as a polymorphic base class because it inherits a virtual destructor from `locale::facet`. To placate the compiler we change `__time_get_c_storage`'s destructor from public to protected, ensuring that it will never be deleted polymorphically. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11670 llvm-svn: 245333
* Cleanup: prefer _LIBCPP_GET_C_LOCALE over __cloc().Ed Schouten2015-07-061-19/+17
| | | | | | | | | | | | | 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
* Add support for kfreebsd. Thanks to Jan HenkeSylvestre Ledru2015-03-191-1/+1
| | | | | | | Reported on the Debian BTS: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780106 llvm-svn: 232714
* Disable cat*() on CloudABI. Also make tiny cleanups.Ed Schouten2015-03-111-11/+12
| | | | | | | | | | | | | | | | 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
* 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
* Fix PR21428. Buffer was one byte too small in octal formatting case. Add testMarshall Clow2015-01-261-1/+1
| | | | llvm-svn: 227097
* [libcxx] Fix use of operator comma where the types can be user definedEric Fiselier2014-10-271-5/+5
| | | | | | | | | | | | | | | | Summary: An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected. Modify all the test iterators to define operator comma. Reviewers: danalbert, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5929 llvm-svn: 220706
* PR #21321 talked about implementation-defined behavior of realloc. I ↵Marshall Clow2014-10-271-0/+2
| | | | | | poo-poohed it, and was wrong. Fix the call in <locale>. Review the others, refactored some duplicated code, and found overflow bugs (and __event_cap_ was never getting updated, either). llvm-svn: 220702
* Support newlib as libc++'s C library [locale part]Jonathan Roelofs2014-09-191-4/+10
| | | | | | http://reviews.llvm.org/D5385 llvm-svn: 218144
* Change Windows decoration on some base classesSaleem Abdulrasool2014-07-161-2/+2
| | | | | | | | | | | Mark the base classes for time_get_byname and time_get as _LIBCPP_TYPE_VIS_ONLY rather than _LIBCPP_TYPE_VIS. These base classes are templated types and cannot be stored with export dll storage. Fixes compilation with _LIBCPP_DLL for Windows when the time_get and time_get_byname classes are used. llvm-svn: 213116
* Add support for BIONIC C library (Android). Patch from Dan AlbertMarshall Clow2014-07-101-7/+7
| | | | llvm-svn: 212724
* Fix bug 19740; round-tripping a pointer through a stream doesn't workMarshall Clow2014-05-211-3/+3
| | | | llvm-svn: 209305
* Fix typosAlp Toker2014-05-151-3/+3
| | | | llvm-svn: 208869
* Avoid signed vs unsigned compare warnings. From Dimitry Andric.Joerg Sonnenberger2014-02-071-4/+4
| | | | llvm-svn: 200993
OpenPOWER on IntegriCloud