This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] BFD: Fix double BFD_FAIL calls in `bfd_default_reloc_type_lookup'
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Nov 2016 23:01:52 -0000
- Subject: [binutils-gdb] BFD: Fix double BFD_FAIL calls in `bfd_default_reloc_type_lookup'
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=af955fe696088e69b436947b4a6f134567d31793
commit af955fe696088e69b436947b4a6f134567d31793
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Mon Oct 31 16:14:35 2016 +0000
BFD: Fix double BFD_FAIL calls in `bfd_default_reloc_type_lookup'
Break out of the outer switch statement once the inner switch for the
BFD_RELOC_CTOR relocation has been processed, preventing double BFD_FAIL
calls from being made, once from the inner switch and then again from
the default case of the outer switch.
Noticed with a `-Wimplicit-fallthrough' build error reported by a recent
GCC version:
In file included from .../bfd/reloc.c:52:0:
.../bfd/reloc.c: In function 'bfd_default_reloc_type_lookup':
.../bfd/libbfd.h:779:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
do { bfd_assert(__FILE__,__LINE__); } while (0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../bfd/reloc.c:7780:4: note: in expansion of macro 'BFD_FAIL'
BFD_FAIL ();
^~~~~~~~
.../bfd/reloc.c:7782:5: note: here
default:
^~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [reloc.lo] Error 1
bfd/
* reloc.c (bfd_default_reloc_type_lookup) <BFD_RELOC_CTOR>: Do
not fall through to the default case.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/reloc.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 75ffab5..49d490d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-01 Maciej W. Rozycki <macro@imgtec.com>
+
+ * reloc.c (bfd_default_reloc_type_lookup) <BFD_RELOC_CTOR>: Do
+ not fall through to the default case.
+
2016-11-01 Palmer Dabbelt <palmer@dabbelt.com>
Andrew Waterman <andrew@sifive.com>
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 7c67eeb..56cd79b 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -7859,6 +7859,7 @@ bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
default:
BFD_FAIL ();
}
+ break;
default:
BFD_FAIL ();
}