From patchwork Fri Dec 22 18:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 82773 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF57B3858C60 for ; Fri, 22 Dec 2023 18:45:13 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 75A603858D33 for ; Fri, 22 Dec 2023 18:44:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 75A603858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 75A603858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703270701; cv=none; b=hFIv54guOu4UIO4tuP5v14XBPPPWQNUZeiFhiwUZlr5cNKi9Ncm4JwgnSy5yP1N7/tht5zg4/3CrpImdQpOf3vvKdVNxeNXY9bZzwYND/s/j5EyFX6JEqexuykvb8uTCK4lrerdpZzyewMGqWw8eMwdNbq4gEoxZwWFIwrYHR10= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703270701; c=relaxed/simple; bh=CkDfKpXswjw3JlmXL8KItiYy/jmnj8ahwgMuO8Ujwi4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SgemRuPffhHw+l5a1s4TOusbvAZx+3v0Qbo5827dYr+d17/vQjmUaBD+U99tlGll9lQPEuF4lfXS0FYudsBEApTq5sh6QdZWgrLXGe/cm6bmhKRfWtAqSNvWtpWeBh09DqrcJ3RYTrkt3kbJgvRvNZXJsW75iaVREXtNGfy5nug= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id GXdjroPq9gpyEGkW2rthmj; Fri, 22 Dec 2023 18:44:59 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id GkW2r3hEn8vT0GkW2rYNOT; Fri, 22 Dec 2023 18:44:58 +0000 X-Authority-Analysis: v=2.4 cv=ffi+dmcF c=1 sm=1 tr=0 ts=6585d92a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=e2cXIFwxEfEA:10 a=Qbun_eYptAEA:10 a=7-EgtqtyuZdslv0UX3oA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2serhhFEBtoaq8S5pmW2xG/yRI9Ma5O5QLeOhqpZIiQ=; b=iWdmjW/Ao01Y3lyg2IpxLry2tA pJcPM/WJ1gKMoL+Wsoc9BwzUyPihs/7BE/7/0LflXZdbZmmdYy6yjPzNE6o/WKlqF+RsLS4z4z4CK eOI+hA/33Cn+6DNLOEgNwOe2x; Received: from 71-211-161-25.hlrn.qwest.net ([71.211.161.25]:52520 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rGkW2-000IUC-0T; Fri, 22 Dec 2023 11:44:58 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove 'if' from GDB_PY_HANDLE_EXCEPTION Date: Fri, 22 Dec 2023 11:44:51 -0700 Message-ID: <20231222184451.218271-1-tom@tromey.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.161.25 X-Source-L: No X-Exim-ID: 1rGkW2-000IUC-0T X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-161-25.hlrn.qwest.net (localhost.localdomain) [71.211.161.25]:52520 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOLX2qYwg3LPitDvnxMCQ9u9ijezXzePcQgwDbIG+80hW10Acnz+aY8iAuU6nXY2sR0V9j3qoaIGhBOddFFR0Wl4jVIfzZa/6rxQyxRaqeRq/N04PnEO EphA6X4MGytuxJlmjMxKGY8m4H7ToqPKoye6qzNYonxZB100PDQKDytmkzK2oKaSKn+nBY+0vOIoZKFpt0HqjvB9W6KTi1j92ZE= X-Spam-Status: No, score=-3022.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This removes the embedded 'if' from GDB_PY_HANDLE_EXCEPTION and GDB_PY_SET_HANDLE_EXCEPTION. I believe this 'if' was necessary with the old gdb try/catch macros, but it no longer is: now these are only ever called from a 'catch' block, where it's already known that an exception was thrown. --- gdb/python/python-internal.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 14e15574685..fc8430ff35a 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -800,22 +800,16 @@ class gdbpy_gil exception. */ #define GDB_PY_HANDLE_EXCEPTION(Exception) \ do { \ - if (Exception.reason < 0) \ - { \ - gdbpy_convert_exception (Exception); \ - return NULL; \ - } \ + gdbpy_convert_exception (Exception); \ + return NULL; \ } while (0) /* Use this after a TRY_EXCEPT to throw the appropriate Python exception. This macro is for use inside setter functions. */ #define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \ do { \ - if (Exception.reason < 0) \ - { \ - gdbpy_convert_exception (Exception); \ - return -1; \ - } \ + gdbpy_convert_exception (Exception); \ + return -1; \ } while (0) int gdbpy_print_python_errors_p (void);