This is the mail archive of the binutils@sourceware.org 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] fix bunch of fall throughs for gcc-7


Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
---
 binutils/cxxfilt.c |  2 ++
 binutils/elfcomm.c | 14 ++++++++++++--
 binutils/elfedit.c |  2 ++
 binutils/nm.c      |  2 ++
 binutils/objcopy.c |  4 +++-
 binutils/readelf.c | 12 ++++++++----
 binutils/strings.c |  2 +-
 gprof/gprof.c      |  2 ++
 ld/lexsup.c        |  2 ++
 ld/plugin.c        |  1 +
 10 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/binutils/cxxfilt.c b/binutils/cxxfilt.c
index 5a3b334..78da3e9 100644
--- a/binutils/cxxfilt.c
+++ b/binutils/cxxfilt.c
@@ -29,6 +29,8 @@
 #include "safe-ctype.h"
 #include "bucomm.h"
 
+static void usage (FILE *, int) ATTRIBUTE_NORETURN;
+
 static int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE;
 static int strip_underscore = TARGET_PREPENDS_UNDERSCORE;
 
diff --git a/binutils/elfcomm.c b/binutils/elfcomm.c
index b17627a..5b1a85a 100644
--- a/binutils/elfcomm.c
+++ b/binutils/elfcomm.c
@@ -166,6 +166,7 @@ byte_get_little_endian (unsigned char *field, int size)
 	  |    (((unsigned long) (field[2])) << 16)
 	  |    (((unsigned long) (field[3])) << 24);
 
+      /* Fall through.  */
     case 6:
       if (sizeof (elf_vma) == 8)
 	return  ((elf_vma) (field[0]))
@@ -183,6 +184,7 @@ byte_get_little_endian (unsigned char *field, int size)
 	  |    (((unsigned long) (field[2])) << 16)
 	  |    (((unsigned long) (field[3])) << 24);
 
+      /* Fall through.  */
     case 7:
       if (sizeof (elf_vma) == 8)
 	return  ((elf_vma) (field[0]))
@@ -201,6 +203,7 @@ byte_get_little_endian (unsigned char *field, int size)
 	  |    (((unsigned long) (field[2])) << 16)
 	  |    (((unsigned long) (field[3])) << 24);
 
+      /* Fall through.  */
     case 8:
       if (sizeof (elf_vma) == 8)
 	return  ((elf_vma) (field[0]))
@@ -220,8 +223,10 @@ byte_get_little_endian (unsigned char *field, int size)
 	  |    (((unsigned long) (field[2])) << 16)
 	  |    (((unsigned long) (field[3])) << 24);
 
+      /* Fall through.  */
     default:
-      error (_("Unhandled data length: %d\n"), size);
+      error (_("Unhandled data length: %d, elf_vma size %zd\n"),
+             size, sizeof(elf_vma));
       abort ();
     }
 }
@@ -266,6 +271,7 @@ byte_get_big_endian (unsigned char *field, int size)
 	    |   (((unsigned long) (field[0])) << 24);
 	}
 
+      /* Fall through.  */
     case 6:
       if (sizeof (elf_vma) == 8)
 	return ((elf_vma) (field[5]))
@@ -285,6 +291,7 @@ byte_get_big_endian (unsigned char *field, int size)
 	    |   (((unsigned long) (field[0])) << 24);
 	}
 
+      /* Fall through.  */
     case 7:
       if (sizeof (elf_vma) == 8)
 	return ((elf_vma) (field[6]))
@@ -305,6 +312,7 @@ byte_get_big_endian (unsigned char *field, int size)
 	    |   (((unsigned long) (field[0])) << 24);
 	}
 
+      /* Fall through.  */
     case 8:
       if (sizeof (elf_vma) == 8)
 	return ((elf_vma) (field[7]))
@@ -326,8 +334,10 @@ byte_get_big_endian (unsigned char *field, int size)
 	    |   (((unsigned long) (field[0])) << 24);
 	}
 
+      /* Fall through.  */
     default:
-      error (_("Unhandled data length: %d\n"), size);
+      error (_("Unhandled data length: %d, elf_vma size %zd\n"),
+             size, sizeof(elf_vma));
       abort ();
     }
 }
diff --git a/binutils/elfedit.c b/binutils/elfedit.c
index 1223b25..1f605a6 100644
--- a/binutils/elfedit.c
+++ b/binutils/elfedit.c
@@ -65,6 +65,8 @@ enum elfclass
 static enum elfclass input_elf_class = ELF_CLASS_UNKNOWN;
 static enum elfclass output_elf_class = ELF_CLASS_BOTH;
 
+static void usage (FILE *, int) ATTRIBUTE_NORETURN;
+
 /* Return ELF class for a machine type, MACH.  */
 
 static enum elfclass
diff --git a/binutils/nm.c b/binutils/nm.c
index 5ca4d34..fdf812f 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -92,6 +92,8 @@ static void print_value (bfd *, bfd_vma);
 static void print_symbol_info_bsd (struct extended_symbol_info *, bfd *);
 static void print_symbol_info_sysv (struct extended_symbol_info *, bfd *);
 static void print_symbol_info_posix (struct extended_symbol_info *, bfd *);
+static void usage (FILE *, int) ATTRIBUTE_NORETURN;
+
 
 /* Support for different output formats.  */
 struct output_fns
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 4bb625a..c682133 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -508,6 +508,8 @@ static void mark_symbols_used_in_relocations (bfd *, asection *, void *);
 static bfd_boolean write_debugging_info (bfd *, void *, long *, asymbol ***);
 static const char *lookup_sym_redefinition (const char *);
 static const char *find_section_rename (const char *, flagword *);
+static void strip_usage (FILE *, int) ATTRIBUTE_NORETURN;
+static void copy_usage (FILE *, int)  ATTRIBUTE_NORETURN;
 
 static void
 copy_usage (FILE *stream, int exit_status)
@@ -4233,7 +4235,7 @@ copy_main (int argc, char *argv[])
 	      {
 	      case OPTION_CHANGE_SECTION_ADDRESS:
 		p->vma_val = val;
-		/* Drop through.  */
+		/* fall through.  */
 
 	      case OPTION_CHANGE_SECTION_LMA:
 		p->lma_val = val;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 274ddd1..7df5c6a 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -426,7 +426,7 @@ print_vma (bfd_vma vma, print_mode mode)
     {
     case FULL_HEX:
       nc = printf ("0x");
-      /* Drop through.  */
+      /* Fall through.  */
 
     case LONG_HEX:
 #ifdef BFD64
@@ -439,11 +439,11 @@ print_vma (bfd_vma vma, print_mode mode)
     case DEC_5:
       if (vma <= 99999)
 	return printf ("%5" BFD_VMA_FMT "d", vma);
-      /* Drop through.  */
+      /* Fall through.  */
 
     case PREFIX_HEX:
       nc = printf ("0x");
-      /* Drop through.  */
+      /* Fall through.  */
 
     case HEX:
       return nc + printf ("%" BFD_VMA_FMT "x", vma);
@@ -1292,6 +1292,7 @@ dump_relocations (FILE * file,
 	      rtype = elf_msp430x_reloc_type (type);
 	      break;
 	    }
+	  /* fall through */
 	case EM_MSP430_OLD:
 	  rtype = elf_msp430_reloc_type (type);
 	  break;
@@ -4447,7 +4448,7 @@ parse_args (int argc, char ** argv)
 	default:
 	  /* xgettext:c-format */
 	  error (_("Invalid option '-%c'\n"), c);
-	  /* Drop through.  */
+	  /* fall through.  */
 	case '?':
 	  usage (stderr);
 	}
@@ -9555,6 +9556,7 @@ process_dynamic_section (FILE * file)
 	case DT_SYMENT	:
 	case DT_RELENT	:
 	  dynamic_info[entry->d_tag] = entry->d_un.d_val;
+          /* Fall through  */
 	case DT_PLTPADSZ:
 	case DT_MOVEENT	:
 	case DT_MOVESZ	:
@@ -11360,6 +11362,7 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc,
 	  case 10: /* R_MSP430_SYM_DIFF */
 	    if (uses_msp430x_relocs ())
 	      break;
+	    /* fall through */
 	  case 21: /* R_MSP430X_SYM_DIFF */
 	    saved_sym = symtab + get_reloc_symindex (reloc->r_info);
 	    return TRUE;
@@ -11877,6 +11880,7 @@ is_16bit_abs_reloc (unsigned int reloc_type)
     case EM_MSP430:
       if (uses_msp430x_relocs ())
 	return reloc_type == 2; /* R_MSP430_ABS16.  */
+      /* fall through */
     case EM_MSP430_OLD:
       return reloc_type == 5; /* R_MSP430_16_BYTE.  */
     case EM_NDS32:
diff --git a/binutils/strings.c b/binutils/strings.c
index bc49bec..561dcd9 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -150,7 +150,7 @@ static void strings_a_section (bfd *, asection *, void *);
 static bfd_boolean strings_object_file (const char *);
 static bfd_boolean strings_file (char *);
 static void print_strings (const char *, FILE *, file_ptr, int, int, char *);
-static void usage (FILE *, int);
+static void usage (FILE *, int) __attribute__ ((noreturn));
 static long get_char (FILE *, file_ptr *, int *, char **);
 
 int main (int, char **);
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 4df99751..2bbb59e 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -259,11 +259,13 @@ main (int argc, char **argv)
 	  break;
 	case 'E':
 	  sym_id_add (optarg, EXCL_TIME);
+	  break;
 	case 'e':
 	  sym_id_add (optarg, EXCL_GRAPH);
 	  break;
 	case 'F':
 	  sym_id_add (optarg, INCL_TIME);
+	  break;
 	case 'f':
 	  sym_id_add (optarg, INCL_GRAPH);
 	  break;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 6d28e91..ae591ddb 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -705,6 +705,7 @@ parse_args (unsigned argc, char **argv)
 
 	default:
 	  einfo (_("%P%F: use the --help option for usage information\n"));
+	  break;
 
 	case 1:			/* File name.  */
 	  lang_add_input_file (optarg, lang_input_file_is_file_enum, NULL);
@@ -1614,6 +1615,7 @@ parse_args (unsigned argc, char **argv)
       break;
     case dynamic_list_data:
       link_info.dynamic_data = TRUE;
+      /* fall through */
     case dynamic_list:
       link_info.dynamic = TRUE;
       break;
diff --git a/ld/plugin.c b/ld/plugin.c
index 4c161d1..8efcf38 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -418,6 +418,7 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym,
 	default:
 	  einfo (_("%P%F: unknown ELF symbol visibility: %d!\n"),
 		 ldsym->visibility);
+	  /* fall through - default visibility */
 	case LDPV_DEFAULT:
 	  visibility = STV_DEFAULT;
 	  break;
-- 
2.7.4


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