From f995bbe8e62fdb5607acb1ee127240cfe50d2b8f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 5 Apr 2017 19:21:33 +0100 Subject: -Wwrite-strings: Constify struct disassemble_info's disassembler_options field The memory disassemble_info::disassembler_options points to is always owned by the client. I.e., that field is an non-owning, observing pointer. Thus const makes sense. Are the include/ and opcodes/ bits OK? Tested on x86_64 Fedora 23, built with --enable-targets=all. include/ChangeLog: 2017-04-05 Pedro Alves * dis-asm.h (disassemble_info) : Now a "const char *". (next_disassembler_option): Constify. opcodes/ChangeLog: 2017-04-05 Pedro Alves * arc-dis.c (parse_option, parse_disassembler_options): Constify. * arm-dis.c (parse_arm_disassembler_options): Constify. * ppc-dis.c (powerpc_init_dialect): Constify local. * vax-dis.c (parse_disassembler_options): Constify. gdb/ChangeLog: 2017-04-05 Pedro Alves * arm-tdep.c (show_disassembly_style_sfunc): Constify local. * disasm.c (set_disassembler_options): Constify local. * i386-tdep.c (i386_print_insn): Remove cast and FIXME comment. --- opcodes/ChangeLog | 7 +++++++ opcodes/arc-dis.c | 4 ++-- opcodes/arm-dis.c | 4 ++-- opcodes/ppc-dis.c | 2 +- opcodes/vax-dis.c | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index ce6ee40..2889f53 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,10 @@ +2017-04-05 Pedro Alves + + * arc-dis.c (parse_option, parse_disassembler_options): Constify. + * arm-dis.c (parse_arm_disassembler_options): Constify. + * ppc-dis.c (powerpc_init_dialect): Constify local. + * vax-dis.c (parse_disassembler_options): Constify. + 2017-04-03 Palmer Dabbelt * riscv-dis.c (riscv_disassemble_insn): Change "_gp" to diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c index 3afd253..4beca68 100644 --- a/opcodes/arc-dis.c +++ b/opcodes/arc-dis.c @@ -733,7 +733,7 @@ operand_iterator_next (struct arc_operand_iterator *iter, /* Helper for parsing the options. */ static void -parse_option (char *option) +parse_option (const char *option) { if (CONST_STRNEQ (option, "dsp")) add_to_decodelist (DSP, NONE); @@ -772,7 +772,7 @@ parse_option (char *option) /* Go over the options list and parse it. */ static void -parse_disassembler_options (char *options) +parse_disassembler_options (const char *options) { if (options == NULL) return; diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index e4f99b8..a3e53db 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -6101,9 +6101,9 @@ arm_symbol_is_valid (asymbol * sym, /* Parse the string of disassembler options. */ static void -parse_arm_disassembler_options (char *options) +parse_arm_disassembler_options (const char *options) { - char *opt; + const char *opt; FOR_EACH_DISASSEMBLER_OPTION (opt, options) { diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index ee8016a..188e90a 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -344,7 +344,7 @@ powerpc_init_dialect (struct disassemble_info *info) break; } - char *opt; + const char *opt; FOR_EACH_DISASSEMBLER_OPTION (opt, info->disassembler_options) { ppc_cpu_t new_cpu = 0; diff --git a/opcodes/vax-dis.c b/opcodes/vax-dis.c index ff240e4..4642702 100644 --- a/opcodes/vax-dis.c +++ b/opcodes/vax-dis.c @@ -117,7 +117,7 @@ static bfd_vma * entry_addr = NULL; there's no symbol table. Returns TRUE upon success, FALSE otherwise. */ static bfd_boolean -parse_disassembler_options (char * options) +parse_disassembler_options (const char *options) { const char * entry_switch = "entry:"; -- cgit v1.1