Commit Graph

713 Commits

Author SHA1 Message Date
Nikolas Klauser
cd34e89cfa [libc++][NFC] Remove __has_keyword
__has_keyword is almost not used anymore. There are only two cases. One can be replaced by __has_builtin and the other seems entirely redundant, so we can remove the definition.

Reviewed By: #libc, Mordante

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D158215
2023-08-19 15:46:13 -07:00
Nikolas Klauser
3583bf3ad8 [libc++] Make everything in namespace std have default type visibility and hidden visibility and remove _LIBCPP_ENUM_VIS
This avoids having to add `_LIBCPP_ENUM_VIS`, since that is handled through `type_visibility` and GCC always makes the visibility of enums default. It also fixes and missing `_LIBCPP_EXPORTED_FROM_ABI` on classes when using Clang.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D153658
2023-08-19 15:16:04 -07:00
Nikolas Klauser
15941dd629 [libc++][PSTL] Add vectorization annotations when clang is used
Reviewed By: #libc, ldionne

Spies: wangpc, libcxx-commits

Differential Revision: https://reviews.llvm.org/D155512
2023-07-31 18:52:03 -07:00
Tobias Hieta
ab720289ca
Bump trunk version to 18.0.0git 2023-07-25 13:58:49 +02:00
varconst
4a652e4a99 [libc++][hardening] Categorize more assertions.
Differential Revision: https://reviews.llvm.org/D155873
2023-07-24 14:57:01 -07:00
varconst
66bd177a77 [libc++][hardening] Don't trigger uncategorized assertions in the hardened mode.
The hardened mode is intended to only include security-critical,
relatively low-overhead checks that are intended to be usable in
production. By default, assertions are excluded from this mode.

Differential Revision: https://reviews.llvm.org/D155866
2023-07-20 22:50:52 -07:00
varconst
4122db1fbd [libc++][hardening] Categorize most assertions inside the container classes.
This introduces:
- `_LIBCPP_ASSERT_VALID_INPUT_RANGE`;
- `_LIBCPP_ASSERT_VALID_CONTAINER_ACCESS`;
- `_LIBCPP_ASSERT_VALID_ITERATOR_ACCESS`;
- `_LIBCPP_ASSERT_VALID_ALLOCATOR`;
- `_LIBCPP_ASSERT_INTERNAL`.

Differential Revision: https://reviews.llvm.org/D155349
2023-07-20 10:14:43 -07:00
Nikolas Klauser
9ebc24d90c [libc++][NFC] Remove unused macro definition 2023-07-17 13:24:30 -07:00
Louis Dionne
71f95ecff2 [libc++] Move _LIBCPP_NO_THREAD_SAFETY_ANALYSIS to __config
This makes __threading_support contain nothing but the base threading
API provided by the system.

Differential Revision: https://reviews.llvm.org/D155458
2023-07-17 16:06:46 -04:00
varconst
f0dfe682bc [libc++][hardening] Deprecate _LIBCPP_ENABLE_ASSERTIONS.
`_LIBCPP_ENABLE_ASSERTIONS` was used to enable the "safe" mode in
libc++. Libc++ now provides the hardened mode and the debug mode that
replace the safe mode.

For backward compatibility, enabling `_LIBCPP_ENABLE_ASSERTIONS` now
enables the hardened mode. Note that the hardened mode provides
a narrower set of checks than the previous "safe" mode (only
security-critical checks that are performant enough to be used in
production).

Differential Revision: https://reviews.llvm.org/D154997
2023-07-14 16:58:47 -07:00
varconst
d1367ca46e [libc++][hardening][NFC] Add macros to enable hardened mode.
This patch only adds new configuration knobs -- the actual assertions
will be added in follow-up patches.

Differential Revision: https://reviews.llvm.org/D153902
2023-07-12 10:12:58 -07:00
Hui
477f6bc407 [libc++] Make stop_token experimental
There are discussions about different ways of implementing `stop_token` to make it more performant
mark `stop_token` as experimental to allow us to change the design before it is shipped

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

Differential Revision: https://reviews.llvm.org/D154700
2023-07-11 08:52:31 -04:00
Nicole Rabjohn
92e4d6791f Fixing conflicting macro definitions between curses.h and the standard library.
POSIX allows certain macros to exist with generic names (i.e. refresh(), move(), and erase()) to exist in `curses.h` which conflict with functions found in std::filesystem, among others. This patch undefs the macros in question and adds them to LIBCPP_PUSH_MACROS and LIBCPP_POP_MACROS.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D147356
2023-07-06 17:21:08 +00:00
varconst
be02f912d6 [libc++][hardening] Add an ABI macro _LIBCPP_ABI_BOUNDED_ITERATORS.
Use the new macro instead of `_LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING`.

Differential Revision: https://reviews.llvm.org/D153895
2023-06-27 16:41:29 -07:00
Advenam Tacet
10ec9276d4 [2a/3][ASan][libcxx] std::deque annotations
This revision is a part of a series of patches extending AddressSanitizer C++ container overflow detection capabilities by adding annotations, similar to those existing in `std::vector`, to `std::string` and `std::deque` collections. These changes allow ASan to detect cases when the instrumented program accesses memory which is internally allocated by the collection but is still not in-use (accesses before or after the stored elements for `std::deque`, or between the size and capacity bounds for `std::string`).

The motivation for the research and those changes was a bug, found by Trail of Bits, in a real code where an out-of-bounds read could happen as two strings were compared via a std::equals function that took `iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom comparison function). When object `iter1` was longer than `iter2`, read out-of-bounds on `iter2` could happen. Container sanitization would detect it.

This revision introduces annotations for `std::deque`. Each chunk of the container can now be annotated using the `__sanitizer_annotate_double_ended_contiguous_container` function, which was added in the rG1c5ad6d2c01294a0decde43a88e9c27d7437d157. Any attempt to access poisoned memory will trigger an ASan error. Although false negatives are rare, they are possible due to limitations in the ASan API, where a few (usually up to 7) bytes before the container may remain unpoisoned. There are no false positives in the same way as with `std::vector` annotations.

This patch only supports objects (deques) that use the standard allocator. However, it can be easily extended to support all allocators, as suggested in the D146815 revision.

Furthermore, the patch includes the addition of the `is_double_ended_contiguous_container_asan_correct` function to `libcxx/test/support/asan_testing.h`. This function can be used to verify whether a `std::deque` object has been correctly annotated.

Finally, the patch extends the unit tests to verify ASan annotations (added LIBCPP_ASSERTs).
If a program is compiled without ASan, all helper functions will be no-ops. In binaries with ASan, there is a negligible performance impact since the code from the change is only executed when the deque container changes in size and it’s proportional to the change. It is important to note that regardless of whether or not these changes are in use, every access to the container's memory is instrumented.

If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D132092
2023-06-27 06:55:09 +02:00
Louis Dionne
bcca95da5e [libc++] Refactor the selection of string's ABI in __config
This doesn't change the selection, but it expands the conditions to
add comments and make it clearer what's happening. It also removes a
-Wundef instance when we checked __ARM_ARCH_7K__ >= 2 without checking
that it is defined in the first place.

Differential Revision: https://reviews.llvm.org/D153413
2023-06-21 17:53:57 -04:00
Louis Dionne
5a6e6adb91 [libc++] Make sure our .clang-format is used for all languages
In particular, this ensures that it is used for Objective-C and
Objective-C++, since we have a few files that get detected as that.

Differential Revision: https://reviews.llvm.org/D153289
2023-06-20 15:00:53 -04:00
Nikolas Klauser
f1ea0b11ca [libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI into _LIBCPP_EXPORTED_FROM_ABI
These macros are always defined identically, so we can simplify the code a bit by merging them.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, krytarowski, smeenai

Differential Revision: https://reviews.llvm.org/D152652
2023-06-15 08:56:45 -07:00
Nikolas Klauser
7949ee0d4f [libc++] Introduce __is_pointer_in_range
This checks whether a pointer is within a range, even during constant evaluation. This allows running optimized code paths during constant evaluation, instead of falling back to the general-purpose implementation all the time. This is also a central place for comparing unrelated pointers, which is technically UB.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143327
2023-06-07 13:33:58 -07:00
Louis Dionne
1939eb3dc2 [libc++] Disable int128_t and ship filesystem on MSVC by default
Back in 2020 [1], we went very close to enabling Filesystem on MSVC
by disabling int128_t, but decided to wait because MSVC support
for int128_t was supposed to come shortly after. Since it's not
there yet, I propose turning off int128_t support by default on MSVC.
This will make <filesystem> available by default on MSVC, and most
importantly will open the possibility for changing
LIBCXX_ENABLE_FILESYSTEM to mean "the system doesn't have support
for a filesystem" instead of simply "don't build the std::filesystem
library", which is what I'm really after with this change.

In a way, this is a resurection of D91139.

[1]: https://reviews.llvm.org/D91139#2429595

Differential Revision: https://reviews.llvm.org/D134912
2023-06-06 13:31:03 -07:00
Vitaly Buka
1ab4438920 Revert "[2a/3][ASan][libcxx] std::deque annotations"
This reverts commit 605b9c76e0.
2023-05-31 13:50:04 -07:00
Nikolas Klauser
e837f4b7db [libc++][PSTL] Add a simple std::thread backend
This is just to test that the PSTL works with parallelization. This is not supposed to be a production-ready backend.

Reviewed By: ldionne, #libc

Spies: EricWF, arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D150284
2023-05-24 15:33:58 -07:00
Advenam Tacet
605b9c76e0 [2a/3][ASan][libcxx] std::deque annotations
This revision is a part of a series of patches extending AddressSanitizer C++ container overflow detection capabilities by adding annotations, similar to those existing in std::vector, to std::string and `std::deque` collections. These changes allow ASan to detect cases when the instrumented program accesses memory which is internally allocated by the collection but is still not in-use (accesses before or after the stored elements for `std::deque`, or between the size and capacity bounds for `std::string`).

The motivation for the research and those changes was a bug, found by Trail of Bits, in a real code where an out-of-bounds read could happen as two strings were compared via a std::equals function that took `iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom comparison function). When object `iter1` was longer than `iter2`, read out-of-bounds on `iter2` could happen. Container sanitization would detect it.

This revision introduces annotations for `std::deque`. Each chunk of the container can now be annotated using the `__sanitizer_annotate_double_ended_contiguous_container` function, which was added in the rG1c5ad6d2c01294a0decde43a88e9c27d7437d157. Any attempt to access poisoned memory will trigger an ASan error. Although false negatives are rare, they are possible due to limitations in the ASan API, where a few (usually up to 7) bytes before the container may remain unpoisoned. There are no false positives in the same way as with `std::vector` annotations.

This patch only supports objects (deques) that use the standard allocator. However, it can be easily extended to support all allocators, as suggested in the D146815 revision.

Furthermore, the patch includes the addition of the `is_double_ended_contiguous_container_asan_correct` function to libcxx/test/support/asan_testing.h. This function can be used to verify whether a `std::deque` object has been correctly annotated.

Finally, the patch extends the unit tests to verify ASan annotations (added LIBCPP_ASSERTs).
If a program is compiled without ASan, all helper functions will be no-ops. In binaries with ASan, there is a negligible performance impact since the code from the change is only executed when the deque container changes in size and it’s proportional to the change. It is important to note that regardless of whether or not these changes are in use, every access to the container's memory is instrumented.

Reviewed By: #libc, philnik

Spies: vitalybuka, hans, mikhail.ramalho, Enna1, #sanitizers, philnik, libcxx-commits

Differential Revision: https://reviews.llvm.org/D132092
2023-05-24 14:26:57 -07:00
Nikolas Klauser
140c375ab1 Revert "[libc++] Apply _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION only in classes that we have instantiated externally"
This reverts commit b3c9150062.

There were unexpected breakages downstream. @EricWF is investigating.
2023-05-24 08:48:18 -07:00
Mark de Wever
dff62f5251 [libc++][format] Removes the experimental status.
The code has been quite ready for a while now and there are no more ABI
breaking papers. So this is a good time to mark the feature as stable.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150802
2023-05-24 17:16:22 +02:00
Nikolas Klauser
b3c9150062 [libc++] Apply _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION only in classes that we have instantiated externally
To make sure all member functions that require it are marked `_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION` I compared the output of `objdump --syms lib/libc++.1.0.dylib` before and after, ignoring addresses.

Reviewed By: #libc, ldionne

Spies: Mordante, libcxx-commits, ldionne, arichardson, mstorsjo

Differential Revision: https://reviews.llvm.org/D150896
2023-05-23 13:32:55 -07:00
Mark de Wever
71400505ca [libc++] Updates C++2b to C++23.
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Note since we use clang-tidy 16 a small work-around is needed. Clang
knows -std=c++23 but clang-tidy not so for now force the lit compiler
flag to use -std=c++2b instead of -std=c++23.

Reviewed By: #libc, philnik, jloser, ldionne

Differential Revision: https://reviews.llvm.org/D150795
2023-05-23 18:44:41 +02:00
Louis Dionne
8e2d09c339 [libc++][PSTL] Add more specialized backend customization points
This allows backends to customize arbitrary parallel algorithms, which was requested pretty often.

Reviewed By: #libc, ldionne

Spies: arichardson, miyuki, crtrott, dalg24, __simt__, philnik, libcxx-commits

Differential Revision: https://reviews.llvm.org/D149686
2023-05-11 13:54:28 -07:00
Nikolas Klauser
f041b3472a [libc++][PSTL] Move the remaining configuration into __config
Reviewed By: ldionne, #libc

Spies: sstefan1, jplehr, arichardson, libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D150217
2023-05-10 09:23:13 -07:00
Vitaly Buka
bb13ed231a Revert "[2a/3][ASan][libcxx] std::deque annotations"
https://lab.llvm.org/buildbot/#/builders/168/builds/13310
https://lab.llvm.org/buildbot/#/builders/239/builds/2107

This reverts commit 9a5f283139.
2023-05-06 00:23:27 -07:00
Nikolas Klauser
e7e3711885 [libc++][PSTL] Make the PSTL available by default under -fexperimental-library
This removes the need for a custom libc++ build to have a basic set of PSTL algorithms.

Reviewed By: ldionne, #libc

Spies: miyuki, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D149624
2023-05-05 13:53:17 -07:00
Advenam Tacet
9a5f283139 [2a/3][ASan][libcxx] std::deque annotations
This revision is a part of a series of patches extending AddressSanitizer C++ container overflow detection capabilities by adding annotations, similar to those existing in std::vector, to std::string and `std::deque` collections. These changes allow ASan to detect cases when the instrumented program accesses memory which is internally allocated by the collection but is still not in-use (accesses before or after the stored elements for `std::deque`, or between the size and capacity bounds for `std::string`).

The motivation for the research and those changes was a bug, found by Trail of Bits, in a real code where an out-of-bounds read could happen as two strings were compared via a std::equals function that took `iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom comparison function). When object `iter1` was longer than `iter2`, read out-of-bounds on `iter2` could happen. Container sanitization would detect it.

This revision introduces annotations for `std::deque`. Each chunk of the container can now be annotated using the `__sanitizer_annotate_double_ended_contiguous_container` function, which was added in the rG1c5ad6d2c01294a0decde43a88e9c27d7437d157. Any attempt to access poisoned memory will trigger an ASan error. Although false negatives are rare, they are possible due to limitations in the ASan API, where a few (usually up to 7) bytes before the container may remain unpoisoned. There are no false positives in the same way as with `std::vector` annotations.

This patch only supports objects (deques) that use the standard allocator. However, it can be easily extended to support all allocators, as suggested in the D146815 revision.

Furthermore, the patch includes the addition of the `is_double_ended_contiguous_container_asan_correct` function to libcxx/test/support/asan_testing.h. This function can be used to verify whether a `std::deque` object has been correctly annotated.

Finally, the patch extends the unit tests to verify ASan annotations (added LIBCPP_ASSERTs).
If a program is compiled without ASan, all helper functions will be no-ops. In binaries with ASan, there is a negligible performance impact since the code from the change is only executed when the deque container changes in size and it’s proportional to the change. It is important to note that regardless of whether or not these changes are in use, every access to the container's memory is instrumented.

Reviewed By: #libc, philnik

Spies: mikhail.ramalho, Enna1, #sanitizers, philnik, libcxx-commits

Differential Revision: https://reviews.llvm.org/D132092
2023-05-05 09:10:11 -07:00
Louis Dionne
3b6bc87520 [libc++] Remove Solaris related code
This was contributed ~10 years ago, but we don't officially support it
and I am not aware of any bot testing it, so this has likely rotten to
the point where it is unusable.

Differential Revision: https://reviews.llvm.org/D138680
2023-05-05 08:39:51 -04:00
Nikolas Klauser
c6afeda866 [libc++] Reject standard attributes which are extensions in libcpp-uglify-attributes
This adds a list of attributes which can be pretty to be able to reject attributes which were introduced in a later C++ standard.
Fixes #61196

Reviewed By: Mordante, #libc

Spies: mikhail.ramalho, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D145508
2023-04-07 21:10:55 +02:00
Louis Dionne
c2a42381c1 [libc++] Don't try to provide source_location on AppleClang 1403
AppleClang 1403 has some bugs that prevent std::source_location from
working properly on it. Consequently, we XFAILed the unit test for
source_location with that compiler. However, we should also avoid
advertising that the feature is supported on that compiler, otherwise
our feature-test macros lie. This was noticed to break Boost.Asio
when building with a recent libc++ and AppleClang 14.0.3.

rdar://106863087

Differential Revision: https://reviews.llvm.org/D146837
2023-03-28 09:53:07 -04:00
Hristo Hristov
40aaa272f1 [libc++][ranges] P2711R1 Making multi-param constructors of views explicit
Implemented [[ https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2711r1.html | P2711R1 ]] for existing views.
 (`join_with_view` is not yet implemented)

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144822
2023-03-23 19:30:21 +02:00
Louis Dionne
c6b12b7c3b [libc++] Remove _LIBCPP_CONSTEVAL
It was only used in one place, and it seems entirely valid to use
constexpr unconditionally in that location.

Note that a different change was attempted, i.e. using consteval
unconditionally. However, this led to http://llvm.org/PR60709.

Differential Revision: https://reviews.llvm.org/D145700
2023-03-10 09:04:48 -05:00
Michael Francis
e0ecc322ec [AIX] Fix libc++ Symbol Visibility on AIX
The AIX linker does not support linking against libc++ if it exports symbols are redefined within compiled code.

Differential Revision: https://reviews.llvm.org/D140675
2023-03-08 18:58:55 +00:00
Nikolas Klauser
e65cd4ce83 [libc++] Enable -Wunused-template
Clang wants to enable this flag by default, but libc++ isn't working with it yet.

Reviewed By: Mordante, #libc, #libc_abi, EricWF

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D144667
2023-03-08 19:26:49 +01:00
Nikolas Klauser
07efa28314 [libc++] Add clang-tidy check for version checks
This check flags code which uses `_LIBCPP_STD_VER` the wrong way, or tries to use `__cplusplus`. It flags cases where we use `_LIBCPP_STD_VER >` instead of `_LIBCPP_STD_VER >=` and where wrong values are used (e.g. `_LIBCPP_STD_VER >= 24`).

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144261
2023-03-08 15:17:25 +01:00
Konstantin Varlamov
87cf39aa34 [libc++] Temporarily not use compiler intrinsics for some type traits in Objective-C++ mode.
Currently, there are bugs in Clang's intrinsics for type traits when
handling Objective-C++ `id` (e.g. in `add_pointer`). As a temporary
workaround, don't use these intrinsics in the Objective-C++ mode.

Differential Revision: https://reviews.llvm.org/D145186
2023-03-02 17:35:12 -08:00
Nikolas Klauser
b22aa3d74f [libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONS
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, smeenai

Differential Revision: https://reviews.llvm.org/D143163
2023-02-17 17:39:03 +01: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
Hans Wennborg
bbff77a14e Revert "[libc++] Remove _LIBCPP_CONSTEVAL"
It causes mysterious memory leaks when comparing std::string, see GitHub
Issue #60709 and the code review.

> All supported compilers support `consteval`, so there is no more need for the macro.
>
> Reviewed By: ldionne, Mordante, #libc
>
> Spies: libcxx-commits
>
> Differential Revision: https://reviews.llvm.org/D143489

This reverts commit aaef3b82f4.
2023-02-13 16:29:57 +01:00
Nikolas Klauser
aaef3b82f4 [libc++] Remove _LIBCPP_CONSTEVAL
All supported compilers support `consteval`, so there is no more need for the macro.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143489
2023-02-11 18:34:40 +01:00
Louis Dionne
02718433a0 [libc++] Guard the fix to CityHash behind ABI v2
As explained in a comment in https://reviews.llvm.org/D134124, we tried
landing this unconditionally but this actually bit some users who were
sharing std::unordered_map across an ABI boundary. This shows that the
ABI break is not benign and it should be guarded behind ABI v2.

Differential Revision: https://reviews.llvm.org/D143688
2023-02-09 17:10:02 -08:00
Nikolas Klauser
3c7a7a7b46 [libc++][NFC] Rename _LIBCPP_EXPLICIT_AFTER_CXX11 to _LIBCPP_EXPLICIT_SINCE_CXX14
We renamed the `_LIBCPP_CONSTEXPR_` a while ago. This matches the change for `_LIBCPP_EXPLICIT_`.

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143165
2023-02-05 00:22:53 +01:00
Nikolas Klauser
cf65d275ac [libc++][NFC] Rename _LIBCPP_NO_RTTI to _LIBCPP_HAS_NO_RTTI
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D143164
2023-02-05 00:21:56 +01:00
Tom Honermann
cf93a3dd51 [libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8() are present.
When support for declaring the c8rtomb() and mbrtoc8() functions within the
std namespace was added in commit 7e7013c5d4,
internal glibc macros were used to determine if C2X extensions are enabled.
Specifically, a check for whether `__GLIBC_USE` is defined and whether
`__GLIBC_USE(ISOC2X)` is non-0 was added. `__GLIBC_USE` is an internal
detail of the glibc implementation that may be changed or removed in the
future potentially leading to inconsistency or compilation failures.  This
change removes the use of the internal glibc macro to avoid such problems.
Unfortunately, without another mechanism to determine if C2X extensions are
enabled, this removal will result in inconsistent declarations of the
c8rtomb() and mbrtoc8() functions; when C++ char8_t support is not enabled, but
C2X extensions are, these functions will be declared in the global namespace
but not in the std namespace. This situation will improve when C23 support
is finalized and the check can be re-implemented using `__STDC_VERSION__`.
2023-02-02 13:31:19 -05:00
Nikolas Klauser
c8eff9560f [libc++] Add a clang-tidy check to make sure we use _Uglyfied attribute names
Reviewed By: ldionne, #libc

Spies: krytarowski, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D142322
2023-02-01 18:57:06 +01:00