public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Saagar Jha <saagar@saagarjha.com>
To: binutils@sourceware.org
Cc: Saagar Jha <saagar@saagarjha.com>
Subject: [PATCH] Fix a warning when initializing symbol_flags
Date: Fri, 25 Sep 2020 17:42:24 -0700	[thread overview]
Message-ID: <20200926004224.35168-1-saagar@saagarjha.com> (raw)

Clang on certain platforms (such as arm64) will warn if a struct is
partially initialized:

symbols.c:199:35: error: missing field 'written' initializer [-Werror,-Wmissing-field-initializers]
2895  symbol_entry_t needle = { { { 0 }, hash, name, 0, 0, 0 } };

If we use empty braces we have the same effect but avoid the warning.

gas/ChangeLog:

	* symbols.c: Shorten an initializer for symbol_flags to be empty.
---
 gas/ChangeLog | 4 ++++
 gas/symbols.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1c692dd931..6f9e842330 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2020-09-25  Saagar Jha  <saagar@saagarjha.com>
+
+	* symbols.c: Shorten an initializer for symbol_flags to be empty.
+
 2020-09-24  Jim Wilson  <jimw@sifive.com>
 
 	PR 26400
diff --git a/gas/symbols.c b/gas/symbols.c
index d6080886be..40d7ebc586 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -196,7 +196,7 @@ static void *
 symbol_entry_find (htab_t table, const char *name)
 {
   hashval_t hash = htab_hash_string (name);
-  symbol_entry_t needle = { { { 0 }, hash, name, 0, 0, 0 } };
+  symbol_entry_t needle = { { { }, hash, name, 0, 0, 0 } };
   return htab_find_with_hash (table, &needle, hash);
 }
 
-- 
2.28.0


             reply	other threads:[~2020-09-26  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26  0:42 Saagar Jha [this message]
2020-09-26 13:06 ` Alan Modra
2020-09-26 19:21   ` Hans-Peter Nilsson
2020-09-26 22:30     ` Saagar Jha
2020-09-30  6:12       ` Alan Modra
2020-09-30  6:22         ` Saagar Jha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200926004224.35168-1-saagar@saagarjha.com \
    --to=saagar@saagarjha.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).