[libc-commits] [libc] [libc] Add noexcept to aligned_alloc declaration in full-build mode (PR #191236)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Thu Apr 9 09:13:01 PDT 2026
https://github.com/kaladron created https://github.com/llvm/llvm-project/pull/191236
The extern "C" declaration of aligned_alloc in the proxy header lacked a noexcept specifier, producing warnings when compiled as C++. Added a __cplusplus guard so C++ gets noexcept while C compilation remains unaffected.
>From 0d3e7f186c33103e7dace3b016f02880666e99e1 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Thu, 9 Apr 2026 16:39:22 +0100
Subject: [PATCH] [libc] Add noexcept to aligned_alloc declaration in
full-build mode
The extern "C" declaration of aligned_alloc in the proxy header
lacked a noexcept specifier, producing warnings when compiled as
C++. Added a __cplusplus guard so C++ gets noexcept while C
compilation remains unaffected.
---
libc/hdr/func/aligned_alloc.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libc/hdr/func/aligned_alloc.h b/libc/hdr/func/aligned_alloc.h
index b3436dfee1f23..3c197f4671a76 100644
--- a/libc/hdr/func/aligned_alloc.h
+++ b/libc/hdr/func/aligned_alloc.h
@@ -11,7 +11,11 @@
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
+#ifdef __cplusplus
+extern "C" void *aligned_alloc(size_t, size_t) noexcept;
+#else
extern "C" void *aligned_alloc(size_t, size_t);
+#endif
#else // Overlay mode
More information about the libc-commits
mailing list