[libc-commits] [libc] [libc][macros] Define LIBC_CONSTINIT (PR #95316)

via libc-commits libc-commits at lists.llvm.org
Wed Jun 12 14:31:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (PiJoules)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/95316.diff


1 Files Affected:

- (modified) libc/src/__support/macros/attributes.h (+6) 


``````````diff
diff --git a/libc/src/__support/macros/attributes.h b/libc/src/__support/macros/attributes.h
index 8637e165fe3bc..73d5d777f6041 100644
--- a/libc/src/__support/macros/attributes.h
+++ b/libc/src/__support/macros/attributes.h
@@ -30,4 +30,10 @@
 #define LIBC_THREAD_LOCAL thread_local
 #endif
 
+#if __cplusplus >= 202002L
+#define LIBC_CONSTINIT constinit
+#else
+#define LIBC_CONSTINIT __attribute__((__require_constant_initialization__))
+#endif
+
 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H

``````````

</details>


https://github.com/llvm/llvm-project/pull/95316


More information about the libc-commits mailing list