From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id D28DE3858C54; Tue, 25 Apr 2023 17:57:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D28DE3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682445479; bh=KULw971VRQ2lVSNeh9SXq6ellw0hBRPltDwArn0ok/M=; h=From:To:Subject:Date:From; b=EKF+1kr2D3ov8doVzjS+5UQBegfte0QHDysfcuxp82L2Un0S/k/bxy5gOk5O8YRG3 pqyWDbFxwhJyMyFGFgC4Wr1BfTed/RhuD12QAx4H2+HDRBif3u+n32RaOLpYiz9PAP kjK0AaUsnpkcJvHzuFt6m1PXeLpS23syw9R81x68= 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] Remove some "goto"s from parse.c X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 8f5cd47bee6c07c33aeda758d8d8db5f81ae03e7 X-Git-Newrev: fc53c8e02183b61a9df0224de1d7016fb52960ba Message-Id: <20230425175759.D28DE3858C54@sourceware.org> Date: Tue, 25 Apr 2023 17:57:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfc53c8e02183= b61a9df0224de1d7016fb52960ba commit fc53c8e02183b61a9df0224de1d7016fb52960ba Author: Tom Tromey Date: Mon Apr 24 13:03:03 2023 -0600 Remove some "goto"s from parse.c =20 parser_state::push_dollar has some unnecessary "goto"s. Replacing them cleans up the code. Regression tested on x86-64 Fedora 36. =20 Approved-By: Simon Marchi Diff: --- gdb/parse.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/gdb/parse.c b/gdb/parse.c index 0588c0618c6..85a6caf14ba 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -268,7 +268,8 @@ parser_state::push_dollar (struct stoken str) { /* Just dollars (one or two). */ i =3D -negate; - goto handle_last; + push_new (i); + return; } /* Is the rest of the token digits? */ for (; i < str.length; i++) @@ -279,7 +280,8 @@ parser_state::push_dollar (struct stoken str) i =3D atoi (str.ptr + 1 + negate); if (negate) i =3D -i; - goto handle_last; + push_new (i); + return; } =20 /* Handle tokens that refer to machine registers: @@ -287,7 +289,14 @@ parser_state::push_dollar (struct stoken str) i =3D user_reg_map_name_to_regnum (gdbarch (), str.ptr + 1, str.length - 1); if (i >=3D 0) - goto handle_register; + { + str.length--; + str.ptr++; + push_new (copy_name (str)); + block_tracker->update (expression_context_block, + INNERMOST_BLOCK_FOR_REGISTERS); + return; + } =20 /* Any names starting with $ are probably debugger internal variables. = */ =20 @@ -319,17 +328,6 @@ parser_state::push_dollar (struct stoken str) =20 push_new (create_internalvar (copy.c_str () + 1)); - return; -handle_last: - push_new (i); - return; -handle_register: - str.length--; - str.ptr++; - push_new (copy_name (str)); - block_tracker->update (expression_context_block, - INNERMOST_BLOCK_FOR_REGISTERS); - return; }