From: Alan Modra Date: Wed, 20 May 2020 13:17:29 +0000 (+0930) Subject: Replace "if (x) free (x)" with "free (x)", opcodes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d96bf37ba8360320db4d531008634b3f61af06f5;p=binutils-gdb.git Replace "if (x) free (x)" with "free (x)", opcodes cpu/ * mep.opc (mep_cgen_expand_macros_and_parse_operand): Replace "if (x) free (x)" with "free (x)". opcodes/ * arc-ext.c: Replace "if (x) free (x)" with "free (x)" throughout. * sparc-dis.c: Likewise. * tic4x-dis.c: Likewise. * xtensa-dis.c: Likewise. * bpf-desc.c: Regenerate. * epiphany-desc.c: Regenerate. * fr30-desc.c: Regenerate. * frv-desc.c: Regenerate. * ip2k-desc.c: Regenerate. * iq2000-desc.c: Regenerate. * lm32-desc.c: Regenerate. * m32c-desc.c: Regenerate. * m32r-desc.c: Regenerate. * mep-asm.c: Regenerate. * mep-desc.c: Regenerate. * mt-desc.c: Regenerate. * or1k-desc.c: Regenerate. * xc16x-desc.c: Regenerate. * xstormy16-desc.c: Regenerate. --- diff --git a/cpu/ChangeLog b/cpu/ChangeLog index ef6d49aa776..f791c00b945 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,8 @@ +2020-05-21 Alan Modra + + * mep.opc (mep_cgen_expand_macros_and_parse_operand): Replace + "if (x) free (x)" with "free (x)". + 2020-05-19 Stafford Horne PR 25184 diff --git a/cpu/mep.opc b/cpu/mep.opc index 7ed3ea8ca84..34e279d98e1 100644 --- a/cpu/mep.opc +++ b/cpu/mep.opc @@ -855,8 +855,7 @@ mep_cgen_expand_macros_and_parse_operand (CGEN_CPU_DESC cd, int opindex, *strp_in += (str - hold); } - if (hold) - free (hold); + free (hold); return errmsg; } diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d788d8c35af..3e66569d4e1 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,25 @@ +2020-05-21 Alan Modra + + * arc-ext.c: Replace "if (x) free (x)" with "free (x)" throughout. + * sparc-dis.c: Likewise. + * tic4x-dis.c: Likewise. + * xtensa-dis.c: Likewise. + * bpf-desc.c: Regenerate. + * epiphany-desc.c: Regenerate. + * fr30-desc.c: Regenerate. + * frv-desc.c: Regenerate. + * ip2k-desc.c: Regenerate. + * iq2000-desc.c: Regenerate. + * lm32-desc.c: Regenerate. + * m32c-desc.c: Regenerate. + * m32r-desc.c: Regenerate. + * mep-asm.c: Regenerate. + * mep-desc.c: Regenerate. + * mt-desc.c: Regenerate. + * or1k-desc.c: Regenerate. + * xc16x-desc.c: Regenerate. + * xstormy16-desc.c: Regenerate. + 2020-05-20 Nelson Chu * riscv-opc.c (riscv_ext_version_table): The table used to store diff --git a/opcodes/arc-ext.c b/opcodes/arc-ext.c index 40caef91bf9..dc907772335 100644 --- a/opcodes/arc-ext.c +++ b/opcodes/arc-ext.c @@ -245,17 +245,11 @@ destroy_map (void) /* Free core registers. */ for (i = 0; i < NUM_EXT_CORE; i++) - { - if (arc_extension_map.coreRegisters[i].name) - free (arc_extension_map.coreRegisters[i].name); - } + free (arc_extension_map.coreRegisters[i].name); /* Free condition codes. */ for (i = 0; i < NUM_EXT_COND; i++) - { - if (arc_extension_map.condCodes[i]) - free (arc_extension_map.condCodes[i]); - } + free (arc_extension_map.condCodes[i]); memset (&arc_extension_map, 0, sizeof (arc_extension_map)); } diff --git a/opcodes/bpf-desc.c b/opcodes/bpf-desc.c index 113f5457b5f..d2803f0a98c 100644 --- a/opcodes/bpf-desc.c +++ b/opcodes/bpf-desc.c @@ -1821,18 +1821,10 @@ bpf_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/epiphany-desc.c b/opcodes/epiphany-desc.c index af5394efdcc..3776ebba5b1 100644 --- a/opcodes/epiphany-desc.c +++ b/opcodes/epiphany-desc.c @@ -2269,18 +2269,10 @@ epiphany_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c index 3ac7e2b790e..5fe16b781aa 100644 --- a/opcodes/fr30-desc.c +++ b/opcodes/fr30-desc.c @@ -1746,18 +1746,10 @@ fr30_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/frv-desc.c b/opcodes/frv-desc.c index d10b935ae6f..869237e674b 100644 --- a/opcodes/frv-desc.c +++ b/opcodes/frv-desc.c @@ -6486,18 +6486,10 @@ frv_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/ip2k-desc.c b/opcodes/ip2k-desc.c index cf33c4fb4bf..9e5cf6ce23a 100644 --- a/opcodes/ip2k-desc.c +++ b/opcodes/ip2k-desc.c @@ -1175,18 +1175,10 @@ ip2k_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/iq2000-desc.c b/opcodes/iq2000-desc.c index f9f6beb105f..b14842767e8 100644 --- a/opcodes/iq2000-desc.c +++ b/opcodes/iq2000-desc.c @@ -2180,18 +2180,10 @@ iq2000_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/lm32-desc.c b/opcodes/lm32-desc.c index f3db0dd724c..7470c3f9f1b 100644 --- a/opcodes/lm32-desc.c +++ b/opcodes/lm32-desc.c @@ -1162,18 +1162,10 @@ lm32_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/m32c-desc.c b/opcodes/m32c-desc.c index 9c4fec4c1f3..d79d2f49df9 100644 --- a/opcodes/m32c-desc.c +++ b/opcodes/m32c-desc.c @@ -63193,18 +63193,10 @@ m32c_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c index e24bb74d304..142cea34080 100644 --- a/opcodes/m32r-desc.c +++ b/opcodes/m32r-desc.c @@ -1525,18 +1525,10 @@ m32r_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c index 28085aa9cb7..c5c33070c70 100644 --- a/opcodes/mep-asm.c +++ b/opcodes/mep-asm.c @@ -811,8 +811,7 @@ mep_cgen_expand_macros_and_parse_operand (CGEN_CPU_DESC cd, int opindex, *strp_in += (str - hold); } - if (hold) - free (hold); + free (hold); return errmsg; } diff --git a/opcodes/mep-desc.c b/opcodes/mep-desc.c index b77681701e6..305f7447074 100644 --- a/opcodes/mep-desc.c +++ b/opcodes/mep-desc.c @@ -6386,18 +6386,10 @@ mep_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/mt-desc.c b/opcodes/mt-desc.c index 85ef4440d7e..ca1f50c4afb 100644 --- a/opcodes/mt-desc.c +++ b/opcodes/mt-desc.c @@ -1306,18 +1306,10 @@ mt_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/or1k-desc.c b/opcodes/or1k-desc.c index 74976191868..8bf986d9e0e 100644 --- a/opcodes/or1k-desc.c +++ b/opcodes/or1k-desc.c @@ -2200,18 +2200,10 @@ or1k_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index c825c863b2e..c9667f172b4 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -441,8 +441,7 @@ build_hash_table (const sparc_opcode **opcode_table, memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0])); memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0])); - if (hash_buf != NULL) - free (hash_buf); + free (hash_buf); hash_buf = xmalloc (sizeof (* hash_buf) * num_opcodes); for (i = num_opcodes - 1; i >= 0; --i) { diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index a99b52a7ad0..683f22e50fa 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -695,16 +695,10 @@ tic4x_disassemble (unsigned long pc, tic4x_version = info->mach; /* Don't stash anything from a previous call using a different machine. */ - if (optab) - { - free (optab); - optab = NULL; - } - if (optab_special) - { - free (optab_special); - optab_special = NULL; - } + free (optab); + optab = NULL; + free (optab_special); + optab_special = NULL; registernames[REG_R0] = NULL; } diff --git a/opcodes/xc16x-desc.c b/opcodes/xc16x-desc.c index b2c04249b47..621f2eb7386 100644 --- a/opcodes/xc16x-desc.c +++ b/opcodes/xc16x-desc.c @@ -3509,18 +3509,10 @@ xc16x_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/xstormy16-desc.c b/opcodes/xstormy16-desc.c index 02a4e8992b4..c1669c06e6a 100644 --- a/opcodes/xstormy16-desc.c +++ b/opcodes/xstormy16-desc.c @@ -1477,18 +1477,10 @@ xstormy16_cgen_cpu_close (CGEN_CPU_DESC cd) regfree (CGEN_INSN_RX (insns)); } - if (cd->macro_insn_table.init_entries) - free ((CGEN_INSN *) cd->macro_insn_table.init_entries); - - if (cd->insn_table.init_entries) - free ((CGEN_INSN *) cd->insn_table.init_entries); - - if (cd->hw_table.entries) - free ((CGEN_HW_ENTRY *) cd->hw_table.entries); - - if (cd->operand_table.entries) - free ((CGEN_HW_ENTRY *) cd->operand_table.entries); - + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + free ((CGEN_INSN *) cd->insn_table.init_entries); + free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); free (cd); } diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c index a7f8d2b9f81..6b6baf624e2 100644 --- a/opcodes/xtensa-dis.c +++ b/opcodes/xtensa-dis.c @@ -306,8 +306,7 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info) { /* Reset insn_table_entries. */ priv.insn_table_entry_count = 0; - if (priv.insn_table_entries) - free (priv.insn_table_entries); + free (priv.insn_table_entries); priv.insn_table_entries = NULL; } priv.last_section = section; @@ -319,8 +318,7 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info) XTENSA_PROP_SEC_NAME, FALSE); if (priv.insn_table_entry_count == 0) { - if (priv.insn_table_entries) - free (priv.insn_table_entries); + free (priv.insn_table_entries); priv.insn_table_entries = NULL; /* Backwards compatibility support. */ priv.insn_table_entry_count =