[OpenMP] Remove uses of ATOMIC_VAR_INIT

ATOMIC_VAR_INIT has a trivial definition
`#define ATOMIC_VAR_INIT(value) (value)`,
is deprecated in C17/C++20, and will be removed in newer standards in
newer GCC/Clang (e.g. https://reviews.llvm.org/D144196).
This commit is contained in:
Fangrui Song 2023-02-24 14:47:55 -08:00
parent 1c417da0f0
commit 46262cab24
3 changed files with 7 additions and 11 deletions

View File

@ -63,8 +63,8 @@ int __kmp_init_counter = 0;
int __kmp_root_counter = 0;
int __kmp_version = 0;
std::atomic<kmp_int32> __kmp_team_counter = ATOMIC_VAR_INIT(0);
std::atomic<kmp_int32> __kmp_task_counter = ATOMIC_VAR_INIT(0);
std::atomic<kmp_int32> __kmp_team_counter = 0;
std::atomic<kmp_int32> __kmp_task_counter = 0;
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
#if KMP_USE_MONITOR
@ -386,7 +386,7 @@ int __kmp_debug_buf_atomic =
char *__kmp_debug_buffer = NULL; /* Debug buffer itself */
std::atomic<int> __kmp_debug_count =
ATOMIC_VAR_INIT(0); /* number of lines printed in buffer so far */
0; /* number of lines printed in buffer so far */
int __kmp_debug_buf_warn_chars =
0; /* Keep track of char increase recommended in warnings */
/* end rotating debug buffer */
@ -454,7 +454,7 @@ volatile kmp_info_t *__kmp_thread_pool = NULL;
volatile kmp_team_t *__kmp_team_pool = NULL;
KMP_ALIGN_CACHE
std::atomic<int> __kmp_thread_pool_active_nth = ATOMIC_VAR_INIT(0);
std::atomic<int> __kmp_thread_pool_active_nth = 0;
/* -------------------------------------------------
* GLOBAL/ROOT STATE */

View File

@ -138,7 +138,7 @@ typedef union kmp_tas_lock kmp_tas_lock_t;
// kmp_tas_lock_t xlock = KMP_TAS_LOCK_INITIALIZER( xlock );
#define KMP_TAS_LOCK_INITIALIZER(lock) \
{ \
{ ATOMIC_VAR_INIT(KMP_LOCK_FREE(tas)), 0 } \
{ KMP_LOCK_FREE(tas), 0 } \
}
extern int __kmp_acquire_tas_lock(kmp_tas_lock_t *lck, kmp_int32 gtid);
@ -276,11 +276,7 @@ typedef union kmp_ticket_lock kmp_ticket_lock_t;
// Note the macro argument. It is important to make var properly initialized.
#define KMP_TICKET_LOCK_INITIALIZER(lock) \
{ \
{ \
ATOMIC_VAR_INIT(true) \
, &(lock), NULL, ATOMIC_VAR_INIT(0U), ATOMIC_VAR_INIT(0U), \
ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(-1) \
} \
{ true, &(lock), NULL, 0U, 0U, 0, -1 } \
}
extern int __kmp_acquire_ticket_lock(kmp_ticket_lock_t *lck, kmp_int32 gtid);

View File

@ -30,7 +30,7 @@
// TODO: Any ITT support needed?
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
static std::atomic<kmp_int32> kmp_node_id_seed = ATOMIC_VAR_INIT(0);
static std::atomic<kmp_int32> kmp_node_id_seed = 0;
#endif
static void __kmp_init_node(kmp_depnode_t *node) {