Skip to content

Commit 673e547

Browse files
committed
[OpenMP] Change initialization of __kmp_global
There's no need to initialize variables with static storage duration because they're implicitly initialized to zero. See https://en.cppreference.com/w/c/language/initialization#Implicit_initialization I think that's already relied upon because the supplied 0 only sets 'kmp_time_global_t g_time;' in 'struct kmp_base_global'. The other fields are not set in the code, but implicitly initialized by the compiler. Differential Revision: https://reviews.llvm.org/D66292 llvm-svn: 370943
1 parent 3a49ca3 commit 673e547

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

openmp/runtime/cmake/LibompHandleFlags.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ function(libomp_get_cxxflags cxxflags)
3030
libomp_append(flags_local -Wno-class-memaccess LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG)
3131
libomp_append(flags_local -Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
3232
libomp_append(flags_local -Wno-frame-address LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG)
33-
libomp_append(flags_local -Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
3433
libomp_append(flags_local -Wno-strict-aliasing LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG)
3534
libomp_append(flags_local -Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG)
3635
libomp_append(flags_local -Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG)

openmp/runtime/cmake/config-ix.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ check_cxx_compiler_flag(-fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG)
5151
check_cxx_compiler_flag(-Wno-class-memaccess LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG)
5252
check_cxx_compiler_flag(-Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
5353
check_cxx_compiler_flag(-Wno-frame-address LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG)
54-
check_cxx_compiler_flag(-Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
5554
check_cxx_compiler_flag(-Wno-strict-aliasing LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG)
5655
check_cxx_compiler_flag(-Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG)
5756
check_cxx_compiler_flag(-Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG)

openmp/runtime/src/kmp_global.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ std::atomic<int> __kmp_thread_pool_active_nth = ATOMIC_VAR_INIT(0);
431431
/* -------------------------------------------------
432432
* GLOBAL/ROOT STATE */
433433
KMP_ALIGN_CACHE
434-
kmp_global_t __kmp_global = {{0}};
434+
kmp_global_t __kmp_global;
435435

436436
/* ----------------------------------------------- */
437437
/* GLOBAL SYNCHRONIZATION LOCKS */

0 commit comments

Comments
 (0)