[Openmp-dev] suggest braces around initialization of subobject

Jack Howarth howarth.mailing.lists at gmail.com
Sat Jun 6 08:23:24 PDT 2015


Jonathan,
      We have one instance of the warning...

/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_global.c:374:32:
warning: suggest braces around initialization of subobject
      [-Wmissing-braces]
kmp_global_t __kmp_global = {{ 0 }};
                               ^
                               {}

in the build of openmp under the clang compilers. This can be silenced
with the attached patch.
            Jack
ps We also have some warnings about missing field initializer in this file...

/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_global.c:24:37:
warning: missing field 'signature' initializer
      [-Wmissing-field-initializers]
kmp_cpuinfo_t   __kmp_cpuinfo = { 0 }; // Not initialized
                                    ^
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_global.c:374:34:
warning: missing field 'g_abort' initializer
      [-Wmissing-field-initializers]
kmp_global_t __kmp_global = {{ 0 }};
                                 ^
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_global.c:404:43:
warning: missing field 'flags' initializer
      [-Wmissing-field-initializers]
kmp_bootstrap_lock_t __kmp_initz_lock   =
KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock   ); /* Control
initializations */
                                          ^
but these seem to be unsolvable...

http://clang-developers.42468.n3.nabble.com/Wmissing-field-initializers-td3761260.html

short of converting runtime/src/kmp_global.c into
runtime/src/kmp_global.cpp so that it is compiled with the c++
compiler instead.
-------------- next part --------------
Index: runtime/src/kmp_global.c
===================================================================
--- runtime/src/kmp_global.c	(revision 239219)
+++ runtime/src/kmp_global.c	(working copy)
@@ -371,7 +371,7 @@ volatile int          __kmp_thread_pool_
 /* -------------------------------------------------
  * GLOBAL/ROOT STATE */
 KMP_ALIGN_CACHE
-kmp_global_t __kmp_global = {{ 0 }};
+kmp_global_t __kmp_global = {{{ 0 }}};
 
 /* ----------------------------------------------- */
 /* GLOBAL SYNCHRONIZATION LOCKS */


More information about the Openmp-dev mailing list