Browse Source

remove deprecated ATOMIC_VAR_INIT() usage

It's deprecated in C17 [1]. Atomic initializers don't need this macro.

Even with std=gnu11, clang 14+ would issue a warning it's deprecated.

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_485
pull/162/head
Steve Lhomme 2 years ago
parent
commit
9f113f8e61
  1. 2
      include/vlc_atomic.h
  2. 8
      include/vlc_threads.h
  3. 2
      modules/codec/shine.c
  4. 2
      modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
  5. 2
      modules/keystore/secret.c
  6. 2
      src/config/core.c
  7. 2
      src/misc/cpu.c
  8. 2
      src/misc/threads.h

2
include/vlc_atomic.h

@ -41,7 +41,7 @@ using std::memory_order_acq_rel;
#include <time.h> /* vlc_atomic_timedwait_daytime */
#define VLC_STATIC_RC { \
.refs = ATOMIC_VAR_INIT(0) \
.refs = 0 \
}
typedef struct vlc_atomic_rc_t {

8
include/vlc_threads.h

@ -163,9 +163,9 @@ typedef struct
* In C++, consider using a global ::vlc::threads::mutex instance instead.
*/
#define VLC_STATIC_MUTEX { \
.value = ATOMIC_VAR_INIT(0), \
.recursion = ATOMIC_VAR_INIT(0), \
.owner = ATOMIC_VAR_INIT(0), \
.value = 0, \
.recursion = 0, \
.owner = 0, \
}
/**
@ -527,7 +527,7 @@ typedef struct
/**
* Static initializer for one-time initialization.
*/
#define VLC_STATIC_ONCE { ATOMIC_VAR_INIT(0) }
#define VLC_STATIC_ONCE { 0 }
/**
* Begins a one-time initialization.

2
modules/codec/shine.c

@ -67,7 +67,7 @@ vlc_module_begin()
set_callback( OpenEncoder )
vlc_module_end()
static atomic_bool busy = ATOMIC_VAR_INIT(false);
static atomic_bool busy = false;
static int OpenEncoder( vlc_object_t *p_this )
{

2
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m

@ -151,7 +151,7 @@ static void WindowUnsetFullscreen(vlc_window_t *wnd)
WindowSetFullscreen(wnd, &windowed);
}
static atomic_bool b_intf_starting = ATOMIC_VAR_INIT(false);
static atomic_bool b_intf_starting = false;
static const struct vlc_window_operations ops = {
WindowEnable,

2
modules/keystore/secret.c

@ -300,7 +300,7 @@ check_service_running(void)
/* Cache the return of this function that may take up to 200ms. This atomic
* doesn't prevent a cache miss (unlikely). This function can be called
* safely from any threads. */
static atomic_int cache_running = ATOMIC_VAR_INIT(0);
static atomic_int cache_running = 0;
int running = atomic_load_explicit(&cache_running, memory_order_relaxed);
if (running != 0)
return running == 1 ? VLC_SUCCESS : VLC_EGENERIC;

2
src/config/core.c

@ -41,7 +41,7 @@
#include "misc/rcu.h"
static vlc_mutex_t config_lock = VLC_STATIC_MUTEX;
static atomic_bool config_dirty = ATOMIC_VAR_INIT(false);
static atomic_bool config_dirty = false;
void config_Lock(void)
{

2
src/misc/cpu.c

@ -146,7 +146,7 @@ out:
unsigned vlc_CPU(void)
{
static atomic_uint cpu_flags = ATOMIC_VAR_INIT(-1U);
static atomic_uint cpu_flags = -1U;
unsigned flags = atomic_load_explicit(&cpu_flags, memory_order_relaxed);
if (unlikely(flags == -1U)) {

2
src/misc/threads.h

@ -51,7 +51,7 @@ typedef struct {
atomic_ulong owner;
} vlc_queuedmutex_t;
#define VLC_STATIC_QUEUEDMUTEX { ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(0) }
#define VLC_STATIC_QUEUEDMUTEX { 0, 0, 0 }
void vlc_queuedmutex_init(vlc_queuedmutex_t *m);

Loading…
Cancel
Save