summaryrefslogtreecommitdiffstats
path: root/libcxx/include/__locale
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] Fix build breakage on mipsMikhail Maltsev2019-08-201-1/+1
| | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by https://reviews.llvm.org/D63284. Committing as obvious. llvm-svn: 369364
* [libc++] Keep __regex_word in sync with ctype_baseMikhail Maltsev2019-06-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The class ctype_base in the header <__locale> contains masks for character classification functions, which are kept in sync with platform's C library, hence it contains many special cases. The value of the bit mask __regex_word in the header <regex> must not clash with those bit masks. Currently the default case (i.e. unknown platform/C library) is handled incorrectly: the __regex_word clashes with ctype_base::punct. To avoid replicating the whole list of platforms in <regex> this patch defines __regex_word in <__locale>, so that it is always kept in sync with other masks. Reviewers: ldionne, mclow.lists, EricWF Reviewed By: ldionne Subscribers: krytarowski, christof, dexonsmith, pbarrio, simon_tatham, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D63284 llvm-svn: 363363
* [WebAssembly] WASI support for libcxxDan Gohman2019-05-011-0/+3
| | | | | | | | | | | | | This adds explicit support for the WASI platform to libcxx. WASI libc uses some components from musl, however it's not fully compatible with musl, so we're planning to stop using _LIBCPP_HAS_MUSL_LIBC and customize for WASI libc specifically. Differential Revision: https://reviews.llvm.org/D61336 Reviewers: sbc100, ldionne llvm-svn: 359703
* Fix and speedup __libcpp_locale_guard on WindowsThomas Anderson2019-03-271-19/+33
| | | | | | | | | | | | | | The old implementation assumed the POSIX `setlocale()` API where the old locale is returned. On Windows, the _new_ locale is returned. This meant that `__libcpp_locale_guard` wasn't resetting the locale on destruction. The new implementation fixes the above issue and takes advantage of `setlocale(LC_ALL)` to reduce the number of calls, and also avoids setting the locale at all if it's not necessary. Differential Revision: https://reviews.llvm.org/D59572 llvm-svn: 357104
* Work around dllimport bug with exclude_from_explicit_instantiation.Eric Fiselier2019-03-081-0/+3
| | | | | | | | | | | | When dllimport is specified on a class, and exclude_from_explicit_instatiation is specified on a member, clang-cl will still expect a definition to be available externally. But this is not correct. Surprisingly one one symbol seems to be consistently affected by this bug. So this patch simply works around it there. llvm-svn: 355760
* Fix the build with gcc when `-Wredundant-decls` is passedDimitry Andric2019-02-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: gcc warns that `__throw_runtime_error` is declared both in `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on the command line; this is the case with FreeBSD when ${WARNS} == 6. Since `<__locale>` gets its first declaration via a transitive include of `<stdexcept>`, and the second declaration is after the first invocation of `__throw_runtime_error`, delete that second declaration. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> Reviewers: kristina, MaskRay, EricWF, ldionne, ngie Reviewed By: EricWF Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D58425 llvm-svn: 354515
* 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
* [libc++] Make sure we can build libc++ with -fvisibility=hiddenLouis Dionne2018-10-251-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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-84/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | _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-84/+84
| | | | | | | | | | | | | | | _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-84/+84
| | | | | | | | | | | | | | | | | | | | 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
* support: add missing locale stubs for android L, MSaleem Abdulrasool2018-04-131-5/+1
| | | | | | | | | The strto* family was introduced in android O (API Level 26). However, the support headers were adjusted to indicate that all locale aware functions were added in L. Provide stubs for the locale aware strto* family until O. llvm-svn: 330045
* Allow to set locale on Windows.Martin Storsjo2017-11-231-1/+27
| | | | | | | | | | | | | | | Fix the problem PR31516 with setting locale on Windows by wrapping _locale_t with a pointer-like class. Reduces 74 test failures in std/localization test suite to 47 test failures (on llvm clang, Visual Studio 2015). Number of test failures doesn't depend on the platform (x86 or x64). Patch by Andrey Khalyavin. Differential Revision: https://reviews.llvm.org/D40181 llvm-svn: 318902
* Fix libcxx build with glibc 2.26+ by removing xlocale.h include.Eric Fiselier2017-08-031-1/+1
| | | | | | Patch by Khem Raj. Reviewed as D35697. Also see PR33729. llvm-svn: 309920
* Fix Libc++ build with MinGW64Eric Fiselier2017-05-311-2/+2
| | | | | | | | | | | | | | 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
* Refactor <locale> RAII guards to aid upcoming Windows locale changes.Eric Fiselier2017-05-081-0/+19
| | | | | | | | | | | | | | | | | | | 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
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-041-0/+1
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* [libcxx] Direct support for FuchsiaPetr Hosek2017-04-131-1/+3
| | | | | | | | | | | Fuchsia's libc was forked from musl, but has evolved sufficiently since then so it no longer makes sense to pretend it's musl. This change implements direct support for Fuchsia rather than piggybacking on musl support. Differential Revision: https://reviews.llvm.org/D31970 llvm-svn: 300261
* [libc++] Make _LIBCPP_TYPE_VIS export membersShoaib Meenai2017-03-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some of their members exported, otherwise we have a lot of link errors when linking against a libc++ built with hidden visibility. This also makes _LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it already exports members. With this change made, any template methods of a class marked _LIBCPP_TYPE_VIS will also get default visibility when instantiatied, which is not desirable for clients of libc++ headers who wish to control their visibility; this is the same issue as PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running bad-visibility-finder [1] against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The small methods were marked for inlining; the larger ones hidden. [1] https://github.com/smeenai/bad-visibility-finder Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25208 llvm-svn: 296732
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-8/+8
| | | | | | | | | | | | | 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
* clean up use of _WIN32Saleem Abdulrasool2017-01-031-1/+1
| | | | | | | | | 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
* [libc++] Fix and document visibility attributes for Clang, GCC and Windows.Eric Fiselier2016-09-151-6/+6
| | | | | | | | | | | | | | | | | | | | | 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 attribute noreturn to functions that throwAditya Kumar2016-08-271-0/+2
| | | | | | | | | Reviewers: mclow.lists, EricWF, howard.hinnant, sebpop Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21232 llvm-svn: 279903
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-5/+2
| | | | | | 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
* Use libcxx's default rune table with the Musl C library.Vasileios Kalintiris2015-11-241-6/+2
| | | | | | | | | | | | | | | | | 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
* Add initial support for the MUSL C library.Vasileios Kalintiris2015-11-091-3/+9
| | | | | | | | | | | | | | | | | | | 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 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
* Move Android to the builtin rune table.Dan Albert2015-03-111-7/+1
| | | | llvm-svn: 231897
* 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
* Get libc++ building on Sun Solaris. Patch from C Bergstrom.Eric Fiselier2015-01-231-0/+1
| | | | llvm-svn: 226947
* Change a couple more template parameter names from 'T' to '_Tp', etc. Thanks ↵Marshall Clow2015-01-111-1/+1
| | | | | | to Ondřej Majerech for the patch, but I did a bit more. llvm-svn: 225598
* Include newlib-specific locales in __localeSergey Dmitrouk2014-12-121-0/+2
| | | | llvm-svn: 224111
* Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.Eric Fiselier2014-11-251-1/+3
| | | | llvm-svn: 222794
* Make Android's ctype_base::mask unsigned.Dan Albert2014-07-311-1/+1
| | | | | | | Keeping the regex code sane is much easier if we match the other platforms and use an unsigned mask. llvm-svn: 214442
* Fix ctype_base::xdigit for Android.Dan Albert2014-07-231-0/+5
| | | | | | | Android's ctype implementation comes from openbsd, which for some reason doesn't consider numbers to be hex digits. llvm-svn: 213785
* Add support for BIONIC C library (Android). Patch from Dan AlbertMarshall Clow2014-07-101-3/+12
| | | | llvm-svn: 212724
* Fix misguided #elif - it checked the value of _AIX instead of defined(_AIX). ↵Marshall Clow2014-03-111-1/+1
| | | | | | Thanks to Johan Bergström for the bug report. llvm-svn: 203589
* Patch by Bruce Mitchener. Change all references to EMSCRIPTEN to ↵Marshall Clow2013-11-191-6/+6
| | | | | | __EMSCRIPTEN__. If you're not using the PP symbol EMSCRIPTEN, then you should see no functionality change. llvm-svn: 195136
* Patch by GM: Making implicit conversion to bool explicit in <ios> and <__locale>Marshall Clow2013-10-211-1/+1
| | | | llvm-svn: 193085
* G M: Restore the ability for libcxx to compile again on mingw 64.Howard Hinnant2013-09-171-1/+1
| | | | llvm-svn: 190837
* Xing Xue: Fix type-o. Thanks to C. Bergström for spotting it.Howard Hinnant2013-08-301-1/+1
| | | | llvm-svn: 189674
* Xing Xue: Some minor changes for IBM XLC++/AIX.Howard Hinnant2013-08-291-1/+1
| | | | llvm-svn: 189623
* Debug mode for string. This commit also marks the first time libc++ ↵Howard Hinnant2013-08-231-6/+6
| | | | | | debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib. llvm-svn: 189114
* Xing Xue: port to IBM XLC++/AIX.Howard Hinnant2013-08-141-2/+4
| | | | llvm-svn: 188396
* Nico Rieck: this patch series fixes visibility issues on Windows as ↵Howard Hinnant2013-08-121-12/+12
| | | | | | explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. llvm-svn: 188192
* Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which isHoward Hinnant2013-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can also define _MSC_VER, and MSVCRT is not necessarily the only C runtime, these macros should not be used interchangeably. This patch divides all Windows-related bits into the aforementioned categories. Two new macros are introduced: - _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using _MSC_VER, excluding Clang. - _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default when _WIN32 is defined. This leaves _WIN32 for code using the Windows API. This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF. Nico, please prepare a patch for CREDITS.TXT, thanks. llvm-svn: 187593
* Add NetBSD support.Joerg Sonnenberger2013-05-171-2/+10
| | | | llvm-svn: 182162
* Bruce Mitchener, Jr.: Port to emscripten. Fixes ↵Howard Hinnant2013-03-291-5/+7
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=15624. llvm-svn: 178354
* Removed raw references to __sun__, __FreeBSD__, __GLIBC__ and __linux__; now ↵Marshall Clow2013-03-181-6/+6
| | | | | | just check to see if they are defined. llvm-svn: 177310
* Removed raw references to __APPLE__; now just check to see if it is defined.Marshall Clow2013-03-181-1/+1
| | | | llvm-svn: 177297
OpenPOWER on IntegriCloud