diff options
author | Fangrui Song <i@maskray.me> | 2023-02-24 14:47:55 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2023-02-24 14:47:55 -0800 |
commit | 46262cab24312c71717ca70a9d0700481aa59152 (patch) | |
tree | 8efe1f8ce9440a12e9904826376d23bd0a4d37a2 /openmp/runtime | |
parent | 1c417da0f0605e027eb02fb4108d08397b566c3b (diff) | |
download | llvm-46262cab24312c71717ca70a9d0700481aa59152.tar.gz |
[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).
Diffstat (limited to 'openmp/runtime')
-rw-r--r-- | openmp/runtime/src/kmp_global.cpp | 8 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_lock.h | 8 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_taskdeps.cpp | 2 |
3 files changed, 7 insertions, 11 deletions
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp index 7b94164f6dbb..b1eca773db1e 100644 --- a/openmp/runtime/src/kmp_global.cpp +++ b/openmp/runtime/src/kmp_global.cpp @@ -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 */ diff --git a/openmp/runtime/src/kmp_lock.h b/openmp/runtime/src/kmp_lock.h index a19f4ca323b8..f21179b4eb68 100644 --- a/openmp/runtime/src/kmp_lock.h +++ b/openmp/runtime/src/kmp_lock.h @@ -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); diff --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp index 5fcb84d0befa..ee4f96f7e5e2 100644 --- a/openmp/runtime/src/kmp_taskdeps.cpp +++ b/openmp/runtime/src/kmp_taskdeps.cpp @@ -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) { |