Skip to content

atomic: do not use ATOMIC_VAR_INIT anymore

Steve Lhomme requested to merge robUx4/vlc:no-atomic_var_init into master

It's been deprecated in C17, in C++20 and Clang 14 issues a deprecated warning now.

In the end no compiler really made any particular thing with this call, so let's not pretend there's some magic happening.

See http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1138r0.pdf


v2 completely reworked the patchset:

  • assume static initializers do their job of initializing variables properly which ATOMIC_VAR_INIT may not do

the default (zero) initialization for objects with static or thread-local storage duration is guaranteed to produce a valid state.

  • use vlc_once() some vlc_list initialization when in static structures
  • use vlc_once() to init the CPU flags (instead of using ATOMIC_VAR_INIT(-1))
  • (most) patches make a reference to the C11 spec and DR485 with some explanation
  • rebased (since everything changed anyway)
Edited by Steve Lhomme

Merge request reports