mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 11:00:01 +08:00
gdbsupport: remove FUNCTION_NAME
__func__ is standard C++11: https://en.cppreference.com/w/cpp/language/function Also, in C++11, __func__ expands to the demangled function name, so the mention in the comment above FUNCTION_NAME doesn't apply anymore. Finally, in places where FUNCTION_NAME is used, I think it's enough to print the function name, no need to print the whole signature. Therefore, I propose to just remove FUNCTION_NAME and update users to use the standard __func__. Change-Id: I778f28155422b044402442dc18d42d0cded1017d
This commit is contained in:
@ -33,29 +33,18 @@
|
||||
|
||||
#define gdb_assert(expr) \
|
||||
((void) ((expr) ? 0 : \
|
||||
(gdb_assert_fail (#expr, __FILE__, __LINE__, FUNCTION_NAME), 0)))
|
||||
(gdb_assert_fail (#expr, __FILE__, __LINE__, __func__), 0)))
|
||||
|
||||
/* This prints an "Assertion failed" message, asking the user if they
|
||||
want to continue, dump core, or just exit. */
|
||||
#if defined (FUNCTION_NAME)
|
||||
#define gdb_assert_fail(assertion, file, line, function) \
|
||||
internal_error (file, line, _("%s: Assertion `%s' failed."), \
|
||||
function, assertion)
|
||||
#else
|
||||
#define gdb_assert_fail(assertion, file, line, function) \
|
||||
internal_error (file, line, _("Assertion `%s' failed."), \
|
||||
assertion)
|
||||
#endif
|
||||
|
||||
/* The canonical form of gdb_assert (0).
|
||||
MESSAGE is a string to include in the error message. */
|
||||
|
||||
#if defined (FUNCTION_NAME)
|
||||
#define gdb_assert_not_reached(message) \
|
||||
internal_error (__FILE__, __LINE__, "%s: %s", FUNCTION_NAME, _(message))
|
||||
#else
|
||||
#define gdb_assert_not_reached(message) \
|
||||
internal_error (__FILE__, __LINE__, _(message))
|
||||
#endif
|
||||
internal_error (__FILE__, __LINE__, "%s: %s", __func__, _(message))
|
||||
|
||||
#endif /* COMMON_GDB_ASSERT_H */
|
||||
|
Reference in New Issue
Block a user