diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-05 13:12:42 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-06-06 10:33:33 +0100 |
commit | 5ccd31931e1f9b87080fccfdd0c4229189c45271 (patch) | |
tree | b122ba5f092c75153824e78653c08b6133b2aa84 | |
parent | 47277edc3265cea891d89cef09432c7a537d467a (diff) | |
download | gdb-5ccd31931e1f9b87080fccfdd0c4229189c45271.zip gdb-5ccd31931e1f9b87080fccfdd0c4229189c45271.tar.gz gdb-5ccd31931e1f9b87080fccfdd0c4229189c45271.tar.bz2 |
opcodes/riscv: prevent future use of disassemble_info::fprintf_func
The previous commit removed a use of disassemble_info::fprintf_func
which had been added to the RISC-V disassembler after the disassembler
had been switched to use ::fprintf_styled_func, for styled output.
To prevent future mistakes, I propose adding a #define to rename
fprintf_func to something which does not exist. If this had been in
place then the before the previous commit libopcodes would have failed
to compile, like this:
../../src/opcodes/riscv-dis.c: In function ‘print_reg_list’:
../../src/opcodes/riscv-dis.c:229:7: error: ‘disassemble_info’ {aka ‘struct disassemble_info’} has no member named ‘please_use_fprintf_styled_func_instead’
229 | info->fprintf_func (info->stream, "%s", riscv_gpr_names[X_RA]);
| ^~
If this commit is accepted then I'll follow up with another commit
that adds the same #define to every disassembler that has been
converted to use styled output.
As the RISC-V disassembler is now fully styled, this commit should
make no difference at all.
-rw-r--r-- | opcodes/riscv-dis.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index b04a6e7..9c5e6ce 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -32,6 +32,11 @@ #include <stdint.h> #include <ctype.h> +/* The RISC-V disassembler produces styled output using + disassemble_info::fprintf_styled_func. This define prevents use of + disassemble_info::fprintf_func which is for unstyled output. */ +#define fprintf_func please_use_fprintf_styled_func_instead + /* Current XLEN for the disassembler. */ static unsigned xlen = 0; |