This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fixes for a small number of compiler warnings
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Apr 2015 00:36:55 -0000
- Subject: [binutils-gdb] Fixes for a small number of compiler warnings
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4e791d0fb1173330424b69cfbdece9e1764186a6
commit 4e791d0fb1173330424b69cfbdece9e1764186a6
Author: Ed Schouten <ed@nuxi.nl>
Date: Tue Mar 31 16:47:10 2015 +0200
Fixes for a small number of compiler warnings
The ehdr_start_save variable does not need to be initialized. However,
not initializing it will trigger a compiler warning when using older
versions of GCC. Self-assignment unfortunately doesn't work for Clang
as Clang has a warning similar to -Winit-self as part of -Wall.
* emultempl/elf32.em (gld*_before_allocation): Zero-initialize
the ehdr_start_save variable.
Diff:
---
ld/ChangeLog | 5 +++++
ld/emultempl/elf32.em | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5d120f1..32c5f1c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-01 Ed Schouten <ed@nuxi.nl>
+
+ * emultempl/elf32.em (gld*_before_allocation): Zero-initialize
+ the ehdr_start_save variable.
+
2015-03-31 Ed Schouten <ed@nuxi.nl>
* Makefile.am (ALL_64_EMULATION_SOURCES): Add
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 618e20a..2caddbe 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1412,7 +1412,7 @@ gld${EMULATION_NAME}_before_allocation (void)
asection *sinterp;
bfd *abfd;
struct elf_link_hash_entry *ehdr_start = NULL;
- struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
+ struct bfd_link_hash_entry ehdr_start_save = {};
if (is_elf_hash_table (link_info.hash))
{