aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaraz Vahedi <kfv@kfv.io>2026-05-01 17:49:27 +0000
committerWarner Losh <imp@FreeBSD.org>2026-06-20 00:23:28 +0000
commite17fddce8978efbc70fc473425bad59b111f4b16 (patch)
treef9f01ef1ee09747e3925a3be8a2612c9360200a0
parent9d87c1aac4a84ac5e82acf872f645a7202977204 (diff)
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
-rw-r--r--sys/sys/stdatomic.h14
1 files 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,