From patchwork Tue Sep 27 18:16:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 16086 Received: (qmail 76051 invoked by alias); 27 Sep 2016 18:16:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 75960 invoked by uid 89); 27 Sep 2016 18:16:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=*string, LONGEST, 9687 X-HELO: gproxy1.mail.unifiedlayer.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO gproxy1.mail.unifiedlayer.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Sep 2016 18:16:45 +0000 Received: from cmgw3 (cmgw4 [10.0.90.84]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id CF53B175BF0 for ; Tue, 27 Sep 2016 12:16:43 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id oiGg1t01M2f2jeq01iGjHD; Tue, 27 Sep 2016 12:16:43 -0600 X-Authority-Analysis: v=2.1 cv=aaryw3Yt c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=GW1xBdLrtEIA:10 a=zstS-IiYAAAA:8 a=3mGz-6hrAAAA:8 a=_UvAeebziz1MfNvcyNMA:9 a=iU4k-9Ps5Zykqje9:21 a=31KGT-pLIxK63i-d:21 a=4G6NA9xxw8l3yy4pmD5M:22 a=_r3JdlzVTz_TzSp0BUuH:22 Received: from 71-218-192-86.hlrn.qwest.net ([71.218.192.86]:60956 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1bowvo-0000eX-EH; Tue, 27 Sep 2016 12:16:40 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/3] Fix "fall through" comments Date: Tue, 27 Sep 2016 12:16:30 -0600 Message-Id: <1475000192-8789-2-git-send-email-tom@tromey.com> In-Reply-To: <1475000192-8789-1-git-send-email-tom@tromey.com> References: <1475000192-8789-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1bowvo-0000eX-EH X-Source-Sender: 71-218-192-86.hlrn.qwest.net (bapiya.Home) [71.218.192.86]:60956 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This patch updates existing "fall through" comments so that they can be recognized by gcc's -Wimplicit-fallthrough comment-parsing heuristic. 2016-09-27 Tom Tromey * xcoffread.c (scan_xcoff_symtab): Move comment later. * symfile.c (section_is_mapped): Fix fall-through comment. * stabsread.c (define_symbol, read_member_functions): Fix fall-through comment. * s390-linux-tdep.c (s390_process_record): Fix fall-through comment. * remote.c (remote_wait_as): Fix fall-through comment. * p-exp.y (yylex): Fix fall-through comment. * nat/x86-dregs.c (x86_length_and_rw_bits): Fix fall-through comment. * msp430-tdep.c (msp430_gdbarch_init): Fix fall-through comment. * mdebugread.c (parse_partial_symbols): Fix fall-through comment. * jv-exp.y (yylex): Fix fall-through comment. * go-exp.y (lex_one_token): Fix fall-through comment. * gdbtypes.c (get_discrete_bounds, rank_one_type): Fix fall-through comment. * f-exp.y (yylex): Fix fall-through comment. * dwarf2read.c (process_die): Fix fall-through comment. * dbxread.c (process_one_symbol): Fix fall-through comment. * d-exp.y (lex_one_token): Fix fall-through comment. * cp-name-parser.y (yylex): Fix fall-through comment. * coffread.c (coff_symtab_read): Fix fall-through comment. * c-exp.y (lex_one_token): Fix fall-through comment. * arm-tdep.c (arm_decode_miscellaneous): Fix fall-through comment. * arch/arm.c (arm_instruction_changes_pc): Fix fall-through comment. --- gdb/ChangeLog | 30 ++++++++++++++++++++++++++++++ gdb/arch/arm.c | 3 ++- gdb/arm-tdep.c | 1 + gdb/c-exp.y | 2 +- gdb/coffread.c | 3 ++- gdb/cp-name-parser.y | 2 +- gdb/d-exp.y | 2 +- gdb/dbxread.c | 4 ++-- gdb/dwarf2read.c | 3 ++- gdb/f-exp.y | 2 +- gdb/gdbtypes.c | 6 +++--- gdb/go-exp.y | 2 +- gdb/jv-exp.y | 2 +- gdb/mdebugread.c | 3 ++- gdb/msp430-tdep.c | 2 +- gdb/nat/x86-dregs.c | 2 +- gdb/p-exp.y | 2 +- gdb/remote.c | 2 +- gdb/s390-linux-tdep.c | 5 +++-- gdb/stabsread.c | 5 +++-- gdb/symfile.c | 2 +- gdb/xcoffread.c | 2 +- 22 files changed, 62 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4810f1b..fdd43ab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,33 @@ +2016-09-27 Tom Tromey + + * xcoffread.c (scan_xcoff_symtab): Move comment later. + * symfile.c (section_is_mapped): Fix fall-through comment. + * stabsread.c (define_symbol, read_member_functions): Fix + fall-through comment. + * s390-linux-tdep.c (s390_process_record): Fix fall-through + comment. + * remote.c (remote_wait_as): Fix fall-through comment. + * p-exp.y (yylex): Fix fall-through comment. + * nat/x86-dregs.c (x86_length_and_rw_bits): Fix fall-through + comment. + * msp430-tdep.c (msp430_gdbarch_init): Fix fall-through comment. + * mdebugread.c (parse_partial_symbols): Fix fall-through comment. + * jv-exp.y (yylex): Fix fall-through comment. + * go-exp.y (lex_one_token): Fix fall-through comment. + * gdbtypes.c (get_discrete_bounds, rank_one_type): Fix + fall-through comment. + * f-exp.y (yylex): Fix fall-through comment. + * dwarf2read.c (process_die): Fix fall-through comment. + * dbxread.c (process_one_symbol): Fix fall-through comment. + * d-exp.y (lex_one_token): Fix fall-through comment. + * cp-name-parser.y (yylex): Fix fall-through comment. + * coffread.c (coff_symtab_read): Fix fall-through comment. + * c-exp.y (lex_one_token): Fix fall-through comment. + * arm-tdep.c (arm_decode_miscellaneous): Fix fall-through + comment. + * arch/arm.c (arm_instruction_changes_pc): Fix fall-through + comment. + 2016-09-27 Fredrik Hederstierna * arm-tdep.c (arm_m_addr_is_magic): New function. diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c index b6770fe..03ed7c4 100644 --- a/gdb/arch/arm.c +++ b/gdb/arch/arm.c @@ -153,7 +153,8 @@ arm_instruction_changes_pc (uint32_t this_instr) modify PC. */ return 0; } - /* Data processing instruction. Fall through. */ + /* Data processing instruction. */ + /* Fall through. */ case 0x1: if (bits (this_instr, 12, 15) == 15) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index a07d93b..3fc5e40 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -6655,6 +6655,7 @@ arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn, else if (op == 0x3) /* Not really supported. */ return arm_copy_unmodified (gdbarch, insn, "smc", dsc); + /* Fall through. */ default: return arm_copy_undef (gdbarch, insn, dsc); diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 29f672f..73589d4 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2527,7 +2527,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name) last_was_structop = 1; goto symbol; /* Nope, must be a symbol. */ } - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/coffread.c b/gdb/coffread.c index 830deb5..49d6803 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -968,7 +968,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, /* At least on a 3b1, gcc generates swbeg and string labels that look like this. Ignore them. */ break; - /* Fall in for static symbols that don't start with '.' */ + /* For static symbols that don't start with '.'... */ + /* Fall through. */ case C_THUMBEXT: case C_THUMBEXTFUNC: case C_EXT: diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index c6a5c34..e15b0f6 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -1673,7 +1673,7 @@ yylex (void) lexptr++; return '-'; } - /* FALL THRU into number case. */ + /* FALL THRU. */ try_number: case '0': diff --git a/gdb/d-exp.y b/gdb/d-exp.y index 426f9b3..a3287e6 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -1123,7 +1123,7 @@ lex_one_token (struct parser_state *par_state) last_was_structop = 1; goto symbol; /* Nope, must be a symbol. */ } - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/dbxread.c b/gdb/dbxread.c index d5a9587..bef28db 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -3069,9 +3069,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, unknown_symtype_complaint (hex_string (type)); /* FALLTHROUGH */ - /* The following symbol types don't need the address field - relocated, since it is either unused, or is absolute. */ define_a_symbol: + /* These symbol types don't need the address field relocated, + since it is either unused, or is absolute. */ case N_GSYM: /* Global variable. */ case N_NSYMS: /* Number of symbols (Ultrix). */ case N_NOMAP: /* No map? (Ultrix). */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d0f6e71..42b5704 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -8339,7 +8339,8 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) cu->processing_has_namespace_info = 1; if (read_namespace_alias (die, cu)) break; - /* The declaration is not a global namespace alias: fall through. */ + /* The declaration is not a global namespace alias. */ + /* fall through. */ case DW_TAG_imported_module: cu->processing_has_namespace_info = 1; if (die->child != NULL && (die->tag == DW_TAG_imported_declaration diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 420f18e..fecfdc9 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1006,7 +1006,7 @@ yylex (void) /* Might be a floating point number. */ if (lexptr[1] < '0' || lexptr[1] > '9') goto symbol; /* Nope, must be a symbol. */ - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ad890ca..d2a0f37 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -958,7 +958,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) *highp = -*lowp - 1; return 0; } - /* ... fall through for unsigned ints ... */ + /* fall through */ case TYPE_CODE_CHAR: *lowp = 0; /* This round-about calculation is to avoid shifting by @@ -3803,7 +3803,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) return INTEGER_CONVERSION_BADNESS; else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm)) return INTEGER_PROMOTION_BADNESS; - /* >>> !! else fall through !! <<< */ + /* fall through */ case TYPE_CODE_CHAR: /* Deal with signed, unsigned, and plain chars for C++ and with int cases falling through from previous case. */ @@ -3909,7 +3909,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) rank.subrank = distance_to_ancestor (parm, arg, 0); if (rank.subrank >= 0) return sum_ranks (BASE_CONVERSION_BADNESS, rank); - /* else fall through */ + /* fall through */ default: return INCOMPATIBLE_TYPE_BADNESS; } diff --git a/gdb/go-exp.y b/gdb/go-exp.y index 1b0fe5b..2723789 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1089,7 +1089,7 @@ lex_one_token (struct parser_state *par_state) last_was_structop = 1; goto symbol; /* Nope, must be a symbol. */ } - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 79b8127..f9db49a 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -921,7 +921,7 @@ yylex (void) /* Might be a floating point number. */ if (lexptr[1] < '0' || lexptr[1] > '9') goto symbol; /* Nope, must be a symbol. */ - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 157ce77..9995659 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -3701,7 +3701,8 @@ parse_partial_symbols (struct objfile *objfile) break; default: unknown_ext_complaint (debug_info->ssext + psh->iss); - /* Fall through, pretend it's global. */ + /* Pretend it's global. */ + /* Fall through. */ case stGlobal: /* Global common symbols are resolved by the runtime loader, ignore them. */ diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 84189dc..bb03fec 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -923,8 +923,8 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) code_model = ca_tdep->code_model; break; } - /* Otherwise, fall through... */ } + /* Fall through. */ default: error (_("Unknown msp430 isa")); break; diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c index 8403ca7..cb68866 100644 --- a/gdb/nat/x86-dregs.c +++ b/gdb/nat/x86-dregs.c @@ -257,7 +257,7 @@ Invalid hardware breakpoint type %d in x86_length_and_rw_bits.\n"), case 8: if (TARGET_HAS_DR_LEN_8) return (DR_LEN_8 | rw); - /* ELSE FALL THROUGH */ + /* FALL THROUGH */ default: internal_error (__FILE__, __LINE__, _("\ Invalid hardware breakpoint length %d in x86_length_and_rw_bits.\n"), len); diff --git a/gdb/p-exp.y b/gdb/p-exp.y index fa6b22c..e8612ee 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1211,7 +1211,7 @@ yylex (void) goto symbol; /* Nope, must be a symbol. */ } - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': diff --git a/gdb/remote.c b/gdb/remote.c index ec8b498..d7266db 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6984,7 +6984,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) putpkt (buf); break; } - /* else fallthrough */ + /* fallthrough */ default: warning (_("Invalid remote reply: %s"), buf); break; diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 399084a..0b73b2d 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -5206,7 +5206,7 @@ ex: return -1; break; } - /* For other instructions, fallthru. */ + /* fallthru. */ default: fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KM* function %02x at %s.\n", (int)tmp, paddress (gdbarch, addr)); @@ -5499,7 +5499,8 @@ ex: return -1; break; } - /* For KLMD, fallthru. */ + /* For KLMD... */ + /* fallthru. */ default: fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n", (int)tmp, paddress (gdbarch, addr)); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index e8ebadd..c3b9531 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -722,7 +722,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* SunPRO (3.0 at least) static variable encoding. */ if (gdbarch_static_transform_name_p (gdbarch)) goto normal; - /* ... fall through ... */ + /* fall through */ default: complaint (&symfile_complaints, _("Unknown C++ symbol name `%s'"), @@ -2530,7 +2530,8 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, complaint (&symfile_complaints, _("member function type missing, got '%c'"), (*pp)[-1]); - /* Fall through into normal member function. */ + /* Normal member function. */ + /* Fall through. */ case '.': /* normal member function. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 7eb6cdc..e9e8ca7 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3100,7 +3100,7 @@ section_is_mapped (struct obj_section *osect) if (osect->ovly_mapped == -1) gdbarch_overlay_update (gdbarch, osect); } - /* fall thru to manual case */ + /* fall thru */ case ovly_on: /* overlay debugging manual */ return osect->ovly_mapped == 1; } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 507baf2..70e031c 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2507,9 +2507,9 @@ scan_xcoff_symtab (struct objfile *objfile) } /* FALLTHROUGH */ + case C_FCN: /* C_FCN is .bf and .ef symbols. I think it is sufficient to handle only the C_FUN and C_EXT. */ - case C_FCN: case C_BSTAT: case C_ESTAT: