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
Instead of setting mcpu like the previous bots,
set the target triple.
Each config builds either Arm only or Thumb only
code. This gives us some coverage of thumb specific
issues.
The new agents on Linaro's side are running on v8 hardware
so will report arch "armv8l" just like the v8 bots.
(and buildkite can choose any of them for v7/v8 jobs)
Reviewed By: #libc, curdeius, Mordante
Differential Revision: https://reviews.llvm.org/D98019
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97443
Reviewed By: Quuxplusone, EricWF, #libc
Differential Revision: https://reviews.llvm.org/D97911
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97359
Reviewed By: EricWF, #libc, Quuxplusone, zoecarver
Differential Revision: https://reviews.llvm.org/D97443
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97162
Reviewed By: EricWF, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D97359
Fix handling of skip_permission_denied on windows; after converting
the return value of GetLastError() to a standard error_code, ec.value()
is in the standard errc range, not a native windows error code. This
was missed in 156180727d.
The directory "C:\System Volume Information" does seem to exist and
have these properties on most relevant contempory setups.
Differential Revision: https://reviews.llvm.org/D98166
Check that appends with a path object doesn't do allocations, even
on windows.
Suggested by Marek in D98398. The patch might apply without D98398
(depending on how much of the diff context has to match), but doesn't
make much sense until after that patch has landed.
Differential Revision: https://reviews.llvm.org/D98412
This makes sure that no extra allocations happen on windows, fixing
earlier errors in the DisableAllocationGuard (in the second case that
is modified).
This is split out from D98398.
Differential Revision: https://reviews.llvm.org/D98406
This test was previously tweaked in
321f696920 to match the output of
of MS STL (except that the MS STL fails on the testcase with an
empty path).
libc++ doesn't produce paths with all normalized separators (and the
spec doesn't mandate it to either).
Tweak the test reference to match exactly what libc++ produces. If
testing with a non-libc++ library, do a relaxed comparison that allows
the separators to differ.
Differential Revision: https://reviews.llvm.org/D98215
The aim is to add the missing z/OS specific locale functions for libc++ (newlocale, freelocale and uselocale).
Reviewed By: ldionne, #libc, curdeius
Differential Revision: https://reviews.llvm.org/D98044
Don't use the mode_t type - the official windows sdk doesn't have that type.
(Mingw headers does have such a typedef though.) The umask function returns
int on windows, in both header variants.
Thus just use auto to deduce the umask return type automatically.
Differential Revision: https://reviews.llvm.org/D98140
Use "expect" instead of "output" for generating "proximate_expected",
pass the arguments to PathEq in the same order as above, rename the
"proximate_expected" variable to be consistent with the naming of the
earlier "expect", use .empty() instead of .native().empty().
Differential Revision: https://reviews.llvm.org/D98127
Convert the expected result path to preferred separators, add exceptions
to the test results where needed (due to some cases being interpreted
as a root name).
Differential Revision: https://reviews.llvm.org/D98106
If cross testing (and manually specifying a LIBCXX_TARGET_INFO in the
cmake configuration, as the default is to match the build platform),
we want the accessors for querying the target platform, is_windows,
is_darwin, to return the right value depending on which target info
class is used, not based on what platform is running the build and
driving the tests.
When LIBCXX_TARGET_INFO isn't defined, the right target info class
is chosen automatically based on the platform one is running on, so
this shouldn't make any practical difference for such setups.
Differential Revision: https://reviews.llvm.org/D98045
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96742
Differential Revision: https://reviews.llvm.org/D97162
The former was the old unusual name of the out-of-tree backend but it
was renamed to M68k during the code review process to conform with how
almost everything refers to the Motorola 68000 family of processors.
Thus, update the comments to avoid confusion when the backend lands.
The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want. Instead use -W4 which
is the corresponding MSVC option.
This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.
Differential Revision: https://reviews.llvm.org/D98035
The runtimes build uses variables set by add_lit_testsuite to collect
testsuites from all the runtimes.
Differential Revision: https://reviews.llvm.org/D97913
If cross testing on Windows via WSL (at least with WSL 1), the Windows
executables can't be executed if they are in WSL specific directories
(like /tmp).
Differential Revision: https://reviews.llvm.org/D98028
Add ifdefs to the test reference tables for cases where paths are
interpreted differently (paths that contain a root name).
Fix test assumptions regarding has_root_name() and is_absolute() and
add logic to verify the results of is_absolute() for the test cases in
the table.
Also add a testcase for the path "//net/", which seemed like an
omission.
Differential Revision: https://reviews.llvm.org/D89943
Opening a path like \\server (without a trailing share name and
path) produces this error, while opening e.g. \\server\share
(for a nonexistent server/share) produces ERROR_BAD_NETPATH (which
already is mapped).
This happens in some testcases (in fs.op.proximate); as proximate()
calls weakly_canonical() on the inputs, weakly_canonical() checks
whether the path exists or not. When the error code wasn't recognized
(it mapped to errc::invalid_argument), the stat operation wasn't
conclusive and weakly_canonical() errored out. With the proper error
code mapping, this isn't considered an error, just a nonexistent
path, and weakly_canonical() can proceed.
This roughly matches what MS STL does - it doesn't have
ERROR_BAD_PATHNAME in its error code mapping table, but it
checks for this error code specifically in the return of their
correspondence of the stat function.
Differential Revision: https://reviews.llvm.org/D97619
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96660
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D97176
The aim is to add missing non-posix functions for z/OS libc++ (strtod_l and strtof_l).
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D97051
This fixes clang warnings (that are treated as errors when running
the test suite):
libcxx/include/string:4409:59: error: definition of dllimport static field [-Werror,-Wdllimport-static-field-def]
basic_string<_CharT, _Traits, _Allocator>::npos;
The warning is normally not visible as long as the libc++ headers
are treated as system headers.
The same construct is always an error in MSVC.
(One _LIBCPP_FUNC_VIS was added in
2d8f23f571, which broke DLL builds.
59919c4d6b fixed this by adding another
_LIBCPP_FUNC_VIS on the declaration for consistency, but the underlying
issue remained, that one can't use dllimport here.)
Differential Revision: https://reviews.llvm.org/D97168
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96660
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96742
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96660
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96683
This is just a shorter synonym for `__identity<T>::type`.
Use it consistently throughout, where possible.
There is still some metaprogramming in <memory> and <variant>
where `__identity` is being used _without_ immediately calling
`::type` on it; but this is the unusual case, and it will become
even less usual as we start deliberately protecting certain types
against deduction (e.g. D97742).
Differential Revision: https://reviews.llvm.org/D97862
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96657
Reviewed By: ldionne, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D96660
Apple back-deployment testing is currently failing because Green Dragon
is down. To avoid stalling the whole CI pipeline because of that, I am
temporarily disabling those jobs until Green Dragon is back, or even
better we have found a different way to store those small artifacts.
A comment was left for when we would require CMake >= 3, which we do now.
I expect this should be a NFC.
Differential Revision: https://reviews.llvm.org/D97341
We always build the libraries in a Standard mode that supports noexcept,
so there's no need to use the _NOEXCEPT macro.
Differential Revision: https://reviews.llvm.org/D97700
Implements part of P0898R3 Standard Library Concepts
Reworks D74351 to use requires-clauses over SFINAE and so that it more
closely follows the wording.
Co-authored by: Michael Schellenberger Costa <mschellenbergercosta@googlemail.com>
(Michael did all the heavy lifting and I came in to polish it for
submission, since Michael is focussing on `std::format` now.)
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96657
Normally, the run.py wrapper script runs the child processes in
a clean environment, with only the environment variables available
that are passed via the --env parameter.
However, the COMSPEC and TEMP variables are kind of necessary when
running some tests; COMSPEC is necessary for finding the interpreter
when executing commands via std::system().
Before f1a96de1bc, tests were executed
via an intermediate shell which implicitly readded the COMSPEC variable.
The TEMP variable allows temp files to be placed in a sensible
location; if unset, they're placed in the default temp fallback of
C:\Windows instead.
Differential Revision: https://reviews.llvm.org/D97452
On windows, going ahead and actually trying to create the directory
doesn't return an error code that maps to
std::errc::not_a_directory in this case.
This fixes two cases of
TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory))
in filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
for windows (in testcases added in 59c72a7012).
Differential Revision: https://reviews.llvm.org/D97090
If the destructor is trivial (_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION,
the constructor always is), the compiler warns about the
std::condition_variable being unused.
Add a cast to void to silence the warning about the object being unused.
Differential Revision: https://reviews.llvm.org/D97540
Several contributors have been asking me how to reproduce the CI
environment locally. This is the last step towards making that work
out-of-the-box. Basically, just run `libcxx/utils/ci/run-buildbot-container`
and you're good to go.
Differential Revision: https://reviews.llvm.org/D97782
This makes sure that it actually tests the right compare() overloads
in windows configurations.
This also fixes the allocation guards that enforce no allocations
while running the compare() functions.
Differential Revision: https://reviews.llvm.org/D97551
Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.
Also, add XFAIL markup to flag expected errors.
Differential Revision: https://reviews.llvm.org/D91069
libc++ was previously a bit confused by what the value of __cpp_concepts
should be. Also replaces `__floating_point` with `floating_point` now
that it exists.
Differential Revision: https://reviews.llvm.org/D97015
Xcode does bundle Ninja, so we can use that Ninja if there's no system-wide
Ninja installed. This is useful on some CI bots we have that don't come
with Ninja pre-installed.
This avoids having to query pathconf for a max size for
preallocating a buffer for the return value.
This is an extension to the POSIX getcwd() spec.
Differential Revision: https://reviews.llvm.org/D97460
This can't easily be autodetected (unless LIBCXX_TARGET_TRIPLE is
specified, or unless we query what the compiler's default target is,
which only is supported by clang), but can be chosen manually via
LIBCXX_TARGET_INFO.
This chooses mingw style lib naming, and uses -nostdlibc++ instead
of -nodefaultlib -nostdlib (as the latter requires specifying a lot of
details manually - this is done in the cmake config though).
Differential Revision: https://reviews.llvm.org/D97294
This fixes building libunwind with a new enough version of cmake.
(libunwind treats its asm sources as C depending on the cmake version
on some platforms; this fixes builds when such workarounds aren't used,
when cmake treats asm correctly on its own.)
Differential Revision: https://reviews.llvm.org/D97399
Restructure code in directory_entry.obs/file_type_obs.pass.cpp
and directory_entry.obs/hard_link_count.pass.cpp to reduce the
amount of ifdeffery needed.
In file_type_obs.pass.cpp, we can't inline the calls to
env.create_* into the lambda calls (e.g. "test_path(env.create_*())"),
because the lambda removes the referenced file, and the hardlink
must be created while the earlier test file exists.
In hard_link_count.pass.cpp, move restoration of the original
directory permissions to the end of the lambda, so that new
directory entries can be created after the lambda has run once.
Differential Revision: https://reviews.llvm.org/D89948
On Windows, path::value_type is wchar_t, so one can't pass the return
value of path::c_str() directly to std::remove().
This matches what was done for tests under std/input.output/filesystems
in 81db3c31aa and
3784bdf217.
Differential Revision: https://reviews.llvm.org/D97458
This should allow running tests with the interpreter in some of the
default paths where Python for Windows might be installed.
Differential Revision: https://reviews.llvm.org/D97369
Passing the MSVC include dirs via -isystem makes them included before
clang's own include resource dir (<prefix>/lib/clang/<version>/include).
This causes includes of stddef.h to bypass clang's stddef.h which
defines max_align_t, which libc++ needs defined.
This was added in 4372f06d0f when the
initial windows testing support was added, and has been brought along
since. It's unclear if this was needed back then - now it no longer is
needed at least, and since libc++ started depending on max_align_t, this
became an issue.
Differential Revision: https://reviews.llvm.org/D97167
This matches how libc++ itself is built. This avoids errors due to
mismatch if linking libc++ statically.
Differential Revision: https://reviews.llvm.org/D97169
The implementation of tuple's constructors and assignment operators
currently diverges from the way the Standard specifies them, which leads
to subtle cases where the behavior is not as specified. In particular, a
class derived from a tuple-like type (e.g. pair) can't be assigned to a
tuple with corresponding members, when it should. This commit re-implements
the assignment operators (BUT NOT THE CONSTRUCTORS) in a way much closer
to the specification to get rid of this bug. Most of the tests have been
stolen from Eric's patch https://reviews.llvm.org/D27606.
As a fly-by improvement, tests for noexcept correctness have been added
to all overloads of operator=. We should tackle the same issue for the
tuple constructors in a future patch - I'm just trying to make progress
on fixing this long-standing bug.
PR17550
rdar://15837420
Differential Revision: https://reviews.llvm.org/D50106
This makes the symlinks work properly on windows.
A similar round of cleanup was done in
c41bda7f5f, but these tests were
added after that.
Differential Revision: https://reviews.llvm.org/D97089
The spec doesn't declare it as an enum class, and being declared
as an enum class breaks referring to the values as e.g.
path::auto_format.
Differential Revision: https://reviews.llvm.org/D97084
These don't seem to have any function in the test.
The non_regular_file one seems to have been added in
0f8c8f59df, without any apparent
purpose there.
Differential Revision: https://reviews.llvm.org/D97083
This feature can be built successfully for windows now. However,
the helper functions for __int128_t aren't available in MSVC
configurations, so don't enable it by default there yet. (See
https://reviews.llvm.org/D91139 for discussion on how to proceed
with things in MSVC environments.)
Differential Revision: https://reviews.llvm.org/D97075
This patch ensures that SFINAE is used to delete assignment operators in pair and tuple based on issue 2729.
Differential Review: https://reviews.llvm.org/D62454
This matches what MS STL returns; in std::filesystem, forward slashes
are considered generic dir separators that are valid on all platforms.
Differential Revision: https://reviews.llvm.org/D91181
This patch implements 2802. Requires _Deleter to have call operator and be move constructible. Based on D62233.
Refs PR37637.
Differential Revision: https://reviews.llvm.org/D62274
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D96577
The use of fchmodat() is beeing guarded but its using declaration is not. Let's use the same guard in both places to avoid compiler errors on platforms where `fchmodat` does not exist.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D96303
The root_path function has to be changed to return the parsed bit
as-is; otherwise a path like "//net" gets a root path of "//net/", as
the root name, "//net", gets the root directory (an empty string) appended,
forming "//net/". (The same doesn't happen for the root dir "c:" though.)
Differential Revision: https://reviews.llvm.org/D91178
Let's use -nostdlib++ rather than -nodefaultlibs when building libc++/libc++abi/libunwind libraries. The default is -nostdlib++ if supported by a build compiler like it is the case with clang, otherwise -nodefaultlibs is used as before.
This change is needed to avoid additional changes at the link step and not to increase the maintenance costs. If clang with -nodefaultlibs is used all the libraries which are removed but required would have to be manually added in. This set of libraries are unique and will send out.
The propose change will allow to make the link step simple for other platforms as well.
Reviewed By: #libc, #libc_abi, ldionne
Differential Revision: https://reviews.llvm.org/D95875
This allows building libc++ against winpthreads from mingw-w64 to support
operating systems older than Windows 7. The remaining libc++ code already
supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`.
Note that there is also the older "pthreads-win32". However, that support
library implements `pthread_t` as a struct, which violates the libc++
assumption that `pthread_t` is always a scalar and can be compared,
ordered, and set to zero.
Differential Revision: https://reviews.llvm.org/D96339
The namespace is unnecessary, and libc++ style is not to include it on type names.
(As opposed to function names, where qualification affects ADL; and in certain
function signatures where `std::` and `_VSTD::` might be mangled differently.
This is none of those situations.)
Always turn on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS, if libcxxrt is used
as the C++ ABI library, since libcxxrt does not provide the full set
ofnew and delete operators. In particular, the aligned versions of these
operators are completely missing. This primarily addresses builds on
FreeBSD, as this platform uses libcxxrt by default.
Also, attempt to provide a FreeBSD.cmake cache file, with hopefully sane
settings, partially copied from the Apple.cmake cache file. This needs
more work, probably some additions to ci build scripts (although I am
not aware of any 'official' FreeBSD build bots).
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96720
We need CLOCK_MONOTONIC equivalent implementation for z/OS within libc++. The default implementation is asserting.
On z/OS the lack of 'clock_gettime()' and 'time_point()' force us to look for alternatives.
The current proposal is to use `gettimeofday()` for CLOCK_MONOTONIC which is also used in CLOCK_REALTIME. This will allow us to skip the assertion with compromised CLOCK_MONOTONIC implementation which will not guarantee to never go back in time because it will use `gettimeofday()` but only when it's set.
Is this a good compromise for platforms which does not support monotonic clock?
Hopefully this will spark the discussion and agreement how to proceed in this situation.
Reviewed By: #libc, ldionne, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D93542
It seems like modifying the header doesn't cause libc++ to be rebuild.
So the breakage of the previous commit didn't happen on my system.
This should fix the build of https://buildkite.com/mlir/mlir-core
Implements parts of:
- P0645 Text Formatting
Depends on D92214
Reland with changes:
The format header will only be compiled if the compiler used has support
for concepts. This should fix the issues with the initial version.
Differential Revision: https://reviews.llvm.org/D93166
Not using builtins doesn't always imply worse code,
but for e. g. isinf, this is 30%+ faster.
Before:
name time/op
BM_isinf 2.14ns ± 2%
After:
name time/op
BM_isinf 1.33ns ± 2%
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88854
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D96235
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D74292
Implements parts of:
* P0898R3 Standard Library Concepts
* P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D88131
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D96230
Differential Revision: https://reviews.llvm.org/D96232
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D77961
Differential Revision: https://reviews.llvm.org/D96230
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D77961
Implement the resolution of LWG2993. Replace a deleted constructor
with a constructor that SFINAEs away in appropriate circumstances.
Also, now that the constructor is templated, we must have an
explicit deduction guide to make CTAD work.
Some tests have been merged in from Agustín Bergé's D40259.
Differential Revision: https://reviews.llvm.org/D92725
Adds `noexcept` to `string_view`/`string::find` and similar members
(`rfind`, etc.). See discussion in D95251. Refs D95821.
Reviewed By: curdeius, ldionne
Differential Revision: https://reviews.llvm.org/D95848
Some work-in-progress patches for the format header contain benchmarks.
The format header requires C++20 to build. This is a preparation to make
it easy to add these benchmarks.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96057
Building libcxx requires at least C++17 so remove the old work-arounds.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D96200
Switch StdTuple printer from python 2-style "next" to python 3.
Nested iteration changed enough to make the original bitset iteration
code a bit trickier than it needs to be, so unnest.
The end node of a map iterator is sometimes hard to detect in isolation,
don't fail in that case.
Differential Revision: https://reviews.llvm.org/D96167
This does roughly the same as the manual implementation, but checks
a slightly different set of environment variables and has a more
appropriate fallback if no environment variables are available
(/tmp isn't a very useful fallback on windows).
Differential Revision: https://reviews.llvm.org/D91175
This works just fine for windows, as all the functions it calls
are implemented and wrapped for windows.
Differential Revision: https://reviews.llvm.org/D91173
- Quality-of-implementation: Avoid calling __unwrap_iter in constexpr contexts.
The user might conceivably write a contiguous iterator where normal iterator
arithmetic is constexpr-friendly but `std::to_address(it)` isn't.
- Bugfix: When you pass contiguous iterators to `std::copy`, you should get
back your contiguous iterator type, not a raw pointer. That means that
libc++ can't `__unwrap_iter` unless it also does `__rewrap_iter`.
Fortunately, this is implementable.
- Improve test coverage of the new `contiguous_iterator` test iterator.
This catches the bug described above.
- Tests: Stop testing that we can `std::copy` //into// an `input_iterator`.
Our test iterators may currently support that, but it seems nonsensical to me.
Differential Revision: https://reviews.llvm.org/D95983
Adds documentation around libc++'s policy to add noexcept to things that cannot throw but aren't marked as noexcept.
Refs LWG 3518 and D95251.
Differential Revision: https://reviews.llvm.org/D95821
This reverts commit b6ffece320.
The bug is now fixed (it was a stupid cut-and-paste kind of error),
and the regression test added. The new patch is also simpler than the old one!
Differential Revision: https://reviews.llvm.org/D96084
Note: contrary to what I said previously, I didn't change .clang-format nor utils/generate_feature_test_macro_components.py script.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D92229
Before this patch, feature-test macros didn't take special availability
markup into account, which means that feature-test macros can sometimes
appear to "lie". For example, if you compile in C++20 mode and target
macOS 10.13, the __cpp_lib_filesystem feature-test macro will be provided
even though the <filesystem> declarations are marked as unavailable.
This patch fixes that.
rdar://68142369
Differential Revision: https://reviews.llvm.org/D94983
These function makes it easier to write generic unit tests for the
format header. It solves the issue where it's not possible to use
`templated_prefix"foo"`
where `templated_prefix` resolves to: nothing, `L`, `u8`, `u`,
or `U`. The templated_prefix would be more faster during execution.
Reviewed By: ldionne, #libc, curdeius
Differential Revision: https://reviews.llvm.org/D93414
We do ship those headers, so the directory name should not be something
that can potentially conflict with user-defined directories.
Differential Revision: https://reviews.llvm.org/D95956
- Implement C++20's changes to `reverse_iterator`, so that it won't be
accidentally counted as a contiguous iterator in C++20 mode.
- Implement C++20's changes to `move_iterator` as well.
- `move_iterator` should not be contiguous. This fixes a bug where
we optimized `std::copy`-of-move-iterators in an observable way.
Add a regression test for that bugfix.
- Add libcxx tests for `__is_cpp17_contiguous_iterator` of all relevant
standard iterator types. Particularly check that vector::iterator
is still considered contiguous in all C++ modes, even C++03.
After this patch, there continues to be no supported way to write your
own iterator type in C++17-and-earlier such that libc++ will consider it
"contiguous"; however, we now fully support the C++20 approach (in C++20
mode only). If you want user-defined contiguous iterators in C++17-and-earlier,
libc++'s position is "please upgrade to C++20."
Differential Revision: https://reviews.llvm.org/D94807
This will allow running back-deployment testing on macOS only on systems
running the right version of macOS. For the time being, we're cheating
because we don't have actual machines running older than 10.15.
This reverts commit 35a57f39b5.
A build is broken during clang bootstrap with:
In file included from ../libcxx/src/format.cpp:9:
/tmp/ci-nGNyLRM9V3/include/c++/v1/format:153:16: error: no member named 'is_constant_evaluated' in namespace 'std::__1'
if (_VSTD::is_constant_evaluated() && __id >= __num_args_)
~~~~~~~^
1 error generated.
Implements:
- LWG3149 DefaultConstructible should require default initialization
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D91986
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D93461
Add deleted volatile copy-assignment operator in the most derived atomic
to fix the Bug 41784. The root cause: there is an `operator=(T) volatile`
that has better match than the deleted copy-assignment operator of the base
class when `this` is `volatile`. The compiler sees that right operand of
the assignment operator can be converted to `T` and chooses that path
without taking into account the deleted copy-assignment operator of the
base class.
The current behavior on libstdc++ is different from what we have in libc++.
On the same test compilation fails with libstdc++. Proof: https://godbolt.org/z/nebPYd
(everything is the same except the -stdlib option).
I choose the way with explicit definition of copy-assignment for atomic
in the most derived class. But probably we can fix that by moving
`operator=(T)` overloads to the base class from both specializations.
At first glance, it shouldn't break anything.
Differential Revision: https://reviews.llvm.org/D90968
After committing D92214 it was noticed libc++ no longer builds with
C++17. For now reenable building with C++17. This is intended to be a
temporary measure in the future a C++20 capable compiler will be
required.
The MS STL does even more cleanup (corresponding to lexically_normal
I think), but this seems to be the very minimum needed for making the
symlinks work when the target path contains non-native paths.
Differential Revision: https://reviews.llvm.org/D91145
Use the corresponding wchar functions, named "_wfunc" instead of "func",
where feasible, or reimplement functions with native windows APIs.
Differential Revision: https://reviews.llvm.org/D91143
While the windows CRTs (the modern UCRT, and the legacy msvcrt.dll
that mingw still often defaults to) do provide stat functions, they're
a bit lacking - they only provide second precision on the modification
time, lack support for symlinks and a few other details.
Instead reimplement them using a couple windows native functions,
getting exactly the info we need. (Technically, the implementation
within the CRT calls these functions anyway.)
If we only need a few fields, we could also do with fewer calls, as a
later optimization.
Differential Revision: https://reviews.llvm.org/D91141
... so that comparisons with an `int` LHS and `MoveOnly` RHS are valid, as is necessary for the `partial_sort_copy` test to pass with an implementation that doesn't force a conversion to the type of the RHS as libc++ does.
P1614R2 removes most of `directory_entry`'s member comparison operators, leaving only `operator==` and `operator<=>`. This test should require the comparison expressions to be valid rather than require the member functions to be present so it is correct in both C++17 and C++20 modes.
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on: D91004
Reviewed By: ldionne, cjdb, #libc
Differential Revision: https://reviews.llvm.org/D91986
This is the first step at implementing <format>. It adds the <format> header
and implements the `format_error`. class.
Implemnts parts of:
-P0645 Text Formatting
Reviewed By: ldionne, #libc, miscco, curdeius
Differential Revision: https://reviews.llvm.org/D92214
This patch is more than just adding the `constexpr` keyword, because
the old code relied on `goto`, and `goto` is not constexpr-friendly.
Refactor to eliminate `goto`, and then mark it as constexpr in C++20.
I freely admit that the name `__nth_element_partloop` is bad;
I couldn't find any better name because I don't really know
what this loop is doing, conceptually. Vice versa, I think
`__nth_element_find_guard` has a decent name.
Now the only one we're still missing from P0879 is `sort`.
Differential Revision: https://reviews.llvm.org/D93557
https://reviews.llvm.org/rG5369517d20dd362a178a1b2d6c398d8898ee4620
bumped the version number in __config to 13000, causing a test failure
in libcxx/test/libcxx/libcpp_version.pass.cpp because now the two
don't match.
This is the only part of the post-release TODO in
libcxx/docs/Contributing.rst that wasn't done by that commit.
LWG reflector consensus is that this was a bug in libc++.
(In particular, MSVC also will fix it in their STL, soon.)
Bug originally discovered by Logan Smith.
Also fix `std::function<const void()>`, which should work
the same way as `std::function<void()>` in terms of allowing
"conversions" from non-void types.
Differential Revision: https://reviews.llvm.org/D94452
After this patch, the only parts of P0879 that remain missing will be
std::nth_element, std::sort, and the heap/partial_sort algorithms.
Differential Revision: https://reviews.llvm.org/D93443
Defining PATH_MAX to _XOPEN_PATH_MAX which is the closest macro available on z/OS.
Note that this value is 1024 which is 4 times smaller from same macro on Linux.
Reviewed By: #libc, ldionne, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D92110
During the review of D91986 it has been discovered the in C++11
deprecated `throw()` exception specification has been removed in
C++20. Removed the part of the test code using this feature.