[libc-commits] [libc] [libc] Mark all __llvm_libc_errno definitions as noexcept (PR #98762)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Sat Jul 13 11:37:47 PDT 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/98762

The definitions must match the previous declaration in errno.h.

>From 20f985bfa62f47c1d04ccf04852c07c3c3c5ad71 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Sat, 13 Jul 2024 11:36:48 -0700
Subject: [PATCH] [libc] Mark all __llvm_libc_errno definitions as noexcept

The definitions must match the previous declaration in errno.h.
---
 libc/src/errno/libc_errno.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index 7b28a62c786b..7a17a5a8217c 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -57,7 +57,7 @@ namespace {
 LIBC_THREAD_LOCAL int thread_errno;
 }
 
-extern "C" int *__llvm_libc_errno() { return &thread_errno; }
+extern "C" int *__llvm_libc_errno() noexcept { return &thread_errno; }
 
 void Errno::operator=(int a) { thread_errno = a; }
 Errno::operator int() { return thread_errno; }
@@ -68,7 +68,7 @@ namespace {
 int shared_errno;
 }
 
-extern "C" int *__llvm_libc_errno() { return &shared_errno; }
+extern "C" int *__llvm_libc_errno() noexcept { return &shared_errno; }
 
 void Errno::operator=(int a) { shared_errno = a; }
 Errno::operator int() { return shared_errno; }



More information about the libc-commits mailing list