llvm-capstone/libcxx
Daniel McIntosh ee2a92c29d [libcxx] Remove VLA from libcxx locale header
The buffer size (`__nbuf`) in `num_put::do_put` is currently not an
integral/core constant expression. As a result, `__nar` is a Variable Length
Array (VLA). VLAs are a GNU extension and not part of the base C++ standard, so
unless there is good reason to do so they probably shouldn't be used in any of
the standard library headers. The call to `__iob.flags()` is the only thing
keeping `__nbuf` from being a compile time constant, so the solution here is to
simply err on the side of caution and always allocate a buffer large enough to
fit the base prefix.

Note that, while the base prefix for hex (`0x`) is slightly longer than the
base prefix for octal (`0`), this isn't a concern. The difference in the space
needed for the value portion of the string is enough to make up for this.
(Unless we're working with small, oddly sized types such as a hypothetical
`uint9_t`, the space needed for the value portion in octal is at least 1 more
than the space needed for the value portion in hex).

This PR also adds `constexpr` to `__nbuf` to enforce compile time const-ness
going forward.

Reviewed By: Mordante, #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D103558
2021-06-08 13:59:34 -04:00
..
benchmarks [libcxx][nfc] prefixes test type input_iterator with cpp17_ 2021-05-02 05:02:59 +00:00
cmake [libc++] Add a CI configuration for the modular build 2021-06-08 13:32:08 -04:00
docs [libc++] Remove the old HTML documentation 2021-06-08 11:18:12 -04:00
include [libcxx] Remove VLA from libcxx locale header 2021-06-08 13:59:34 -04:00
lib [libc++] Disentangle std::pointer_safety 2021-05-03 14:33:49 -04:00
src [libcxx] Don't use an undefined '+' in unsigned/octal/hexal print formats 2021-06-04 12:07:30 +03:00
test [libc++] Add a CI configuration for the modular build 2021-06-08 13:32:08 -04:00
utils [libc++] Add a CI configuration for the modular build 2021-06-08 13:32:08 -04:00
.clang-format [libcxx][NFC] removes IndentRequires from .clang-format 2021-04-15 19:28:45 +00:00
.gitignore
appveyor-reqs-install.cmd
appveyor.yml
CMakeLists.txt [libc++] Support per-target __config_site in per-target runtime build 2021-04-28 14:27:16 -07:00
CREDITS.TXT
LICENSE.TXT
TODO.TXT