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.
This commit is contained in:
Alan Modra 2020-05-20 22:47:29 +09:30
parent 5e2ab61254
commit d96bf37ba8
22 changed files with 94 additions and 196 deletions

View File

@ -1,3 +1,8 @@
2020-05-21 Alan Modra <amodra@gmail.com>
* mep.opc (mep_cgen_expand_macros_and_parse_operand): Replace
"if (x) free (x)" with "free (x)".
2020-05-19 Stafford Horne <shorne@gmail.com>
PR 25184

View File

@ -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;
}

View File

@ -1,3 +1,25 @@
2020-05-21 Alan Modra <amodra@gmail.com>
* 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 <nelson.chu@sifive.com>
* riscv-opc.c (riscv_ext_version_table): The table used to store

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 =