From db06300dddaf4fc50be73312cc5d6fe0613f95e7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 16 Mar 2020 20:20:07 +0900 Subject: [PATCH] [qfcc] Make print_operand usable from gdb It not emitting a \n made life difficult, especially whenever gdb decided to make access to printf or puts awkward. --- tools/qfcc/source/statements.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 9c926978d..54f183096 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -158,8 +158,8 @@ operand_string (operand_t *op) return ("??"); } -void -print_operand (operand_t *op) +static void +_print_operand (operand_t *op) { switch (op->op_type) { case op_def: @@ -224,7 +224,7 @@ print_operand (operand_t *op) break; case op_alias: printf ("alias(%s,", pr_type_name[op->type->type]); - print_operand (op->o.alias); + _print_operand (op->o.alias); printf (")"); break; case op_nil: @@ -233,18 +233,25 @@ print_operand (operand_t *op) } } +void +print_operand (operand_t *op) +{ + _print_operand (op); + puts (""); +} + void print_statement (statement_t *s) { printf ("(%s, ", s->opcode); if (s->opa) - print_operand (s->opa); + _print_operand (s->opa); printf (", "); if (s->opb) - print_operand (s->opb); + _print_operand (s->opb); printf (", "); if (s->opc) - print_operand (s->opc); + _print_operand (s->opc); printf (")\n"); }