15 Commits

Author SHA1 Message Date
Mark de Wever
da618cf0a7
[NFC][libc++] Guard against operator& hijacking. (#128351)
This set usage of operator& instead of std::addressof seems not be easy
to "abuse". Some seem easy to misuse, like basic_ostream::operator<<,
trying to do that results in compilation errors since the `widen`
function is not specialized for the hijacking character type. Hence
there are no tests.
2025-02-27 17:47:34 +01:00
Mark de Wever
a841cf91b3
[lib++][print] Don't pad the ostream output. (#128354)
Per [ostream.formatted.reqmts]/3 padding should only be done when
explicitly stated.

Fixes: #116054
2025-02-26 17:53:26 +01:00
Louis Dionne
5e26fb1699
[libc++] Qualify calls to nullary functions like __throw_foo (#122465)
This is technically not necessary in most cases to prevent issues with ADL,
but let's be consistent. This allows us to remove the libcpp-qualify-declval
clang-tidy check, which is now enforced by the robust-against-adl clang-tidy check.
2025-02-21 07:59:46 -05:00
Nikolas Klauser
914fd916d5
[libc++][NFC] Simplify basic_ostream by combining operator<<(Arithmetic) (#121011)
The bodies of all the `operator<<` for arithmetic types have very
similar or even identical bodies. This introduces two new functions to
avoid all the duplication.
2025-01-04 14:49:22 +01:00
Nikolas Klauser
ffc7380ff4
[libc++] Avoid including shared_ptr.h in basic_ostream.h (#121049) 2024-12-24 16:18:25 +01:00
Nikolas Klauser
59890c1334
[libc++] Granularize <new> includes (#119964) 2024-12-17 11:29:16 +01:00
Nikolas Klauser
764834d63d
[libc++] Remove <istream> and <ostream> includes from <iomanip> (#116223)
This reduces the include time of `<filesystem>` by ~50ms.
2024-11-16 18:20:55 +01:00
Nikolas Klauser
c6f3b7bcd0
[libc++] Refactor the configuration macros to being always defined (#112094)
This is a follow-up to #89178. This updates the `<__config_site>`
macros.
2024-11-06 10:39:19 +01:00
Nikolas Klauser
e99c4906e4
[libc++] Granularize <cstddef> includes (#108696) 2024-10-31 02:20:10 +01:00
Nikolas Klauser
ba87515fea
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`_LIBCPP_HAS_NO_`. This patch changes that, so that they are always
defined and have the prefix `_LIBCPP_HAS_` instead. This changes the
canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means
that using an undefined macro (e.g. due to a missing include) is
diagnosed now. While this is rather unlikely currently, a similar change
in `<__configuration/availability.h>` caught a few bugs. This also
improves readability, since it removes the double-negation of `#ifndef
_LIBCPP_HAS_NO_FEATURE`.

The current patch only touches the macros defined in `<__config>`. If
people are happy with this approach, I'll make a follow-up PR to also
change the macros defined in `<__config_site>`.
2024-10-12 09:49:52 +02:00
Louis Dionne
87d56c59f5
[libc++][modules] Guard carved-out headers more consistently (#108637)
Several headers that should not be provided when localization or threads
are disabled were not guarded. That works until one tries to build with
modules and these headers get pulled in.

Note that this could be cleaned up further into something more
systematic, but this patch solves the immediate problems I ran into with
the monolithic modulemap and doesn't create any new inconsistency that
wasn't already there.
2024-09-16 08:15:38 -04:00
A. Jiang
4ea2c73886
[libc++] Deprecate and remove std::uncaught_exception (#101830)
Works towards P0619R4/#99985.

- std::uncaught_exception was not previously deprecated. This patch
  deprecates it since C++17 as per N4259. std::uncaught_exceptions is
  used instead as libc++ unconditionally provides this function.

- _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION restores
  std::uncaught_exception.

- As a drive-by, this patch updates the C++20 status page to 
  explain that D.11 is already done, since it was done in 
  578d09c1b195d859ca7e62840ff6bb83421a77b5.
2024-08-27 17:15:03 -04:00
Nikolas Klauser
bbe4a80605
[libc++] Enable modernize-use-equals-delete (#93293)
Differential Revision: https://reviews.llvm.org/D121213
2024-06-18 10:51:57 +02:00
Louis Dionne
04f01a2b9c
[libc++] Make the __availability header a sub-header of __config (#93083)
In essence, this header has always been related to configuration of
the library but we didn't want to put it inside <__config> due to
complexity reasons. Now that we have sub-headers in <__config>, we
can move <__availability> to it and stop including it everywhere since
we already obtain the required macros via <__config>.
2024-05-28 18:29:11 -07:00
Nikolas Klauser
17f006207c
[libc++] Granularize <ostream> (#85537)
This also includes `<__ostream/basic_ostream.h>` in `<sstream>` now,
reducing the include time of `<complex>` from 819ms to 603ms.
2024-05-02 22:38:44 +02:00