Commit Graph

38 Commits

Author SHA1 Message Date
Mark de Wever
f805c799bf [libc++] "Implements" new SI prefixis.
Like yocto, zepto, zetta, and yotta. The new prefixes quecto, ronto,
ronna, and quetta can't be implemented in a intmax_t. So their
implementation does nothing.

Implements
- P2734R0 Adding the new SI prefixes

Depends on D153192

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D153200
2023-06-19 17:04:35 +02:00
Nikolas Klauser
4f15267d3d [libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x
This change is almost fully mechanical. The only interesting change is in `generate_feature_test_macro_components.py` to generate `_LIBCPP_STD_VER >=` instead. To avoid churn in the git-blame this commit should be added to the `.git-blame-ignore-revs` once committed.

Reviewed By: ldionne, var-const, #libc

Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei

Differential Revision: https://reviews.llvm.org/D143962
2023-02-15 16:52:25 +01:00
Nikolas Klauser
dc21ce4404 [libc++] Remove <type_traits> includes from <atomic> and <ratio>
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141799
2023-01-16 19:38:33 +01:00
Dominic Chen
5a42e2bc28 Revert "[libcxx] Resolve warnings for Wshift-sign-overflow"
This reverts commit 774c39313e.
2022-08-17 10:37:24 -07:00
Dominic Chen
774c39313e [libcxx] Resolve warnings for Wshift-sign-overflow
These warning were identified while debugging modules with Wsystem-headers.

Differential Revision: https://reviews.llvm.org/D131999
2022-08-17 10:31:25 -07:00
Louis Dionne
385cc25a53 [libc++] Ensure that all public C++ headers include <__assert>
This patch changes the requirement for getting the declaration of the
assertion handler from including <__assert> to including any public
C++ header of the library. Note that C compatibility headers are
excluded because we don't implement all the C headers ourselves --
some of them are taken straight from the C library, like assert.h.

It also adds a generated test to check it. Furthermore, this new
generated test is designed in a way that will make it possible to
replace almost all the existing test-generation scripts with this
system in upcoming patches.

Differential Revision: https://reviews.llvm.org/D122506
2022-03-30 15:05:31 -04:00
Louis Dionne
f900f7025c [libc++] Remove the _LIBCPP_BOOL_CONSTANT macro
I suspect this is a remnant of the times when we were not comfortable
using Clang's C++11/14 extensions everywhere, but now we do, so we can
use _BoolConstant instead and get rid of the macro.

Differential Revision: https://reviews.llvm.org/D122351
2022-03-25 08:46:14 -04:00
Arthur O'Dwyer
fa6b9e4010 [libc++] Normalize all our '#pragma GCC system_header', and regression-test.
Now we'll notice if a header forgets to include this magic phrase.

Differential Revision: https://reviews.llvm.org/D118800
2022-02-04 12:27:19 -05:00
Mark de Wever
bd6e6846e7 [libc++] Add the version header to all headers.
Some headers which require the version header depend on other headers to
provide it. Include the version header in all top-level headers to make
sure a header cleanup can't remove the version header.

Note this doesn't add the version header to the c headers.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D116172
2022-01-04 19:50:59 +01:00
Louis Dionne
eb8650a757 [runtimes][NFC] Remove filenames at the top of the license notice
We've stopped doing it in libc++ for a while now because these names
would end up rotting as we move things around and copy/paste stuff.
This cleans up all the existing files so as to stop the spreading
as people copy-paste headers around.
2021-11-17 16:30:52 -05:00
Louis Dionne
1711a6ec65 [libc++] Remove uses of _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
All supported compilers provide support for variable templates now.

Differential Revision: https://reviews.llvm.org/D110284
2021-09-23 08:53:59 -04:00
Louis Dionne
cb793e1a36 [libc++][NFCI] Remove uses of _LIBCPP_INLINE_VAR
All supported compilers provide support for inline variables in C++17 now.
Also, as a fly-by fix, replace some uses of _LIBCPP_CONSTEXPR by just
constexpr.

The only exception in this patch is `std::ignore`, which is provided
prior to C++17. Since it is defined in an anonymous namespace, it always
has internal linkage anyway, so using an inline variable there doesn't
provide any benefit. Instead, `inline` was removed entirely on `std::ignore`.

Differential Revision: https://reviews.llvm.org/D110243
2021-09-22 16:03:00 -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
Louis Dionne
4cd6ca102a [libc++] NFC: Normalize #endif // comment indentation 2021-04-20 12:03:32 -04: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
Marshall Clow
40a01d5314 Implement most of P0607: Inline Variables for the Standard Library. This involved marking a lot of variables as inline (but only for C++17 and later).
llvm-svn: 321658
2018-01-02 17:17:01 +00:00
Eric Fiselier
a016efb1dc [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
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
2017-05-31 22:07:49 +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
Eric Fiselier
54613ab4d4 [libc++] Remove various C++03 feature test macros
Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 282347
2016-09-25 03:34:28 +00:00
Marshall Clow
825a9edb2e Missing file from last commit
llvm-svn: 254286
2015-11-30 05:04:48 +00:00
Eric Fiselier
1f294fd934 Fix building and testing libc++ with GCC.
The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a
bug when building libc++ with GCC. Because GCC does not support __has_include
we need to explicitly tell it that we are building against libc++abi via the
preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`.

The changes in include/ratio are to work around CWG defect
1712 (constexpr variable template declarations). GCC 4.8 and before has not
adopted the resolution to this defect.

The changes in include/exception work around an issue where is_final is used
without it being defined in type_traits.

llvm-svn: 237767
2015-05-20 03:15:01 +00:00
Marshall Clow
cd6615fd71 Add support for N4389 - std::bool_constant
llvm-svn: 237636
2015-05-18 23:21:06 +00:00
Marshall Clow
60d5e0e027 A few bits of N2994 didn't get fully implemented a long time ago. Thanks to STL@microsoft.com for the bug report
llvm-svn: 235134
2015-04-16 21:36:54 +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
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
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
ab4f438239 Add protection from min/max macros
llvm-svn: 145407
2011-11-29 16:45:27 +00:00
Howard Hinnant
05e485879c Fix ratio arithmetic with zero
llvm-svn: 143519
2011-11-01 23:13:37 +00:00
Howard Hinnant
073458b1ab Windows support by Ruben Van Boxem.
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
e3c6708439 Upgrade <ratio> to use template aliases when available.
llvm-svn: 132342
2011-05-31 16:55:36 +00:00
Howard Hinnant
6fd5c65095 Minor fixup in <ratio> and add optional support for shared_mutex and upgrade_mutex which must be opted into with #define _LIBCPP_SHARED_LOCK
llvm-svn: 120258
2010-11-28 19:41:07 +00:00
Howard Hinnant
0c6a0fe7fb Add template alias emulation to <ratio>
llvm-svn: 120098
2010-11-24 17:05:06 +00:00
Howard Hinnant
412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
3e84caaebb visibility-decoration.
llvm-svn: 114647
2010-09-23 15:13:20 +00:00
Howard Hinnant
b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant
e31e36f910 [rand.dist.norm.f]
llvm-svn: 104035
2010-05-18 17:32:30 +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
Howard Hinnant
3e519524c1 libcxx initial import
llvm-svn: 103490
2010-05-11 19:42:16 +00:00