print_exception (file, e);
}
}
-
-/* See exceptions.h. */
-
-int
-exception_print_same (const struct gdb_exception &e1,
- const struct gdb_exception &e2)
-{
- const char *msg1 = e1.message == nullptr ? "" : e1.what ();
- const char *msg2 = e2.message == nullptr ? "" : e2.what ();
-
- return (e1.reason == e2.reason
- && e1.error == e2.error
- && strcmp (msg1, msg2) == 0);
-}
const char *prefix,
...) ATTRIBUTE_PRINTF (3, 4);
-/* Compare two exception objects for print equality. */
-extern int exception_print_same (const struct gdb_exception &e1,
- const struct gdb_exception &e2);
#endif
}
catch (const gdb_exception_error &err)
{
- if (!exception_print_same (prev_err, err))
+ if (prev_err != err)
warning ("%s", err.what ());
}
}
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;