malloc.h: declare the allocation functions _NOTHROW #4

Merged
techwritescode merged 1 commit from malloc-nothrow into ee-v4.6.0-llvm 2026-10-12 18:33:40 +00:00

In C++ with clang, <malloc.h> and <stdlib.h> (or libc++'s <cstdlib>) declare malloc, calloc, realloc, free and their _r variants with different exception specifications, so including both fails with exception specification in declaration does not match previous declaration. stdlib.h already uses _NOTHROW; malloc.h now does too.

Checked with the clean-install toolchain headers: a C++20 file including malloc.h, stdlib.h and in either order, and a C file, compile with 0 errors. Found building RiptOPL, whose atlas.cpp includes malloc.h.

🤖 Generated with Claude Code

In C++ with clang, `<malloc.h>` and `<stdlib.h>` (or libc++'s `<cstdlib>`) declare malloc, calloc, realloc, free and their `_r` variants with different exception specifications, so including both fails with `exception specification in declaration does not match previous declaration`. `stdlib.h` already uses `_NOTHROW`; `malloc.h` now does too. Checked with the clean-install toolchain headers: a C++20 file including malloc.h, stdlib.h and <cstdlib> in either order, and a C file, compile with 0 errors. Found building RiptOPL, whose atlas.cpp includes malloc.h. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
malloc.h: declare the allocation functions _NOTHROW, as stdlib.h does
Some checks were skipped
cygwin / Fedora cross x86_64-pc-cygwin (push) Has been skipped
cygwin / Windows native x86_64 (push) Has been skipped
cygwin / stress tests x86_64 on arm64 Windows (push) Has been skipped
cygwin / stress tests x86_64 on x86_64 Windows (push) Has been skipped
cygwin / stc tests x86_64 on arm64 Windows (push) Has been skipped
cygwin / stc tests x86_64 on x86_64 Windows (push) Has been skipped
05e73c20c5
With C++ and clang, including both malloc.h and stdlib.h failed with
'exception specification in declaration does not match previous declaration'.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
techwritescode merged commit 05e73c20c5 into ee-v4.6.0-llvm 2026-10-12 18:33:40 +00:00
techwritescode deleted branch malloc-nothrow 2026-10-12 18:33:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ps2/newlib-llvm!4
No description provided.