summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2011-04-26 10:30:05 +0100
committerPádraig Brady <P@draigBrady.com>2011-05-08 17:38:37 +0100
commit73fd918bd0f4417bb800bd569af69fb07ec65e72 (patch)
treecf0055d5c744d198930f80805ad74761266d9bd7
parent3c8ff029d4475eb79f69c98420f93e93a42a25dc (diff)
downloadcoreutils-73fd918bd0f4417bb800bd569af69fb07ec65e72.tar.xz
maint: remove -Wmissing-field-initializers workarounds
* configure.ac: Rather than disabling -Wmissing-field-initializers, use the fact that gnulib now disables it automatically when required (on versions of GCC older than 4.7). * src/system.h: Remove the no longer needed DECLARE_ZEROED_AGGREGATE. * src/ls.c: Likewise. * src/pathchk.c: Likewise. * src/shred.c: Likewise. * src/stty.c: Likewise. * src/wc.c: Likewise.
-rw-r--r--configure.ac1
-rw-r--r--src/ls.c2
-rw-r--r--src/pathchk.c2
-rw-r--r--src/shred.c2
-rw-r--r--src/stty.c4
-rw-r--r--src/system.h13
-rw-r--r--src/wc.c2
7 files changed, 6 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 6407bea9f..c8bd9e3b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,6 @@ if test "$gl_gcc_warnings" = yes; then
for w in $ws; do
gl_WARN_ADD([$w])
done
- gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
diff --git a/src/ls.c b/src/ls.c
index a7ea8c2cb..4262923ce 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3891,7 +3891,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options,
reach its end, replacing each non-printable multibyte
character with a single question mark. */
{
- DECLARE_ZEROED_AGGREGATE (mbstate_t, mbstate);
+ mbstate_t mbstate = { 0, };
do
{
wchar_t wc;
diff --git a/src/pathchk.c b/src/pathchk.c
index f0f99dd1a..7f4e5dfcf 100644
--- a/src/pathchk.c
+++ b/src/pathchk.c
@@ -196,7 +196,7 @@ portable_chars_only (char const *file, size_t filelen)
if (*invalid)
{
- DECLARE_ZEROED_AGGREGATE (mbstate_t, mbstate);
+ mbstate_t mbstate = { 0, };
size_t charlen = mbrlen (invalid, filelen - validlen, &mbstate);
error (0, 0,
_("nonportable character %s in file name %s"),
diff --git a/src/shred.c b/src/shred.c
index 10425a31d..27747919f 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -1098,7 +1098,7 @@ int
main (int argc, char **argv)
{
bool ok = true;
- DECLARE_ZEROED_AGGREGATE (struct Options, flags);
+ struct Options flags = { 0, };
char **file;
int n_files;
int c;
diff --git a/src/stty.c b/src/stty.c
index 674a19afd..6d54eced2 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -730,7 +730,7 @@ main (int argc, char **argv)
{
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
- DECLARE_ZEROED_AGGREGATE (struct termios, mode);
+ struct termios mode = { 0, };
enum output_type output_type;
int optc;
@@ -1003,7 +1003,7 @@ main (int argc, char **argv)
{
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
- DECLARE_ZEROED_AGGREGATE (struct termios, new_mode);
+ struct termios new_mode = { 0, };
if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode))
error (EXIT_FAILURE, errno, "%s", device_name);
diff --git a/src/system.h b/src/system.h
index 1c351bd1b..2e8e17720 100644
--- a/src/system.h
+++ b/src/system.h
@@ -467,19 +467,6 @@ enum
# define IF_LINT(Code) /* empty */
#endif
-/* With -Dlint, avoid warnings from gcc about code like mbstate_t m = {0,};
- by wasting space on a static variable of the same type, that is thus
- guaranteed to be initialized to 0, and use that on the RHS. */
-#define DZA_CONCAT0(x,y) x ## y
-#define DZA_CONCAT(x,y) DZA_CONCAT0 (x, y)
-#ifdef lint
-# define DECLARE_ZEROED_AGGREGATE(Type, Var) \
- static Type DZA_CONCAT (s0_, __LINE__); Type Var = DZA_CONCAT (s0_, __LINE__)
-#else
-# define DECLARE_ZEROED_AGGREGATE(Type, Var) \
- Type Var = { 0, }
-#endif
-
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x) /* empty */
diff --git a/src/wc.c b/src/wc.c
index 039921470..702a7a779 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -285,7 +285,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
{
bool in_word = false;
uintmax_t linepos = 0;
- DECLARE_ZEROED_AGGREGATE (mbstate_t, state);
+ mbstate_t state = { 0, };
bool in_shift = false;
# if SUPPORT_OLD_MBRTOWC
/* Back-up the state before each multibyte character conversion and