[libc-commits] [libc] 2b0fde2 - [libc] Add noexcept to aligned_alloc declaration in full-build mode (#191236)
via libc-commits
libc-commits at lists.llvm.org
Thu Apr 30 09:58:59 PDT 2026
Author: Jeff Bailey
Date: 2026-04-30T17:58:54+01:00
New Revision: 2b0fde280913b42f49962450f8dcef7d26bcdadc
URL: https://github.com/llvm/llvm-project/commit/2b0fde280913b42f49962450f8dcef7d26bcdadc
DIFF: https://github.com/llvm/llvm-project/commit/2b0fde280913b42f49962450f8dcef7d26bcdadc.diff
LOG: [libc] Add noexcept to aligned_alloc declaration in full-build mode (#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.
Added:
Modified:
libc/hdr/func/aligned_alloc.h
libc/hdr/func/free.h
libc/hdr/func/malloc.h
libc/hdr/func/realloc.h
Removed:
################################################################################
diff --git a/libc/hdr/func/aligned_alloc.h b/libc/hdr/func/aligned_alloc.h
index b3436dfee1f23..6a877cece9089 100644
--- a/libc/hdr/func/aligned_alloc.h
+++ b/libc/hdr/func/aligned_alloc.h
@@ -10,8 +10,13 @@
#define LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H
#ifdef LIBC_FULL_BUILD
+
#include "hdr/types/size_t.h"
-extern "C" void *aligned_alloc(size_t, size_t);
+#include "include/__llvm-libc-common.h"
+
+__BEGIN_C_DECLS
+void *aligned_alloc(size_t, size_t) __NOEXCEPT;
+__END_C_DECLS
#else // Overlay mode
diff --git a/libc/hdr/func/free.h b/libc/hdr/func/free.h
index 316556b21e3b0..20e85c85d80a8 100644
--- a/libc/hdr/func/free.h
+++ b/libc/hdr/func/free.h
@@ -11,7 +11,11 @@
#ifdef LIBC_FULL_BUILD
-extern "C" void free(void *) noexcept;
+#include "include/__llvm-libc-common.h"
+
+__BEGIN_C_DECLS
+void free(void *) __NOEXCEPT;
+__END_C_DECLS
#else // Overlay mode
diff --git a/libc/hdr/func/malloc.h b/libc/hdr/func/malloc.h
index 8281021f79969..49c349f241e3d 100644
--- a/libc/hdr/func/malloc.h
+++ b/libc/hdr/func/malloc.h
@@ -12,8 +12,11 @@
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
+#include "include/__llvm-libc-common.h"
-extern "C" void *malloc(size_t) noexcept;
+__BEGIN_C_DECLS
+void *malloc(size_t) __NOEXCEPT;
+__END_C_DECLS
#else // Overlay mode
diff --git a/libc/hdr/func/realloc.h b/libc/hdr/func/realloc.h
index ecb29541fe34a..1712a73a3995b 100644
--- a/libc/hdr/func/realloc.h
+++ b/libc/hdr/func/realloc.h
@@ -12,8 +12,11 @@
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
+#include "include/__llvm-libc-common.h"
-extern "C" void *realloc(void *ptr, size_t new_size) noexcept;
+__BEGIN_C_DECLS
+void *realloc(void *ptr, size_t new_size) __NOEXCEPT;
+__END_C_DECLS
#else // Overlay mode
More information about the libc-commits
mailing list