git: e17fddce8978 - main - libc: Reorganise memory_order enumeration constants
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 20 Jun 2026 00:24:53 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=e17fddce8978efbc70fc473425bad59b111f4b16
commit e17fddce8978efbc70fc473425bad59b111f4b16
Author: Faraz Vahedi <kfv@kfv.io>
AuthorDate: 2026-05-01 17:49:27 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-06-20 00:23:28 +0000
libc: Reorganise memory_order enumeration constants
Place the `memory_order` enumeration constants alongside the corresponding
typedef under the ยง7.17.3 heading.
The previous layout separated the fallback constant definitions from the
enum, which could obscure their relationship. These fallbacks exist only
to provide values when the compiler does not supply the builtins.
The removed comment encoded implementation-specific assumptions about
compiler-provided definitions and implied a relationship between Clang/GCC
macros and fallback values. In practice, the fallback definitions exist
solely to ensure the enumerators are defined when compiler intrinsics are
absent, and do not depend on any particular numeric mapping.
No functional change; this is a mere structural and clarity improvement.
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2185
---
sys/sys/stdatomic.h | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/sys/sys/stdatomic.h b/sys/sys/stdatomic.h
index e6eb46cd6ef3..135001a1f82e 100644
--- a/sys/sys/stdatomic.h
+++ b/sys/sys/stdatomic.h
@@ -101,9 +101,10 @@
#endif
/*
- * Clang and recent GCC both provide predefined macros for the memory
- * orderings. If we are using a compiler that doesn't define them, use the
- * clang values - these will be ignored in the fallback path.
+ * 7.17.3 Order and consistency.
+ *
+ * The memory_order_* constants that denote the barrier behaviour of the
+ * atomic operations.
*/
#ifndef __ATOMIC_RELAXED
@@ -125,13 +126,6 @@
#define __ATOMIC_SEQ_CST 5
#endif
-/*
- * 7.17.3 Order and consistency.
- *
- * The memory_order_* constants that denote the barrier behaviour of the
- * atomic operations.
- */
-
typedef enum {
memory_order_relaxed = __ATOMIC_RELAXED,
memory_order_consume = __ATOMIC_CONSUME,