mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-17 07:40:07 +08:00
Remove 'if' from GDB_PY_HANDLE_EXCEPTION
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: these should only ever be called from a 'catch' block, where it's already known that an exception was thrown. Simon pointed out, though, that in a few spots, these were in facts called outside of 'catch' blocks. This patch cleans up these spots. I also found one spot where a redundant 'return nullptr' could be removed.
This commit is contained in:
@@ -847,26 +847,20 @@ private:
|
||||
PyGILState_STATE m_state;
|
||||
};
|
||||
|
||||
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
||||
exception. */
|
||||
/* Use this in a 'catch' block to convert the exception to a Python
|
||||
exception and return nullptr. */
|
||||
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
|
||||
do { \
|
||||
if (Exception.reason < 0) \
|
||||
{ \
|
||||
gdbpy_convert_exception (Exception); \
|
||||
return NULL; \
|
||||
} \
|
||||
gdbpy_convert_exception (Exception); \
|
||||
return nullptr; \
|
||||
} while (0)
|
||||
|
||||
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
||||
exception. This macro is for use inside setter functions. */
|
||||
/* Use this in a 'catch' block to convert the exception to a Python
|
||||
exception and return -1. */
|
||||
#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);
|
||||
|
||||
Reference in New Issue
Block a user