Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/tui] Simplify tui_enable
Date: Wed, 29 Apr 2026 13:28:18 +0200	[thread overview]
Message-ID: <20260429112818.1610891-1-tdevries@suse.de> (raw)

I noticed some code in tui_enable doing:
...
if (...)
  error (...);
else if (...)
...
which is the "Don’t use else after a return" anti-pattern [1].

Fix this by using:
...
if (...)
  error (...);

if (...)
...

[1] https://llvm.org/docs/CodingStandards.html#id41
---
 gdb/tui/tui.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index ba4f6f68769..de2faa36af7 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -429,7 +429,8 @@ tui_enable (void)
 	 again.  */
       error (_("Cannot enable the TUI"));
     }
-  else if (tui_finish_init == TRIBOOL_TRUE)
+
+  if (tui_finish_init == TRIBOOL_TRUE)
     {
       WINDOW *w;
       SCREEN *s;

base-commit: 8a5e138e6276ce7644ab858751440cb59f35623b
-- 
2.51.0


             reply	other threads:[~2026-04-29 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 11:28 Tom de Vries [this message]
2026-05-01 16:38 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260429112818.1610891-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox