summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--osdep/atomics.h29
-rw-r--r--wscript7
2 files changed, 10 insertions, 26 deletions
diff --git a/osdep/atomics.h b/osdep/atomics.h
index c4f31286cc..bfcaa38977 100644
--- a/osdep/atomics.h
+++ b/osdep/atomics.h
@@ -28,15 +28,14 @@
// Emulate the parts of C11 stdatomic.h needed by mpv.
// Still relies on gcc/clang atomic builtins.
-// The t field is a hack to make the non-atomic fallback macro mess work.
-typedef struct { volatile unsigned long v, t; } atomic_ulong;
-typedef struct { volatile int v, t; } atomic_int;
-typedef struct { volatile unsigned int v, t; } atomic_uint;
-typedef struct { volatile _Bool v, t; } atomic_bool;
-typedef struct { volatile long long v, t; } atomic_llong;
-typedef struct { volatile uint_least32_t v, t; } atomic_uint_least32_t;
-typedef struct { volatile unsigned long long v, t; } atomic_ullong;
+typedef struct { volatile unsigned long v; } atomic_ulong;
+typedef struct { volatile int v; } atomic_int;
+typedef struct { volatile unsigned int v; } atomic_uint;
+typedef struct { volatile _Bool v; } atomic_bool;
+typedef struct { volatile long long v; } atomic_llong;
+typedef struct { volatile uint_least32_t v; } atomic_uint_least32_t;
+typedef struct { volatile unsigned long long v; } atomic_ullong;
#define ATOMIC_VAR_INIT(x) \
{.v = (x)}
@@ -82,19 +81,7 @@ typedef struct { volatile unsigned long long v, t; } atomic_ullong;
ok_; })
#else
-
-// This is extremely wrong. The build system actually disables code that has
-// a serious dependency on working atomics, so this is barely ok.
-#define atomic_load(p) ((p)->v)
-#define atomic_store(p, val) ((p)->v = (val))
-#define atomic_fetch_op_(a, b, op) \
- ((a)->t = (a)->v, (a)->v = (a)->v op (b), (a)->t)
-#define atomic_fetch_add(a, b) atomic_fetch_op_(a, b, +)
-#define atomic_fetch_and(a, b) atomic_fetch_op_(a, b, &)
-#define atomic_fetch_or(a, b) atomic_fetch_op_(a, b, |)
-#define atomic_compare_exchange_strong(p, old, new) \
- ((p)->v == *(old) ? ((p)->v = (new), 1) : (*(old) = (p)->v, 0))
-
+# error "this should have been a configuration error, report a bug please"
#endif /* no atomics */
#endif /* else HAVE_STDATOMIC */
diff --git a/wscript b/wscript
index 309efd3bb2..a18df6f581 100644
--- a/wscript
+++ b/wscript
@@ -175,6 +175,7 @@ main_dependencies = [
'name': 'atomics',
'desc': 'compiler support for usable thread synchronization built-ins',
'func': check_true,
+ 'req': True,
'deps_any': ['stdatomic', 'atomic-builtins', 'sync-builtins'],
}, {
'name': 'c11-tls',
@@ -517,13 +518,11 @@ audio_output_features = [
{
'name': '--sdl2',
'desc': 'SDL2',
- 'deps': ['atomics'],
'func': check_pkg_config('sdl2'),
'default': 'disable'
}, {
'name': '--sdl1',
'desc': 'SDL (1.x)',
- 'deps': ['atomics'],
'deps_neg': [ 'sdl2' ],
'func': check_pkg_config('sdl'),
'default': 'disable'
@@ -574,7 +573,6 @@ audio_output_features = [
}, {
'name': '--jack',
'desc': 'JACK audio output',
- 'deps': ['atomics'],
'func': check_pkg_config('jack'),
}, {
'name': '--openal',
@@ -592,14 +590,13 @@ audio_output_features = [
}, {
'name': '--coreaudio',
'desc': 'CoreAudio audio output',
- 'deps': ['atomics'],
'func': check_cc(
fragment=load_fragment('coreaudio.c'),
framework_name=['CoreFoundation', 'CoreAudio', 'AudioUnit', 'AudioToolbox'])
}, {
'name': '--wasapi',
'desc': 'WASAPI audio output',
- 'deps': ['win32', 'atomics'],
+ 'deps': ['win32'],
'func': check_cc(fragment=load_fragment('wasapi.c')),
}
]