This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] 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
cc1: all warnings being treated as errors
make[4]: *** [reloc.lo] Error 1

	* reloc.c (bfd_default_reloc_type_lookup) <BFD_RELOC_CTOR>:
	Do not fall through to the default case.
 OK to apply?


Index: binutils/bfd/reloc.c
--- binutils.orig/bfd/reloc.c	2016-10-25 05:16:48.000000000 +0100
+++ binutils/bfd/reloc.c	2016-10-29 18:56:17.041166013 +0100
@@ -7779,6 +7779,7 @@ bfd_default_reloc_type_lookup (bfd *abfd
 	  BFD_FAIL ();
+      break;
       BFD_FAIL ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]