[libcxx-commits] [libcxx] [libc++] Optimize num_get integral functions (PR #120859)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Dec 21 15:16:12 PST 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 fd784726db70a5155594c32ee839b8807fafd87d 9de9924b5cbef9dea7e738e7e751d9571ee177fd --extensions cpp,,h -- libcxx/test/benchmarks/locale/num_put.bench.cpp libcxx/include/__charconv/tables.h libcxx/include/__charconv/to_chars_base_10.h libcxx/include/__charconv/to_chars_integral.h libcxx/include/__charconv/to_chars_result.h libcxx/include/__charconv/traits.h libcxx/include/__format/formatter_integral.h libcxx/include/__format/formatter_output.h libcxx/include/locale libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
index 9685c2cd45..b4c0b4cb01 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
@@ -32,18 +32,18 @@ int main(int, char**)
{
const my_facet f(1);
{
- std::ios ios(nullptr);
- void* v = nullptr;
- char str[50];
- cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
- std::string ex(str, base(iter));
- char expected_str[32] = {};
- // num_put::put uses %p for pointer types, but the exact format of %p is
- // implementation defined behavior for the C library. Compare output to
- // snprintf for portability.
- int rc = snprintf(expected_str, sizeof(expected_str), "%p", v);
- assert(rc > 0);
- assert(ex == expected_str || ex == "0x0");
+ std::ios ios(nullptr);
+ void* v = nullptr;
+ char str[50];
+ cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
+ std::string ex(str, base(iter));
+ char expected_str[32] = {};
+ // num_put::put uses %p for pointer types, but the exact format of %p is
+ // implementation defined behavior for the C library. Compare output to
+ // snprintf for portability.
+ int rc = snprintf(expected_str, sizeof(expected_str), "%p", v);
+ assert(rc > 0);
+ assert(ex == expected_str || ex == "0x0");
}
return 0;
``````````
</details>
https://github.com/llvm/llvm-project/pull/120859
More information about the libcxx-commits
mailing list