LLouis Dionne[libc++] Add basic runtime assertions to <semaphore>
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++] Move all the remaining .fail.cpp tests to .verify.cpp I made sure they all had some expected-error output in them. Many of these tests would be better implemented as a positive test using SFINAE, but this is beyond the scope of this patch. Differential Revision: https://reviews.llvm.org/D153980 | 3 年前 | |
[libc++] mark barrier constructor as explicit in <barrier> If I read the standard correctly, the public constructor of "barrier" should be marked as "constexpr explicit". I see some of the internal classes used by the barrier header are correctly marked but I think, if I'm not mistaken, the standard would like the public class to have the correct definition as well. Because the implementation that llvm uses by default is not constexpr friendly at this time, this revision will focus on only marking it as explicit. Reviewed By: #libc, philnik, Mordante Spies: philnik, Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D154590 | 3 年前 | |
[libc++] Use the stdlib=<LIB> Lit feature instead of use_system_cxx_lib The use_system_cxx_lib Lit feature was only used for back-deployment testing. However, one immense hole in that setup was that we didn't have a proper way to test Apple's own libc++ outside of back-deployment, which was embodied by the fact that we needed to define _LIBCPP_DISABLE_AVAILABILITY when testing (see change in libcxx/utils/libcxx/test/params.py). This led to the apple-system testing configuration not checking for availability markup, which is obviously quite bad since the library we ship actually has availability markup. Using stdlib=<VENDOR>-libc++ instead to encode back-deployment restrictions on tests is simpler and it makes it possible to naturally support tests such as availability markup checking even in the tip-of-trunk Apple-libc++ configuration. Differential Revision: https://reviews.llvm.org/D146366 | 3 年前 | |
Support tests in freestanding Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding main isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its return statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the return we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare main as int main(int, char** so it mangles consistently (enabling us to declare another extern "C" main for freestanding which calls the mangled one), and adds return 0; to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with -x c, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086 | 7 年前 | |
[libc++] add test for latch ctor Currently, there are no tests to confirm without a doubt the constructor of latch is really constexpr and explicit. I think this would be an addition that it would not harm to have. In another revision, I was asked to add tests for an almost identical case which made me consider adding this test for the latch class too. Reviewed By: #libc, philnik Spies: philnik, libcxx-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D154957 | 3 年前 | |
[libc++] Move all the remaining .fail.cpp tests to .verify.cpp I made sure they all had some expected-error output in them. Many of these tests would be better implemented as a positive test using SFINAE, but this is beyond the scope of this patch. Differential Revision: https://reviews.llvm.org/D153980 | 3 年前 | |
[libc++] Remove useless nothing_to_do.pass.cpp tests The testing script used to test libc++ historically did not like directories without any testing files, so these tests had been added. Since this is not necessary anymore, we can now remove these files. This has the benefit that the total number of tests reflects the real number of tests more closely, and we also skip some unnecessary work (especially relevant when running tests over SSH). However, some nothing_to_do.pass.cpp tests actually serve the purpose of documenting that an area of the Standard doesn't need to be tested, or is tested elsewhere. These files are not removed by this commit. Removal done with: import os import itertools for (dirpath, dirnames, filenames) in itertools.chain(os.walk('./libcxx/test'), os.walk('./libcxxabi/test')): if len(filenames + dirnames) > 1 and \ any(p == 'nothing_to_do.pass.cpp' for p in filenames): os.remove(os.path.join(dirpath, 'nothing_to_do.pass.cpp')) | 6 年前 | |
[libc++] Add basic runtime assertions to <semaphore> Adding assertions will aid users that have bugs or logic mistakes in their code to receive error messages when debugging. Differential Revision: https://reviews.llvm.org/D155399 | 2 年前 | |
[libc++] Make stop_token experimental There are discussions about different ways of implementing stop_token to make it more performant mark stop_token as experimental to allow us to change the design before it is shipped Co-authored-by: Louis Dionne <ldionne.2@gmail.com> Differential Revision: https://reviews.llvm.org/D154700 | 3 年前 | |
[libc++][format] Improves diagnostics. Improves both the compile-time and run-time errors. At compile-time it does a bit more work to get more specific errors. This could be done at run-time too, but that has a performance penalty. Since it's expected most use-cases use format* instead of vformat* the compile-time errors are more common. For example when using std::format_to("{:-c}", 42); Before compile output would contain std::__throw_format_error("The format-spec should consume the input or end with a '}'"); Now it contains std::__throw_format_error("The format specifier does not allow the sign option"); Given a better indication the sign option is not allowed. Note the output is still not user-friendly; C++ doesn't have good facilities to generate nice messages from the library. In general all messages have been reviewed and improved, using a more consistent style and using less terms used in the standard. For example format-spec -> format specifier arg-id -> argument index Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152624 | 2 年前 | |
[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ Since those features are general properties of the environment, it makes sense to use them from libc++abi too, and so the name libcpp-has-no-xxx doesn't make sense. Differential Revision: https://reviews.llvm.org/D126482 | 4 年前 |