mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
Replace exception_print_same with operator!=
I noticed that exception_print_same is only used in a single spot, and it seemed to be better as an operator!= method attached to gdb_exception. Regression tested on x86-64 Fedora 34.
This commit is contained in:
@ -165,6 +165,23 @@ struct gdb_exception
|
||||
return message->c_str ();
|
||||
}
|
||||
|
||||
/* Compare two exceptions. */
|
||||
bool operator== (const gdb_exception &other) const
|
||||
{
|
||||
const char *msg1 = message == nullptr ? "" : what ();
|
||||
const char *msg2 = other.message == nullptr ? "" : other.what ();
|
||||
|
||||
return (reason == other.reason
|
||||
&& error == other.error
|
||||
&& strcmp (msg1, msg2) == 0);
|
||||
}
|
||||
|
||||
/* Compare two exceptions. */
|
||||
bool operator!= (const gdb_exception &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
enum return_reason reason;
|
||||
enum errors error;
|
||||
std::shared_ptr<std::string> message;
|
||||
|
Reference in New Issue
Block a user