| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++][test] Avoid non-Standard zero-length arrays (#74183) Found while running libc++'s test suite with MSVC's STL, where we use both MSVC's compiler and Clang/LLVM. MSVC's compiler rejects the non-Standard extension of zero-length arrays. For conformance, I'm changing these occurrences to std::array<int, 0>. Many of these files already had #include <array>; I'm adding it to the rest. I wanted to add -Wzero-length-array to libcxx/utils/libcxx/test/params.py to prevent future occurrences, but it complained about product code :crying_cat_face: : In file included from /home/runner/_work/llvm-project/llvm-project/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp:18: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/istream:170: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/ostream:172: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__system_error/error_code.h:18: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__system_error/error_category.h:15: /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:811:25: error: zero size arrays are an extension [-Werror,-Wzero-length-array] 811 | char __padding_[sizeof(value_type) - 1]; | ^~~~~~~~~~~~~~~~~~~~~~ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:817:19: note: in instantiation of member class 'std::basic_string<char>::__short' requested here 817 | static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size."); | ^ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:2069:5: note: in instantiation of template class 'std::basic_string<char>' requested here 2069 | _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) | ^ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__string/extern_template_lists.h:31:60: note: expanded from macro '_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST' 31 | _Func(_LIBCPP_EXPORTED_FROM_ABI basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ | ^ I pushed a tiny commit to fix unrelated comment typos, in an attempt to clear out spurious CI failures. | 2 年前 | |
[libc++][test] Avoid non-Standard zero-length arrays (#74183) Found while running libc++'s test suite with MSVC's STL, where we use both MSVC's compiler and Clang/LLVM. MSVC's compiler rejects the non-Standard extension of zero-length arrays. For conformance, I'm changing these occurrences to std::array<int, 0>. Many of these files already had #include <array>; I'm adding it to the rest. I wanted to add -Wzero-length-array to libcxx/utils/libcxx/test/params.py to prevent future occurrences, but it complained about product code :crying_cat_face: : In file included from /home/runner/_work/llvm-project/llvm-project/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp:18: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/istream:170: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/ostream:172: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__system_error/error_code.h:18: In file included from /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__system_error/error_category.h:15: /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:811:25: error: zero size arrays are an extension [-Werror,-Wzero-length-array] 811 | char __padding_[sizeof(value_type) - 1]; | ^~~~~~~~~~~~~~~~~~~~~~ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:817:19: note: in instantiation of member class 'std::basic_string<char>::__short' requested here 817 | static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size."); | ^ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/string:2069:5: note: in instantiation of template class 'std::basic_string<char>' requested here 2069 | _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) | ^ /home/runner/_work/llvm-project/llvm-project/build/generic-cxx03/include/c++/v1/__string/extern_template_lists.h:31:60: note: expanded from macro '_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST' 31 | _Func(_LIBCPP_EXPORTED_FROM_ABI basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ | ^ I pushed a tiny commit to fix unrelated comment typos, in an attempt to clear out spurious CI failures. | 2 年前 | |
[libc++] NFC: Fix several GCC warnings in the test suite - Several -Wshadow warnings - Several places where we did not initialize our base class explicitly - Unused variable warnings - Some tautological comparisons - Some places where we'd pass null arguments to functions expecting non-null (in unevaluated contexts) - Add a few pragmas to turn off spurious warnings - Fix warnings about declarations that don't declare anything - Properly disable deprecation warnings in ext/ tests (the pragmas we were using didn't work on GCC) - Disable include_as_c.sh.cpp because GCC complains about C++ flags when compiling as C. I couldn't find a way to fix this one properly, so I'm disabling the test. This isn't great, but at least we'll be able to enable warnings in the whole test suite with GCC. | 5 年前 | |
libcxx: Rename .hpp files in libcxx/test/support to .h LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481 | 6 年前 | |
[libc++][ranges] fix std::search_n incorrect static_assert [libc++][ranges] fix std::search_n incorrect static_assert see more detail in https://reviews.llvm.org/D124079?#3661721 Differential Revision: https://reviews.llvm.org/D130124 | 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 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 2 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 3 年前 | ||
| 7 年前 |