This brings most of the enable_ifs in libc++ to the same style. It also has the nice side-effect of reducing the size of names of these symbols, since the depedent return type is shorter.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D157787
This brings most of the enable_ifs in libc++ to the same style.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D157753
Both Clang and GCC always define __BYTE_ORDER__, so there is no need to test the byte order a million different ways.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D158216
This is to prevent a GCC warning (
https://github.com/llvm/llvm-project/issues/65132). It looks like
`__at_first` is always assigned before it's used, but all other member
variables of this struct are initialized in the constructor, so there is
no reason not to initialize `__at_first` as well.
Differential Revision: https://reviews.llvm.org/D159249
This allows including once_flag directly from <__locale> instead of
depending on all of <mutex>, which requires threading. In turn, this
makes it easier to support locales on platforms without threading.
Drive-by change: clang-format once_flag.h and use _LIBCPP_HIDE_FROM_ABI
Differential Revision: https://reviews.llvm.org/D155487
The summary flag causes a progress bar to appear and be rewritten using
a curses like interface. This works great for interactive sessions, but
produces line after line of garbage in the logs.
This should cause the logs to be much smaller and more readable.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D159120
We only support Clang on windows, so this code path is never taken.
Reviewed By: #libc, Mordante
Spies: Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D158230
This was mention in D150044 and D154995 that this would be useful.
This addresses the last review coment of D150044.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D156019
This adds more information regarding the libc++ coding style and
reference that are useful when working on a standard library
implementation.
This information is based on review comments and tips I give to new
contributors an information I wish I'd know when I started working on
libc++.
Depends on D156051
Reviewed By: #libc, jloser, var-const, ldionne
Differential Revision: https://reviews.llvm.org/D156052
This patch and D154984 were discussed in
<https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839>.
Motivation
----------
D154984 removes the "Script:" section that lit prints along with a
test's output, and it makes -v and -a imply -vv. For example, after
D154984, the "Script:" section below is never shown, but -v is enough
to produce the execution trace following it:
```
Script:
--
: 'RUN: at line 1'; echo hello | FileCheck bogus.txt && echo success
--
Exit Code: 2
Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "echo" "hello"
# command output:
hello
$ "FileCheck" "bogus.txt"
# command stderr:
Could not open check file 'bogus.txt': No such file or directory
error: command failed with exit status: 2
--
```
In the D154984 review, some reviewers point out that they have been
using the "Script:" section for copying and pasting a test's shell
commands to a terminal window. The shell commands as printed in the
execution trace can be harder to copy and paste for the following
reasons:
- They drop redirections and break apart RUN lines at `&&`, `|`, etc.
- They add `$` at the start of every command, which makes it hard to
copy and paste multiple commands in bulk.
- Command stdout, stderr, etc. are interleaved with the commands and
are not clearly delineated.
- They don't always use proper shell quoting. Instead, they blindly
enclose all command-line arguments in double quotes.
Changes
-------
D154984 plus this patch converts the above example into:
```
Exit Code: 2
Command Output (stdout):
--
# RUN: at line 1
echo hello | FileCheck bogus-file.txt && echo success
# executed command: echo hello
# .---command stdout------------
# | hello
# `-----------------------------
# executed command: FileCheck bogus-file.txt
# .---command stderr------------
# | Could not open check file 'bogus-file.txt': No such file or directory
# `-----------------------------
# error: command failed with exit status: 2
--
```
Thus, this patch addresses the above issues as follows:
- The entire execution trace can be copied and pasted in bulk to a
terminal for correct execution of the RUN lines, which are printed
intact as they appeared in the original RUN lines except lit
substitutions are expanded. Everything else in the execution trace
appears in shell comments so it has no effect in a terminal.
- Each of the RUN line's commands is repeated (in shell comments) as
it executes to show (1) that the command actually executed (e.g.,
`echo success` above didn't) and (2) what stdout, stderr, non-zero
exit status, and output files are associated with the command, if
any. Shell quoting in the command is now correct and minimal but is
not necessarily the original shell quoting from the RUN line.
- The start and end of the contents of stdout, stderr, or an output
file is now delineated clearly in the trace.
To help produce some of the above output, this patch extends lit's
internal shell with a built-in `@echo` command. It's like `echo`
except lit suppresses the normal execution trace for `@echo` and just
prints its stdout directly. For now, `@echo` isn't documented for use
in lit tests.
Without this patch, libcxx's custom lit test format tries to parse the
stdout from `lit.TestRunner.executeScriptInternal` (which runs lit's
internal shell) to extract the stdout and stderr produced by shell
commands, and that parse no longer works after the above changes.
This patch makes a small adjustment to
`lit.TestRunner.executeScriptInternal` so libcxx can just request
stdout and stderr without an execution trace.
(As a minor drive-by fix that came up in testing: lit's internal `not`
command now always produces a numeric exit status and never `True`.)
Caveat
------
This patch only makes the above changes for lit's internal shell. In
most cases, we do not know how to force external shells (e.g., bash,
sh, window's `cmd`) to produce execution traces in the manner we want.
To configure a test suite to use lit's internal shell (which is
usually better for test portability than external shells anyway), add
this to the test suite's `lit.cfg` or other configuration file:
```
config.test_format = lit.formats.ShTest(execute_external=False)
```
Reviewed By: MaskRay, awarzynski
Differential Revision: https://reviews.llvm.org/D156954
Since C++14 has been released for about nine years and most standard
libraries have implemented sized deallocation functions, it's time to
make this feature default again.
Reviewed By: rnk, aaron.ballman, #libc, ldionne, Mordante, MaskRay
Differential Revision: https://reviews.llvm.org/D112921
GNU/Hurd does have clock_gettime, it just doesn't define _POSIX_TIMERS because its support for timers is not complete.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D158584
PowerPC on linux currently don't have support for lowering long double for
frexp(). Removing the tests until implementation is provided.
Reviewed By: #libc, amyk, Mordante
Differential Revision: https://reviews.llvm.org/D158547
`__assign_view__` is declared as a noexcept function in `libcxx/include/__filesystem/path.h` however internally it calls `std::basic_string<char>::basic_string<char>(std::string_view)` which is not a noexcept function this may lead to a `std::terminate()` call when allocation of a new string fails.
Fixes : https://github.com/llvm/llvm-project/issues/64858
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D158826
When `__locale_dir/locale_base_api/locale_guard.h is` compiled independently, as it is when it's in its own clang module, it fails to compile due to `locale_t` being undefined. It needs to include `__locale` to get that, instead of just `clocale`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D158669
This is obviously a hack, but it's too late at night to figure out the
exact issue and which commit introduced it, and I want to get the CI
back to green for contributors overnight.
Note that there is a Differential revision for the stride ranges
view implementation and the names of the people who are developing
it.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D158446
With C++20 modules in libc++ the old name modules is ambiguous. This
rename makes it clear this is regarding the clang modules.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D153042
The std module can be tested in the generic C++23 build. This removes the
special module build.
Note it is possible to enable modules automatically in CMake, but that
would fail in the "parts disabled" builds; they have not been properly
been converted to modules yet.
Depends on D157625
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D157744
This fixes some missing #ifndef and implements the header restrictions
in the modules script.
Depends on D158192
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158330
This takes the header restrictions into account instead of manually
duplicating this build information. This is a preparation to properly
support the libc++ disabled parts in the std module.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D158192
The building of the std module has been moved from `params.py` and
`dsl.py` to a `lit.local.cfg` for the entire test suite. In theory this
change allows testing modules in most configurations, except:
- combined with clang modules
- C++ versions that don't support the std module
Currently only C++23 with all parts enabled works.
C++26 is expected to work properly with CMake 3.27. That versions of CMake
knows how to invoke clang using C++26.
The parts disabled modi of libc++ have not been modularized yet.
It still is the goal that in the future CMake will be able to do the work
done in `lit.local.cfg`. Doing this in CMake would require a more mature
libc++ implementation.
Thanks a lot to @ldionne for giving hints how to enable modules in a
`lit.local.cfg`.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D157625
__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
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
While testing the std module with -DLIBCXX_ENABLE_WIDE_CHARACTERS=OFF
the build failed. These functions are not exported from the module since
they use wchar_t. Disable them in the headers too.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D158199
The --mapping_file switch was missing; the example would have been
rejected.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D157785