[3/7] gdb: convert d_left and d_right macros into functions
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
Commit Message
Replace the d_left and d_right macros with static inline functions.
They need to return a reference, because some callers assign to the
result:
d_right ($1.last) = $2;
and some take the address:
$$.last = &d_right ($$.comp);
Change-Id: I7d8bd71ffde82a0fdfd2e2dcb87461043f82ef4f
---
gdb/cp-name-parser.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
@@ -26,8 +26,21 @@
union cp_name_parser_YYSTYPE;
struct demangle_parse_info;
-#define d_left(dc) (dc)->u.s_binary.left
-#define d_right(dc) (dc)->u.s_binary.right
+/* Return a reference to the left child of binary component DC. */
+
+static inline struct demangle_component *&
+d_left (struct demangle_component *dc)
+{
+ return dc->u.s_binary.left;
+}
+
+/* Return a reference to the right child of binary component DC. */
+
+static inline struct demangle_component *&
+d_right (struct demangle_component *dc)
+{
+ return dc->u.s_binary.right;
+}
namespace cp_name_parser {