aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpu/ChangeLog5
-rw-r--r--cpu/mep.opc3
-rw-r--r--opcodes/ChangeLog22
-rw-r--r--opcodes/arc-ext.c10
-rw-r--r--opcodes/bpf-desc.c16
-rw-r--r--opcodes/epiphany-desc.c16
-rw-r--r--opcodes/fr30-desc.c16
-rw-r--r--opcodes/frv-desc.c16
-rw-r--r--opcodes/ip2k-desc.c16
-rw-r--r--opcodes/iq2000-desc.c16
-rw-r--r--opcodes/lm32-desc.c16
-rw-r--r--opcodes/m32c-desc.c16
-rw-r--r--opcodes/m32r-desc.c16
-rw-r--r--opcodes/mep-asm.c3
-rw-r--r--opcodes/mep-desc.c16
-rw-r--r--opcodes/mt-desc.c16
-rw-r--r--opcodes/or1k-desc.c16
-rw-r--r--opcodes/sparc-dis.c3
-rw-r--r--opcodes/tic4x-dis.c14
-rw-r--r--opcodes/xc16x-desc.c16
-rw-r--r--opcodes/xstormy16-desc.c16
-rw-r--r--opcodes/xtensa-dis.c6
22 files changed, 94 insertions, 196 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index ef6d49a..f791c00 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -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
diff --git a/cpu/mep.opc b/cpu/mep.opc
index 7ed3ea8..34e279d 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 d788d8c..3e66569 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -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
diff --git a/opcodes/arc-ext.c b/opcodes/arc-ext.c
index 40caef9..dc90777 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 113f545..d2803f0 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 af5394e..3776ebb 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 3ac7e2b..5fe16b7 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 d10b935..869237e6 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 cf33c4f..9e5cf6c 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 f9f6beb..b148427 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 f3db0dd..7470c3f 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 9c4fec4..d79d2f4 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 e24bb74..142cea3 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 28085aa..c5c3307 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 b776817..305f744 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 85ef444..ca1f50c 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 7497619..8bf986d 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 c825c86..c9667f1 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 a99b52a..683f22e 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 b2c0424..621f2eb 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 02a4e89..c1669c0 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 a7f8d2b..6b6baf6 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 =