Commit Graph

151 Commits

Author SHA1 Message Date
Xiang Xiao
3285c7a436 [libcxx] Remove the locale fallback for NuttX
Since these functions can handled by NuttX's libc now

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108895
2021-08-31 09:46:55 -04:00
Arthur O'Dwyer
bfbd73f87d [libc++] Alphabetize and include-what-you-use. NFCI.
Differential Revision: https://reviews.llvm.org/D102781
2021-05-29 19:54:48 -04:00
Martin Storsjö
3a6be27978 [libcxx] Make the visibility attributes consistent for __narrow_to_utf8/__widen_from_utf8
Use the same visiblity attributes as for all other template
specializations in the same file; declare the specialization itself
using _LIBCPP_TYPE_VIS, and don't use _LIBCPP_EXPORTED_FROM_ABI on
the destructor. Methods that are excluded from the ABI are marked
with _LIBCPP_INLINE_VISIBILITY.

This makes the vtable exported from DLL builds of libc++. Practically,
it doesn't make any difference for the CI configuration, but it
can make a difference in mingw setups.

Differential Revision: https://reviews.llvm.org/D102717
2021-05-25 22:57:16 +03:00
Arthur O'Dwyer
5c40c994c3 [libc++] s/_LIBCPP_NO_HAS_CHAR8_T/_LIBCPP_HAS_NO_CHAR8_T/g
This was raised in D94511.

Differential Revision: https://reviews.llvm.org/D100736
2021-04-21 12:49:07 -04:00
Louis Dionne
4cd6ca102a [libc++] NFC: Normalize #endif // comment indentation 2021-04-20 12:03:32 -04:00
Louis Dionne
b51756819a [libc++] Rename include/support to include/__support
We do ship those headers, so the directory name should not be something
that can potentially conflict with user-defined directories.

Differential Revision: https://reviews.llvm.org/D95956
2021-02-04 10:16:33 -05:00
Louis Dionne
68dba7eae1 [libc++] Unbreak the debug mode
When the Debug mode is enabled, we disable extern declarations because we
don't want to use the functions compiled in the library, which might not
have had the debug mode enabled when built. However, some extern declarations
need to be kept, because code correctness depends on it.

31e820378b removed those declarations, which had the unintended
consequence of breaking the debug build. This commit fixes that by
re-introducing a separate macro for the required extern declarations,
and adds a comment so that we don't fall into that trap in the future.

Differential Revision: https://reviews.llvm.org/D94718
2021-01-19 14:15:31 -05:00
Reid Kleckner
4f24d0dd53 Fix libc++ clang-cl build, swap attribute order
Clang insists that __attribute__ attributes precede __declspec
attributes. This is a longstanding known issue:
https://llvm.org/pr24559. Re-order the visibility and deprecation macros
to fix the build.

Differential Revision: https://reviews.llvm.org/D94788
2021-01-15 11:44:13 -08:00
Brad Smith
79f99ba65d [libcxx] Port to OpenBSD
Add initial OpenBSD support.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D94205
2021-01-12 14:21:11 -05:00
Arthur O'Dwyer
3696227c10 [libc++] ADL-proof by adding _VSTD:: qualifications to memmove etc.
Generally these calls aren't vulnerable to ADL because they involve only
primitive types. The ones in <list> and <vector> drag in namespace std
but that's OK; the ones in <fstream> and <strstream> are vulnerable
iff `CharT` is an enum type, which seems far-fetched.
But absolutely zero of them *need* ADL to happen; so in my opinion
they should all be consistently qualified, just like calls to any
other (non-user-customizable) functions in namespace std.

Also: Include <cstring> and <cwchar> in <__string>.
We seemed to be getting lucky that <memory> included <iterator>
included <iosfwd> included <wchar.h>. That gave us the
global-namespace `wmemmove`, but not `_VSTD::wmemmove`.
This is now fixed.

I didn't touch these headers:
<ext/__hash> uses strlen, safely
<support/ibm/locale_mgmt_aix.h> uses memcpy, safely
<string.h> uses memchr and strchr, safely
<wchar.h> uses wcschr, safely
<__bsd_locale_fallbacks.h> uses wcsnrtombs, safely

Differential Revision: https://reviews.llvm.org/D93061
2020-12-10 22:03:12 -05:00
Marek Kurdej
a984dcaf7c [libc++] [P0482] [C++20] Implement missing bits for codecvt and codecvt_byname.
Add codecvt*<char16_t, char8_t> and codecvt*<char32_t, char8_t>.
Deprecate codecvt<char(16|32)_t, char>.
Enable disabled tests.
Update _LIBCPP_STD_VER to use 20 for C++20. Add _LIBCPP_DEPRECATED_IN_CXX20 macro.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D91517
2020-12-02 09:01:58 +01:00
Bruce Mitchener
527a7fdfbd [libc++] Replace several uses of 0 by nullptr
Differential Revision: https://reviews.llvm.org/D43159
2020-11-27 10:00:21 -05:00
Xiang Xiao
f0785c1f7a [libcxx] Port to NuttX (https://nuttx.apache.org) RTOS
Since NuttX conform to POSIX standard, the code need to add is very simple.

Differential Revision: https://reviews.llvm.org/D88718
2020-11-18 16:20:56 -05:00
Xiang Xiao
20acf6d588 [libcxx] Check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in __locale
This is consistent with what's done in locale.cpp, and it ensures that
we get the default rune table whenever _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
is defined, regardless of the actual platform.

Differential Revision: https://reviews.llvm.org/D91074
2020-11-11 15:32:59 -05:00
Muiez Ahmed
e72e785d47 [SystemZ][z/OS] Enable POSIX_l functions for z/OS
The aim of this patch is to enable POSIX _l functions for z/OS. In particular, the functions are provided with libc++ and this patch resorts to the fallback functions. Nonetheless, the functions are being added so the implementation of the ctype<> member functions can call them. The following changes were needed to allow for a successful build when using the libc++ library for z/OS.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D90319
2020-11-10 09:57:11 -05:00
Louis Dionne
2eadbc8614 [libc++] Rework the whole availability markup implementation
Currently, vendor-specific availability markup is enabled by default.
This means that even when building against trunk libc++, the headers
will by default prevent you from using some features that were not
released in the dylib on your target platform. This is a source of
frustration since people building libc++ from sources are usually not
trying to use some vendor's released dylib.

For that reason, I've been thinking for a long time that availability
annotations should be off by default, which is the primary change that
this commit enables.

In addition, it reworks the implementation to make it easier for new
vendors to add availability annotations for their platform, and it
refreshes the documentation to reflect the current state of the codebase.

Finally, a CMake configuration option is added to control whether
availability annotations should be turned on for the flavor of libc++
being created. The intent is for vendors like Apple to turn it on, and
for the upstream libc++ to leave it off (the default).

Differential Revision: https://reviews.llvm.org/D90843
2020-11-05 12:28:52 -05:00
Louis Dionne
91336a0c61 [libc++] Move the #error message for no localization to <locale.h>
<locale.h> is lower level than <__locale>, so that's where we want the
error to live for systems that don't provide localization support.
2020-10-28 09:49:37 -04:00
Martin Storsjö
70bba9ef35 [libcxx] Don't truncate intermediates to wchar_t when widening
On windows, wchar_t is 16 bit, while we might be widening chars to
char32_t.

This cast had been present since the initial commit, and removing it
doesn't seem to make any tests fail.

Differential Revision: https://reviews.llvm.org/D90228
2020-10-27 23:58:27 +02:00
Louis Dionne
88ffc72717 [libc++] Add a libc++ configuration that does not support localization
When porting libc++ to embedded systems, it can be useful to drop support
for localization, which these systems don't implement or care about.

Differential Revision: https://reviews.llvm.org/D90072
2020-10-27 14:56:30 -04:00
Louis Dionne
1a92de0064 [libc++] NFCI: Remove _LIBCPP_EXTERN_TEMPLATE2
This seems to have been added a long time ago as a temporary help
for debugging some <regex> issue, but it's really the same as
_LIBCPP_EXTERN_TEMPLATE.
2020-10-02 14:31:43 -04:00
Dan Albert
cbf1904a3e Upstream Bionic definitions of ctype_base/regex.
Summary:
This is a patch that Android has been carrying in its tree for several
years. This patch upstreams the existing ABI.

There's some historical cruft here. __regex_word used to be a part of
regex_traits rather than ctype_base. Bionic also used to use its own
ctype implementation because the libc++ builtin one wasn't available
yet. Bionic's ctype masks were 8 bits wide and already saturated, so a
wider type needed to be used for the regex mask, and the existing
value was already used so Android needed to specify its own.

Since then Android has migrated to the builtin ctype implementation
and this patch probably should have been dropped then. Unfortunately
that was not noticed at the time, so now we need to keep this to
maintain the current ABI.

Reviewers: EricWF, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76171
2020-04-06 13:38:16 -07:00
Mikhail Maltsev
a83220c6f2 [libcxx] Fix build breakage on mips
Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by
https://reviews.llvm.org/D63284.

Committing as obvious.

llvm-svn: 369364
2019-08-20 10:19:55 +00:00
Mikhail Maltsev
411c630bae [libc++] Keep __regex_word in sync with ctype_base
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
2019-06-14 09:04:16 +00:00
Dan Gohman
3efd6e37e4 [WebAssembly] WASI support for libcxx
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
2019-05-01 16:47:30 +00:00
Thomas Anderson
24812d8ac4 Fix and speedup __libcpp_locale_guard on Windows
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
2019-03-27 18:09:30 +00:00
Eric Fiselier
411210838d Work around dllimport bug with exclude_from_explicit_instantiation.
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
2019-03-08 23:59:29 +00:00
Dimitry Andric
d95da99b91 Fix the build with gcc when -Wredundant-decls is passed
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
2019-02-20 21:01:31 +00:00
Chandler Carruth
57b08b0944 Update more file headers across all of the LLVM projects in the monorepo
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
2019-01-19 10:56:40 +00:00
Louis Dionne
9b3222f613 [libc++] Make sure we can build libc++ with -fvisibility=hidden
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
2018-10-25 12:13:43 +00:00
Louis Dionne
dc7200b486 [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _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
2018-07-11 23:14:33 +00:00
Louis Dionne
195a499d63 Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _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
2018-07-05 18:41:50 +00:00
Louis Dionne
4a8f3f9948 [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _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.

Reviewers: EricWF

Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists

Differential Revision: https://reviews.llvm.org/D48892

llvm-svn: 336369
2018-07-05 16:49:38 +00:00
Saleem Abdulrasool
a4e874c516 support: add missing locale stubs for android L, M
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
2018-04-13 18:14:57 +00:00
Martin Storsjo
771edc7949 Allow to set locale on Windows.
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
2017-11-23 10:38:18 +00:00
Eric Fiselier
fa259aa50f Fix libcxx build with glibc 2.26+ by removing xlocale.h include.
Patch by Khem Raj. Reviewed as D35697. Also see PR33729.

llvm-svn: 309920
2017-08-03 04:28:10 +00:00
Eric Fiselier
1ec026252b Fix Libc++ build with MinGW64
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
2017-05-31 22:14:05 +00:00
Eric Fiselier
b4ddab26bc Refactor <locale> RAII guards to aid upcoming Windows locale changes.
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
2017-05-08 22:02:43 +00:00
Mehdi Amini
e9c66ad9fa Add markup for libc++ dylib availability
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
2017-05-04 17:08:54 +00:00
Petr Hosek
d0e9481c55 [libcxx] Direct support for Fuchsia
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
2017-04-13 21:29:21 +00:00
Shoaib Meenai
bda3c7df78 [libc++] Make _LIBCPP_TYPE_VIS export members
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
2017-03-02 03:22:18 +00:00
Eric Fiselier
e2f2d1edef [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS
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
2017-01-04 23:56:00 +00:00
Saleem Abdulrasool
b2826a1ddc clean up use of _WIN32
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
2017-01-03 21:53:51 +00:00
Eric Fiselier
49e2967f27 [libc++] Fix and document visibility attributes for Clang, GCC and Windows.
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
2016-09-15 22:27:07 +00:00
Aditya Kumar
d51f2a2a64 Add attribute noreturn to functions that throw
Reviewers: mclow.lists, EricWF, howard.hinnant, sebpop
Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D21232

llvm-svn: 279903
2016-08-27 02:26:42 +00:00
Marshall Clow
d437fa5c8c Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception 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
2016-08-25 15:09:01 +00:00
Vasileios Kalintiris
08010b5a0c Use libcxx's default rune table with the Musl C library.
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
2015-11-24 10:24:54 +00:00
Vasileios Kalintiris
8c58e92cd8 Add initial support for the MUSL C library.
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
2015-11-09 10:21:04 +00:00
Jonathan Roelofs
29f342c6b5 Fix ctype_byname<wchar_t>::do_is() mask checking.... again
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
2015-03-11 17:00:28 +00:00
Dan Albert
900086de88 Move Android to the builtin rune table.
llvm-svn: 231897
2015-03-11 00:51:06 +00:00
JF Bastien
e9401f61c2 libc++: support newlib's ctype
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
2015-02-25 22:16:46 +00:00
Eric Fiselier
fbbfd09214 Get libc++ building on Sun Solaris. Patch from C Bergstrom.
llvm-svn: 226947
2015-01-23 22:22:36 +00:00
Marshall Clow
9317900590 Change a couple more template parameter names from 'T' to '_Tp', etc. Thanks to Ondřej Majerech for the patch, but I did a bit more.
llvm-svn: 225598
2015-01-11 06:15:59 +00:00
Sergey Dmitrouk
9e3a60769f Include newlib-specific locales in __locale
llvm-svn: 224111
2014-12-12 08:36:16 +00:00
Eric Fiselier
53deb607d9 Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
llvm-svn: 222794
2014-11-25 21:57:41 +00:00
Dan Albert
ea32c105a6 Make Android's ctype_base::mask unsigned.
Keeping the regex code sane is much easier if we match the other
platforms and use an unsigned mask.

llvm-svn: 214442
2014-07-31 21:04:08 +00:00
Dan Albert
a950658e3c Fix ctype_base::xdigit for Android.
Android's ctype implementation comes from openbsd, which for some reason
doesn't consider numbers to be hex digits.

llvm-svn: 213785
2014-07-23 19:32:03 +00:00
Marshall Clow
b38f8f07c5 Add support for BIONIC C library (Android). Patch from Dan Albert
llvm-svn: 212724
2014-07-10 15:20:28 +00:00
Marshall Clow
201fe8cfe7 Fix misguided #elif - it checked the value of _AIX instead of defined(_AIX). Thanks to Johan Bergström for the bug report.
llvm-svn: 203589
2014-03-11 17:18:47 +00:00
Marshall Clow
7e1ea8d288 Patch by Bruce Mitchener. Change all references to EMSCRIPTEN to __EMSCRIPTEN__. If you're not using the PP symbol EMSCRIPTEN, then you should see no functionality change.
llvm-svn: 195136
2013-11-19 18:05:03 +00:00
Marshall Clow
5b40666c6c Patch by GM: Making implicit conversion to bool explicit in <ios> and <__locale>
llvm-svn: 193085
2013-10-21 14:41:05 +00:00
Howard Hinnant
5f878d4bd2 G M: Restore the ability for libcxx to compile again on mingw 64.
llvm-svn: 190837
2013-09-17 01:34:47 +00:00
Howard Hinnant
d0a4d73623 Xing Xue: Fix type-o. Thanks to C. Bergström for spotting it.
llvm-svn: 189674
2013-08-30 14:42:39 +00:00
Howard Hinnant
9762413621 Xing Xue: Some minor changes for IBM XLC++/AIX.
llvm-svn: 189623
2013-08-29 23:37:50 +00:00
Howard Hinnant
fc88dbd298 Debug mode for string. This commit also marks the first time libc++ 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
2013-08-23 17:37:05 +00:00
Howard Hinnant
5d1a701d6d Xing Xue: port to IBM XLC++/AIX.
llvm-svn: 188396
2013-08-14 18:00:20 +00:00
Howard Hinnant
f0544c2086 Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Howard Hinnant
0be8f64c44 Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is
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
2013-08-01 18:17:34 +00:00
Joerg Sonnenberger
50544e7e65 Add NetBSD support.
llvm-svn: 182162
2013-05-17 21:17:34 +00:00
Howard Hinnant
9cb970074f Bruce Mitchener, Jr.: Port to emscripten. Fixes http://llvm.org/bugs/show_bug.cgi?id=15624.
llvm-svn: 178354
2013-03-29 18:27:28 +00:00
Marshall Clow
69e76f80e2 Removed raw references to __sun__, __FreeBSD__, __GLIBC__ and __linux__; now just check to see if they are defined.
llvm-svn: 177310
2013-03-18 19:34:07 +00:00
Marshall Clow
b56e8587af Removed raw references to __APPLE__; now just check to see if it is defined.
llvm-svn: 177297
2013-03-18 17:45:34 +00:00
Marshall Clow
91907cbe82 Removed raw references to _WIN32; now just check to see if it is defined.
llvm-svn: 177291
2013-03-18 17:04:29 +00:00
Howard Hinnant
6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant
cd47cbc7a4 Provide a way to disable use of extern templates in libc++. This is intended for the clients of libc++, not the libc++ build. The dylib should always contain the extern templates. To disable the client needs to put -D'_LIBCPP_EXTERN_TEMPLATE(...)=' on the command line.
llvm-svn: 167486
2012-11-06 21:08:48 +00:00
Howard Hinnant
aeb85680fb Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
llvm-svn: 163862
2012-09-14 00:39:16 +00:00
Howard Hinnant
6a03f169db locale::id really needs to be constructed at compile time.
llvm-svn: 160785
2012-07-26 16:14:37 +00:00
David Chisnall
14c25b80e9 Solaris port. Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers.  These will be committed to a branch later
today.

llvm-svn: 151720
2012-02-29 13:05:08 +00:00
Howard Hinnant
c206366fd7 Quash a whole bunch of warnings
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant
c003db1fca Further macro protection by replacing _[A-Z] with _[A-Z]p
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant
073458b1ab Windows support by Ruben Van Boxem.
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
a33d4bc1ff Starting on musl port by Arvid Picciani
llvm-svn: 141672
2011-10-11 16:00:46 +00:00
Howard Hinnant
8909cdfff9 Windows port work by Ruben Van Boxem
llvm-svn: 140805
2011-09-29 20:33:10 +00:00
Howard Hinnant
0c06e58fae Windows patch work by Ruben Van Boxem
llvm-svn: 140781
2011-09-29 13:33:15 +00:00
Howard Hinnant
9978e3709f Attempted locale refactoring. _LIBCPP_LOCALE__L_EXTENSIONS now should be defined if one has all of the xxx_l() functions. I've defined this for apple, freebsd and win32. _LIBCPP_HAS_DEFAULTRUNELOCALE should be defined if there is a _DefaultRuneLocale. I've defined this for apple and freebsd. The block of code we're trying to migrate away from is now under #ifdef __linux__. I've tested only on OS X. I hope I haven't broken things too badly elsewhere. Please let me know.
llvm-svn: 140734
2011-09-28 23:39:33 +00:00
Howard Hinnant
3c78ca07bc Partial Windows port by Ruben Van Boxem
llvm-svn: 140328
2011-09-22 19:10:18 +00:00
David Chisnall
89728139cb Fixes for FreeBSD, including some fairly obvious copy-and-paste errors.
libc++ now mostly works on FreeBSD with libcxxrt and this patch applied to the base system:

http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110920/e666632c/xlocale-0001.obj

Summary of tests on FreeBSD:


****************************************************
Results for /root/libcxx/test:
using FreeBSD clang version 3.0 (trunk 135360) 20110717
Target: x86_64-unknown-freebsd9.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -I/root/libcxx/include -L/root/libcxx/build/lib
----------------------------------------------------
sections without tests   : 1
sections with failures   : 48
sections without failures: 1015
                       +   ----
total number of sections : 1064
----------------------------------------------------
number of tests failed   : 145
number of tests passed   : 4179
                       +   ----
total number of tests    : 4324
****************************************************

(Many due to this clang version not supporting C++ atomics)

More fixes to follow...

llvm-svn: 140245
2011-09-21 08:39:44 +00:00
David Chisnall
0a0f599f2c Enable __locale to work on FreeBSD.
llvm-svn: 140005
2011-09-18 19:23:04 +00:00
Alexis Hunt
f023519770 Conditionally wrap the changes from r134781.
llvm-svn: 134783
2011-07-09 01:09:31 +00:00
Alexis Hunt
3f60bca9e9 Implement generalized table lookups for upper, lower, and character
traits.

To the best of my knowledge, this will not break the ABI for Apple.
However, it does introduce three publicly visible (although with
reserved name) functions that will fail to link against the just-shipped
Apple version of libc++. Since they are not used in any inline
functions, no actual breakage should occur.

If Howard doesn't want to put undefined functions (even internal ones)
into a header, they could be surrounded by additional conditional
compilation.

llvm-svn: 134781
2011-07-09 00:56:23 +00:00
Howard Hinnant
ce48a1137d _STD -> _VSTD to avoid macro clash on windows
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
b5d866d4a3 noexcept for Chapter 22 [localization].
llvm-svn: 132337
2011-05-31 15:34:58 +00:00
Howard Hinnant
3739fe79e5 noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default|
llvm-svn: 132261
2011-05-28 14:41:13 +00:00
Howard Hinnant
c950e77d1d Effort to reduce the number of exported symbols
llvm-svn: 122057
2010-12-17 14:46:43 +00:00
Howard Hinnant
412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
35ae4a20cd visibility-decoration.
llvm-svn: 114465
2010-09-21 18:58:51 +00:00
Howard Hinnant
b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant
54b409fdb9 now works with -fno-exceptions and -fno-rtti
llvm-svn: 110828
2010-08-11 17:04:31 +00:00
Howard Hinnant
0c17e32edd [locale.stdcvt]
llvm-svn: 105174
2010-05-30 21:39:41 +00:00
Howard Hinnant
128ba7191d patch by Jeffrey Yasskin for porting to Ubuntu Hardy. Everything was accepted except there were some bug fixes needed in <locale> for the __nolocale_* series. For the apple branch I ended up using templates instead of the var_args solution because it seemed both safer and more efficient.
llvm-svn: 104516
2010-05-24 17:49:41 +00:00
Howard Hinnant
5b08a8a432 Wiped out some non-ascii characters that snuck into the copyright.
llvm-svn: 103516
2010-05-11 21:36:01 +00:00