[libcxx-commits] [libcxx] [libc++][string] Remove potential non-trailing 0-length array (PR #105865)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 23 11:05:59 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 04ab647b3f145946397837c6ba10ae0795b9bd01 c9dc219056c6cbf8674ac5021a7d3c4bfb566a5c --extensions -- libcxx/include/string
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index 5c1954e384..251b8632bc 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -749,7 +749,7 @@ struct __uninitialized_size_tag {};
struct __init_with_sentinel_tag {};
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-template<class _T, size_t __min_cap, size_t _Padding=sizeof(_T) - 1>
+template <class _T, size_t __min_cap, size_t _Padding = sizeof(_T) - 1>
struct __short_impl {
_T __data_[__min_cap];
unsigned char __padding_[_Padding];
@@ -757,14 +757,14 @@ struct __short_impl {
unsigned char __is_long_ : 1;
};
-template<class _T, size_t __min_cap>
+template <class _T, size_t __min_cap>
struct __short_impl<_T, __min_cap, 0> {
value_type __data_[__min_cap];
unsigned char __size_ : 7;
unsigned char __is_long_ : 1;
};
#else
-template<class _T, size_t __min_cap, size_t _Padding=sizeof(_T) - 1>
+template <class _T, size_t __min_cap, size_t _Padding = sizeof(_T) - 1>
struct __short_impl {
struct _LIBCPP_PACKED {
unsigned char __is_long_ : 1;
@@ -773,7 +773,7 @@ struct __short_impl {
char __padding_[_Padding];
_T __data_[__min_cap];
};
-template<class _T, size_t __min_cap>
+template <class _T, size_t __min_cap>
struct __short_impl<_T, __min_cap, 0> {
struct _LIBCPP_PACKED {
unsigned char __is_long_ : 1;
@@ -927,7 +927,6 @@ private:
enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
-
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
using __short = __short_impl<value_type, __min_cap>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/105865
More information about the libcxx-commits
mailing list