[libc-commits] [libc] [libc] Declare reallocarray in stdlib.h / malloc.h (PR #184223)

via libc-commits libc-commits at lists.llvm.org
Mon Mar 2 12:47:33 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Roland McGrath (frobtech)

<details>
<summary>Changes</summary>

Scudo now provides reallocarray, so declare it.


---
Full diff: https://github.com/llvm/llvm-project/pull/184223.diff


1 Files Affected:

- (modified) libc/include/stdlib-malloc.yaml (+9-5) 


``````````diff
diff --git a/libc/include/stdlib-malloc.yaml b/libc/include/stdlib-malloc.yaml
index 51c11f5602e2c..e1dab21bfc213 100644
--- a/libc/include/stdlib-malloc.yaml
+++ b/libc/include/stdlib-malloc.yaml
@@ -1,10 +1,5 @@
 # This file has declarations that appear both in <stdlib.h> and in <malloc.h>.
 # These include the subset of GNU extensions that Scudo supports.
-#
-# Note: glibc's <stdlib.h> and <malloc.h> both also have `reallocarray`,
-# which Scudo does not support and is omitted here.  (Each of those glibc
-# headers also has related functions the other lacks, but those should be
-# covered separately in stdlib.yaml and malloc.yaml instead.)
 
 functions:
   - name: aligned_alloc
@@ -47,6 +42,15 @@ functions:
     arguments:
       - type: void *
       - type: size_t
+  - name: reallocarray
+    standards:
+      - bsd
+      - gnu
+    return_type: void *
+    arguments:
+      - type: void *
+      - type: size_t
+      - type: size_t
   - name: valloc
     standards:
       - bsd

``````````

</details>


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


More information about the libc-commits mailing list