public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove 'if' from GDB_PY_HANDLE_EXCEPTION
@ 2023-12-22 18:44 Tom Tromey
  2023-12-22 19:16 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2023-12-22 18:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-14 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-22 18:44 [PATCH] Remove 'if' from GDB_PY_HANDLE_EXCEPTION Tom Tromey
2023-12-22 19:16 ` Simon Marchi
2024-01-24  1:58   ` Tom Tromey
2024-03-14 15:02     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).