[libcxx-commits] [libcxx] Revert "[libc++] Optimize num_put integral functions" (PR #131613)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 17 06:46:24 PDT 2025


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 1e89a76a0490b6c55a3e46ecf967da3e30c9112b 5c1188dfb27c3499f58849bde211ac03026d90d1 --extensions ,h,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_floating_point.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 13152742d5..df2ed100e2 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
@@ -21,31 +21,27 @@
 
 typedef std::num_put<char, cpp17_output_iterator<char*> > F;
 
-class my_facet
-    : public F
-{
+class my_facet : public F {
 public:
-    explicit my_facet(std::size_t refs = 0)
-        : F(refs) {}
+  explicit my_facet(std::size_t refs = 0) : F(refs) {}
 };
 
-int main(int, char**)
-{
-    const my_facet f(1);
-    {
-        std::ios ios(0);
-        void* v = 0;
-        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);
-    }
+int main(int, char**) {
+  const my_facet f(1);
+  {
+    std::ios ios(0);
+    void* v = 0;
+    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);
+  }
 
   return 0;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/131613


More information about the libcxx-commits mailing list