This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix to [-Wmissing-field-initializers] in libatomic/config/posix/lock.c:58
- From: "U.Mutlu" <um at mutluit dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Mon, 25 Jun 2018 18:00:12 +0200
- Subject: [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