From 1e0f0b4d0191263e35d81a3670d56bf639be274a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 5 Oct 2016 16:44:07 +1030 Subject: [PATCH] -Wimplicit-fallthrough noreturn fixes binutils/ * cxxfilt.c (usage): Add ATTRIBUTE_NORETURN. * elfedit.c (usage): Likewise. * nm.c (usage): Likewise. * objcopy.c (copy_usage, strip_usage): Likewise. * srconv.c (show_usage): Likewise. * strings.c (usage): Likewise. * sysdump.c (show_usage): Likewise. * srconv.c: Remove unneeded forward function declarations. * strings.c: Likewise. * sysdump.c: Likewise. gas/ * as.h (as_assert): Add ATTRIBUTE_NORETURN. --- binutils/ChangeLog | 13 +++++++++++++ binutils/cxxfilt.c | 2 +- binutils/elfedit.c | 2 +- binutils/nm.c | 2 +- binutils/objcopy.c | 4 ++-- binutils/srconv.c | 42 +----------------------------------------- binutils/strings.c | 5 +---- binutils/sysdump.c | 16 +--------------- gas/ChangeLog | 4 ++++ gas/as.h | 2 +- 10 files changed, 26 insertions(+), 66 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bef5ec0a2a..4380b6381d 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,16 @@ +2016-10-06 Alan Modra + + * cxxfilt.c (usage): Add ATTRIBUTE_NORETURN. + * elfedit.c (usage): Likewise. + * nm.c (usage): Likewise. + * objcopy.c (copy_usage, strip_usage): Likewise. + * srconv.c (show_usage): Likewise. + * strings.c (usage): Likewise. + * sysdump.c (show_usage): Likewise. + * srconv.c: Remove unneeded forward function declarations. + * strings.c: Likewise. + * sysdump.c: Likewise. + 2016-10-06 Alan Modra * coffdump.c (dump_coff_where): Add missing break. diff --git a/binutils/cxxfilt.c b/binutils/cxxfilt.c index 5a3b334068..d5863ee962 100644 --- a/binutils/cxxfilt.c +++ b/binutils/cxxfilt.c @@ -87,7 +87,7 @@ print_demangler_list (FILE *stream) fprintf (stream, "}"); } -static void +ATTRIBUTE_NORETURN static void usage (FILE *stream, int status) { fprintf (stream, "\ diff --git a/binutils/elfedit.c b/binutils/elfedit.c index 1223b25a65..20c5043c9a 100644 --- a/binutils/elfedit.c +++ b/binutils/elfedit.c @@ -655,7 +655,7 @@ static struct option options[] = {0, no_argument, 0, 0} }; -static void +ATTRIBUTE_NORETURN static void usage (FILE *stream, int exit_status) { fprintf (stream, _("Usage: %s elffile(s)\n"), diff --git a/binutils/nm.c b/binutils/nm.c index 1fdfae1492..6d887485cb 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -231,7 +231,7 @@ static struct option long_options[] = /* Some error-reporting functions. */ -static void +ATTRIBUTE_NORETURN static void usage (FILE *stream, int status) { fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name); diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 2e8ff274a0..9a64ec30e6 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -512,7 +512,7 @@ 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 +ATTRIBUTE_NORETURN static void copy_usage (FILE *stream, int exit_status) { fprintf (stream, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); @@ -646,7 +646,7 @@ copy_usage (FILE *stream, int exit_status) exit (exit_status); } -static void +ATTRIBUTE_NORETURN static void strip_usage (FILE *stream, int exit_status) { fprintf (stream, _("Usage: %s in-file(s)\n"), program_name); diff --git a/binutils/srconv.c b/binutils/srconv.c index 0d1dcd8b45..9df325b7eb 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -43,52 +43,12 @@ static int addrsize; static char *toolname; static char **rnames; -static int get_member_id (int); -static int get_ordinary_id (int); -static char *section_translate (char *); -static char *strip_suffix (const char *); -static void checksum (FILE *, unsigned char *, int, int); -static void writeINT (int, unsigned char *, int *, int, FILE *); -static void writeBITS (int, unsigned char *, int *, int); -static void writeBARRAY (barray, unsigned char *, int *, int, FILE *); -static void writeCHARS (char *, unsigned char *, int *, int, FILE *); -static void wr_tr (void); -static void wr_un (struct coff_ofile *, struct coff_sfile *, int, int); -static void wr_hd (struct coff_ofile *); -static void wr_sh (struct coff_ofile *, struct coff_section *); -static void wr_ob (struct coff_ofile *, struct coff_section *); -static void wr_rl (struct coff_ofile *, struct coff_section *); -static void wr_object_body (struct coff_ofile *); -static void wr_dps_start - (struct coff_sfile *, struct coff_section *, struct coff_scope *, int, int); -static void wr_dps_end (struct coff_section *, struct coff_scope *, int); -static int *nints (int); -static void walk_tree_type_1 - (struct coff_sfile *, struct coff_symbol *, struct coff_type *, int); -static void walk_tree_type - (struct coff_sfile *, struct coff_symbol *, struct coff_type *, int); static void walk_tree_symbol (struct coff_sfile *, struct coff_section *, struct coff_symbol *, int); static void walk_tree_scope (struct coff_section *, struct coff_sfile *, struct coff_scope *, int, int); -static void walk_tree_sfile (struct coff_section *, struct coff_sfile *); -static void wr_program_structure (struct coff_ofile *, struct coff_sfile *); -static void wr_du (struct coff_ofile *, struct coff_sfile *, int); -static void wr_dus (struct coff_ofile *, struct coff_sfile *); static int find_base (struct coff_sfile *, struct coff_section *); -static void wr_dln (struct coff_ofile *, struct coff_sfile *, int); static void wr_globals (struct coff_ofile *, struct coff_sfile *, int); -static void wr_debug (struct coff_ofile *); -static void wr_cs (void); -static int wr_sc (struct coff_ofile *, struct coff_sfile *); -static void wr_er (struct coff_ofile *, struct coff_sfile *, int); -static void wr_ed (struct coff_ofile *, struct coff_sfile *, int); -static void wr_unit_info (struct coff_ofile *); -static void wr_module (struct coff_ofile *); -static int align (int); -static void prescan (struct coff_ofile *); -static void show_usage (FILE *, int); -extern int main (int, char **); static FILE *file; static bfd *abfd; @@ -1732,7 +1692,7 @@ prescan (struct coff_ofile *otree) char *program_name; -static void +ATTRIBUTE_NORETURN static void show_usage (FILE *ffile, int status) { fprintf (ffile, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); diff --git a/binutils/strings.c b/binutils/strings.c index bc49bec137..58b7e8ab13 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -146,12 +146,9 @@ typedef struct bfd_size_type filesize; } filename_and_size_t; -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 long get_char (FILE *, file_ptr *, int *, char **); +static void usage (FILE *, int) ATTRIBUTE_NORETURN; int main (int, char **); diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 37ad6030f3..5976fac53f 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -38,21 +38,7 @@ static int code; static int addrsize = 4; static FILE *file; -static void dh (unsigned char *, int); -static void itheader (char *, int); -static void p (void); -static void tabout (void); -static void pbarray (barray *); -static int getone (int); -static int opt (int); -static void must (int); -static void tab (int, char *); -static void dump_symbol_info (void); static void derived_type (void); -static void module (void); -static void show_usage (FILE *, int); - -extern int main (int, char **); static char * getCHARS (unsigned char *ptr, int *idx, int size, int max) @@ -649,7 +635,7 @@ module (void) char *program_name; -static void +ATTRIBUTE_NORETURN static void show_usage (FILE *ffile, int status) { fprintf (ffile, _("Usage: %s [option(s)] in-file\n"), program_name); diff --git a/gas/ChangeLog b/gas/ChangeLog index 80ab144d3f..5ccc133e92 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2016-10-06 Alan Modra + + * as.h (as_assert): Add ATTRIBUTE_NORETURN. + 2016-10-06 Alan Modra * config/tc-arc.c (find_opcode_match): Add missing break. diff --git a/gas/as.h b/gas/as.h index 169c714adb..9fa93892eb 100644 --- a/gas/as.h +++ b/gas/as.h @@ -459,7 +459,7 @@ PRINTF_LIKE (as_warn); PRINTF_WHERE_LIKE (as_bad_where); PRINTF_WHERE_LIKE (as_warn_where); -void as_assert (const char *, int, const char *); +void as_assert (const char *, int, const char *) ATTRIBUTE_NORETURN; void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; void sprint_value (char *, addressT); int had_errors (void); -- 2.34.1