Need to exclude nasty_macros.h from check-cxx on z/OS due to conflicts within system headers.
Sample failure in `random_shuffle.depr_in_cxx14.verify.cpp` libcxx test.
```
error: 'error' diagnostics seen but not expected:
Line 1268: expected ')'
Line 1268: unknown type name 'This'
Line 1268: expected ')'
```
caused by the following macros in `nasty_macros.h`
```
#define NASTY_MACRO This should not be expanded!!!
#define _E NASTY_MACRO
```
The name collision is observed in the following code snippet whre `_E` is being used as parameter name:
```
inline int iswalnum(wint_t _E) {return __iswalnum(_E);}
```
It is reasonable to exclude `nasty_macros.h` on z/OS similarly as it was done on Windows.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D99378
This patch changes the variant even in pre-C++2b.
It should not break anything, only allow use cases that didn't work previously.
Notes:
`__as_variant` is used in `__visitation::__variant::__visit_alt`, but I haven't used it in `__visitation::__variant::__visit_alt_at`.
That's because it is used only in `__visit_value_at`, which in turn is always used on variant specializations (that's in comparison operators).
* https://wg21.link/P2162
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D97394
This refactor is not only a good idea, but is in fact required by the standard,
in the sense that <array> is mandated to include <compare>.
So <compare> shouldn't have a circular dependency on <array>!
Differential Revision: https://reviews.llvm.org/D99307
This safeguards against cases if some of the env vars contain chars
that are problematic for shells, e.g. if called with --env "X=Y;Z".
(In cases of cross testing for windows, the PATH variable can end up
specified with semicolon separators - even if specifying a PATH when
cross testing in such differing environments might not make sense or
do anything - but this makes ssh.py not break on such a variable.)
Differential Revision: https://reviews.llvm.org/D99242
This path would unblock the build of libc++ library on AIX:
1. Add _AIX guard for _LIBCPP_HAS_THREAD_API_PTHREAD
2. Use uselocale to actually take the locale setting
into account.
3. extract_mtime and extract_atime mod needed for AIX. As stat
structure on AIX uses internal structure st_timespec to store
time for binary compatibility reason. So we need to convert it
back to timespec here.
4. Do not build cxa_thread_atexit.cpp for libcxxabi on AIX.
Differential Revision: https://reviews.llvm.org/D97558
Including xlocinfo.h is a bit of a layering violation; locale.h is
the C library header we should use, while xlocinfo.h is essentially
part of the MS C++ library. Including xlocinfo.h brings in yvals.h,
which brings in yvals_core.h, which defines the MS STL's version
support macros, overriding what libc++'s <version> had defined.
Instead just include locale.h, and provide the few defines we need
for locale categories manually.
Differential Revision: https://reviews.llvm.org/D99213
When building in MSVC mode (in release mode), the assert(false) don't
make the end of the function unreachable, so add return statements to
silence compiler warnings (treated as errors).
Also change 'virtual' into 'override', which was requested in review,
as these files require C++11.
Differential Revision: https://reviews.llvm.org/D99214
My attempts to play around with the old graph_header_deps.py were mostly fruitless;
I needed to modify it in various ways to make it work, and then even when I got it
working, it generated pretty ugly graphs.
Old graph_header_deps.py (after my local changes to simplify the usage)
(producing https://i.imgur.com/zATrsaP.jpg )
mkdir foo
time ./graph_header_deps.py --libcxx-only -o foo --clang-command ~/llvm-project/build/bin/clang++
dot -Tpng < foo/all_headers.dot > old.png
file old.png
real 0m37.453s
old.png: PNG image data, 25882 x 3035, 8-bit/color RGBA, non-interlaced
New graph_header_deps.py
(producing https://i.imgur.com/ZU0G52U.png )
time ./graph_header_deps.py | dot -Tpng > new.png
file new.png
real 0m1.063s
new.png: PNG image data, 6162 x 1344, 8-bit/color RGBA, non-interlaced
Differential Revision: https://reviews.llvm.org/D99124
Left to finish P0482:
* <cuchar> header.
* Parts of <memory_resource> concerning char8_t. Also, tests for hash<pmr::*string>.
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D99184
CMAKE_STATIC_LIBRARY_PREFIX affects the naming of all static libs (in
MSVC configurations), including c++experimental, which only is produced
as static regardless of LIBCXX_ENABLE_STATIC.
Differential Revision: https://reviews.llvm.org/D99176
Mostly, *don't* include <experimental/__config> from C++17 <any>,
because that doesn't make any sense. I think it was just a cut-and-paste
typo when this header moved from experimental/.
Differential Revision: https://reviews.llvm.org/D99089
Simmilar to many other similar path handling tests, convert the
test reference to preferred separators, and ifdef a few test references
that use network root names.
Additionally, generalize code for trimming off the root path for
generating relative_cwd, and for skipping the root name element
in count_path_elems.
Rename one fictive path for consistency with the other test cases,
and add a bunch of more test cases for completeness.
Differential Revision: https://reviews.llvm.org/D98988
This makes no attempt yet to look into the why/what for each of them,
but makes the CI configuration useful for tracking further regressions.
After looking into each case, they can either be fixed, or converted
into UNSUPPORTED: windows or XFAIL: windows, once the cause is known
and explained.
A number of the filesystem cases can be fixed by patches that are
currently in review.
Differential Revision: https://reviews.llvm.org/D99095
Fix nesting of static_env and CWDGuard, restore the cwd (with
CWDGuard) before cleaning up the static_env.
Previously, every test run left 2 directories behind in the temp dir.
Differential Revision: https://reviews.llvm.org/D98954
The container headers don't need to include <functional> for any other reason
(or at least, they wouldn't if we moved `less` and `equal_to` out of <functional>),
so let's put `__libcpp_erase_if_container` somewhere that's common to the
containers but outside of <functional>.
Also, calling `std::erase_if(c, pred)` should not trigger ADL.
Differential Revision: https://reviews.llvm.org/D99043
I was trying to fix something else and I stumbled upon several methods
that are not used anymore in target_info.py.
Differential Revision: https://reviews.llvm.org/D98896
This seems to be a documented quirk in libc++'s implementation of
weakly_canonical (in a comment in the weakly_canonical test).
Together with a difference between windows and posix regarding whether
paths can go through nonexistent dirs, this results in a difference in
a trailing slash.
Just document this as expected, and degrade the comment from fixme to
a note, as MS STL and libstdc++ behave in the same way.
Differential Revision: https://reviews.llvm.org/D98642
This came out of my review comments on D97283.
This patch re-enables the use of `__is_fundamental`, `__is_signed`, etc.
on non-Clang compilers. Previously, when we found that a builtin didn't
work on old Clangs, we had been reacting by limiting its use to new Clangs
(i.e., we'd also stop using it on new GCCs and new MSVCs, just because of
the old Clang bug). I claim that this was unintentional.
Notice that on Apple Clang, `_LIBCPP_COMPILER_CLANG` is defined and
`_LIBCPP_CLANG_VER` is not defined (therefore `0` in arithmetic expressions).
We assume that Apple Clang has all the bugs of all the Clangs.
Differential Revision: https://reviews.llvm.org/D98720
Prior to e0d01294bc, all tests used a
random directory name, but now it is deterministic, based on the
test name. This change was done under the assumption that the filename
portion of the cwd is unique across tests that use the filesystem
test temporary directories.
When running tests locally, the cwd of the test is something like
"<build-dir>/test/<test path>/Output/copy_assign.pass.cpp.dir",
and the filename portion, "copy_assign.pass.cpp.dir", is used as
base for the temp directory names.
The change noted that there's a risk for race conditions if multiple
threads within one test try to create temp directories in parallel, but
that doesn't really happen in practice.
However, if running tests with a large number of parallel workers,
multiple tests with the same filename portion, e.g. "copy_assign.pass.cpp.dir",
can run in parallel, leading to race conditions across processes.
Therefore, add a hash of the full cwd to distinguish such cases
from each other.
Secondly, don't use two separate levels of temporary directories
(<base>/static_env.0). When cleaning up, only the individual
directory is removed, leaving the empty intermediate directory
behind littering the temp directory.
Differential Revision: https://reviews.llvm.org/D98703
The aim is to use the correct vasprintf implementation for z/OS libc++, where a copy of va_list ap is needed. In particular, it avoids the potential that the initial internal call to vsnprintf will modify ap and the subsequent call to vsnprintf will use that modified ap.
Differential Revision: https://reviews.llvm.org/D97473
Both libc++ and libc++abi have options of merging with another archive. In the case of libc++abi, libunwind can be merged into it and in the case of libc++, libc++abi can be merged into it.
This is realized using add_custom_command with POST_BUILD and the usage of the CMake generator expression TARGET_LINKER_FILE in the arguments. For such generator expressions CMake doc states: "This target-level dependency does NOT add a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled" [1]
This patch adds a DEPENDS argument to both add_custom_command invocations so that the archives also have a file-level dependency on the target they are merging with. That way, changes in say, libunwind source code, will be updated in the libc++abi and/or libc++ static libraries as well.
[1] https://cmake.org/cmake/help/v3.20/command/add_custom_command.html
Differential Revision: https://reviews.llvm.org/D98129
`__cpp_lib_default_template_type_for_algorithm_values` is 52 characters long,
which is enough to reduce the multiplier to less-than-zero, producing an empty
string between the name of the macro and its numeric value. Ensure there's
always a space between the name of the macro and its value.
Differential Revision: https://reviews.llvm.org/D98869
Also fix a comment typo, and remove a superfluous "std::" qualififcation
in __libcpp_semaphore_wait_timed for consistency.
This mirrors what was suggested in review of
1773eec692.
Differential Revision: https://reviews.llvm.org/D98015
This is my attempt to merge D98077 (bugfix the format strings for
Windows paths, which use wchar_t not char)
and D96986 (replace C++ variadic templates with C-style varargs so that
`__attribute__((format(printf)))` can be applied, for better safety)
and D98065 (remove an unused function overload).
The one intentional functional change here is in `__create_what`.
It now prints path1 and path2 in square-brackets _and_ double-quotes,
rather than just square-brackets. Prior to this patch, it would
print either path double-quoted if-and-only-if it was the empty
string. Now the double-quotes are always present. I doubt anybody's
code is relying on the current format, right?
Differential Revision: https://reviews.llvm.org/D98097
In previous versions of clang, __is_signed and __is_unsigned builtins did not
correspond to is_signed and is_unsigned behaviour for enums. The builtins were
fixed in D67897 and D98104.
* Disable the fast path of is_unsigned for clang versions < 13
* Add more tests for is_signed, is_unsigned and is_arithmetic
Differential Revision: https://reviews.llvm.org/D97283
Check a different set of env vars, don't check the exact value
of the fallback path. (GetTempPath falls back to returning the Windows
folder if nothing better is available in env vars.)
The test still fails one check on windows (due to relying on perms::none),
which will be addressed separately.
Differential Revision: https://reviews.llvm.org/D98139
Add the missing includes for getting the defines and functions used
in the mingw version of get_temp_file_name().
This fixes 31 tests when built in a mingw configuration.
Also remove a redundant ifdef; _WIN32 is defined in mingw targets too.
Differential Revision: https://reviews.llvm.org/D97456
On windows, the path internal representation is wchar_t, and
input/output often goes through utf8 inbetween, which causes extra
allocations.
MS STL also fails a number of strict allocation checks, so this
shouldn't be a standards compliance issue.
Differential Revision: https://reviews.llvm.org/D98398
Refresh the existing paragraphs on building in MSVC configurations,
add a sample of one working configuration for MinGW, and add more
details on what's necessary to run the tests these days.
Differential Revision: https://reviews.llvm.org/D97166
The aim is to define _LIBCPP_ELAST for z/OS libc++ since strerror/strerror_r can't handle out-of-range errno values.
Differential Revision: https://reviews.llvm.org/D98541
The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.
Differential Revision: https://reviews.llvm.org/D98207
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97911
Reviewed By: EricWF, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D98154