This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix to [-Wmissing-field-initializers] in libatomic/config/posix/lock.c:58


When building with "... -g0 -DNDEBUG -Wall -Wextra -Wpedantic" then the following error happens:

../../../gcc_trunk/libatomic/config/posix/lock.c: At top level:
../../../gcc_trunk/libatomic/config/posix/lock.c:58:3: warning: missing initializer for field 'pad' of 'struct lock' [-Wmissing-field-initializers]
   [0 ... NLOCKS-1].mutex = PTHREAD_MUTEX_INITIALIZER
   ^


The folowing patch fixes it.
Regtested x86_64-linux.
NOT committed b/c don't have write access yet.


2018-06-25  U.Mutlu  <um@mutluit.com>

	* config/posix/lock.c: fix to [-Wmissing-field-initializers] when
	building with "... -g0 -DNDEBUG -Wall -Wextra -Wpedantic"

Index: libatomic/config/posix/lock.c
===================================================================
--- libatomic/config/posix/lock.c	(revision 261994)
+++ libatomic/config/posix/lock.c	(working copy)
@@ -55,7 +55,8 @@

 #define NLOCKS		(PAGE_SIZE / WATCH_SIZE)
 static struct lock locks[NLOCKS] = {
-  [0 ... NLOCKS-1].mutex = PTHREAD_MUTEX_INITIALIZER
+  [0 ... NLOCKS-1] = (struct lock)
+	{ .mutex = PTHREAD_MUTEX_INITIALIZER, .pad[0] = 0 }
 };

 static inline uintptr_t



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]