From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 565133858D28; Wed, 25 Jan 2023 19:29:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 565133858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674674967; bh=FTcyHjR4+qA3C+dRxNHkHxdfYarputuITvmSeC65w4o=; h=From:To:Subject:Date:From; b=swAsv54aJ2T8IIkR8OEnyF8nTnA3PjH3Pt7NvVJIm4jv5m9de0W4eBjZ6w1ZuobPQ 92Enf8ovlCdaIPDBl71yicJyd03VB27DeBGT4I1ZAGssdv8XvfX7Gu3d1YHE6+E6Fy mc2BQ8k4daQHG+h7XBsN5+UXJSMIvROaC5M6igX8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Clean up unusual code in mi-cmd-stack.c X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 0e46a09d12aa9c2c77d783ace336866e429ffa73 X-Git-Newrev: 6121eeb72978cc5749c4c9f119b4dbaf637517c9 Message-Id: <20230125192927.565133858D28@sourceware.org> Date: Wed, 25 Jan 2023 19:29:27 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6121eeb72978= cc5749c4c9f119b4dbaf637517c9 commit 6121eeb72978cc5749c4c9f119b4dbaf637517c9 Author: Tom Tromey Date: Wed Jan 25 08:04:39 2023 -0700 Clean up unusual code in mi-cmd-stack.c =20 I noticed some unusual code in mi-cmd-stack.c. This code is a switch, where one of the cases appears in the middle of another block. It seemed cleaner to me to have the earlier case just conditionally fall through. Diff: --- gdb/mi/mi-cmd-stack.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 00e61e04b67..4666808a9c9 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -571,7 +571,6 @@ list_args_or_locals (const frame_print_options &fp_opts, const struct block *block; struct symbol *sym; struct block_iterator iter; - struct type *type; const char *name_of_result; struct ui_out *uiout =3D current_uiout; =20 @@ -649,17 +648,20 @@ list_args_or_locals (const frame_print_options &fp_op= ts, switch (values) { case PRINT_SIMPLE_VALUES: - type =3D check_typedef (sym2->type ()); - if (type->code () !=3D TYPE_CODE_ARRAY - && type->code () !=3D TYPE_CODE_STRUCT - && type->code () !=3D TYPE_CODE_UNION) - { + { + struct type *type =3D check_typedef (sym2->type ()); + if (type->code () =3D=3D TYPE_CODE_ARRAY + || type->code () =3D=3D TYPE_CODE_STRUCT + || type->code () =3D=3D TYPE_CODE_UNION) + break; + } + /* FALLTHROUGH */ + case PRINT_ALL_VALUES: if (sym->is_argument ()) read_frame_arg (fp_opts, sym2, fi, &arg, &entryarg); else read_frame_local (sym2, fi, &arg); - } break; }