[libc-commits] [libc] a4e87da - [libc] Make headers compatible with C++ < 11 (#123260)

via libc-commits libc-commits at lists.llvm.org
Thu Jan 16 19:21:43 PST 2025


Author: Roland McGrath
Date: 2025-01-16T19:21:40-08:00
New Revision: a4e87da963a67aed33b672582406d576553b2399

URL: https://github.com/llvm/llvm-project/commit/a4e87da963a67aed33b672582406d576553b2399
DIFF: https://github.com/llvm/llvm-project/commit/a4e87da963a67aed33b672582406d576553b2399.diff

LOG: [libc] Make headers compatible with C++ < 11 (#123260)

C++11 introduced `noexcept`, but `throw()` can be used in older
versions of the language.

Added: 
    

Modified: 
    libc/include/__llvm-libc-common.h

Removed: 
    


################################################################################
diff  --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h
index c63eb134a5e5d7..b5a23c5765f4d8 100644
--- a/libc/include/__llvm-libc-common.h
+++ b/libc/include/__llvm-libc-common.h
@@ -39,7 +39,11 @@
 #define _Thread_local thread_local
 
 #undef __NOEXCEPT
+#if __cplusplus >= 201103L
 #define __NOEXCEPT noexcept
+#else
+#define __NOEXCEPT throw()
+#endif
 
 #else // not __cplusplus
 


        


More information about the libc-commits mailing list