Remove "memory exhausted" messages

Alan Modra amodra@gmail.com
Mon Aug 24 03:58:42 GMT 2020


Since we use xcalloc to set up hash table memory, htab_create won't
ever return a failure.

	* config/tc-aarch64.c (md_begin): Don't bother checking for
	out of memory failure from str_htab_create.
	* config/tc-arc.c (arc_insert_opcode, md_begin): Likewise.
	(arc_extcorereg, arc_stralloc): Likewise.
	* config/tc-arm.c (md_begin): Likewise.
	* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
	* config/tc-cris.c (md_begin): Likewise.
	* config/tc-crx.c (md_begin): Likewise.
	* config/tc-pdp11.c (md_begin): Likewise.
	* config/tc-score.c (s3_build_reg_hsh, s3_begin): Likewise.
	* config/tc-score7.c (s7_build_reg_hsh, s7_begin): Likewise.

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 238792758d..db5edcb3dc 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -8686,22 +8686,21 @@ md_begin (void)
   unsigned mach;
   unsigned int i;
 
-  if ((aarch64_ops_hsh = str_htab_create ()) == NULL
-      || (aarch64_cond_hsh = str_htab_create ()) == NULL
-      || (aarch64_shift_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_hsh = str_htab_create ()) == NULL
-      || (aarch64_pstatefield_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_ic_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_dc_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_at_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_tlbi_hsh = str_htab_create ()) == NULL
-      || (aarch64_sys_regs_sr_hsh = str_htab_create ()) == NULL
-      || (aarch64_reg_hsh = str_htab_create ()) == NULL
-      || (aarch64_barrier_opt_hsh = str_htab_create ()) == NULL
-      || (aarch64_nzcv_hsh = str_htab_create ()) == NULL
-      || (aarch64_pldop_hsh = str_htab_create ()) == NULL
-      || (aarch64_hint_opt_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  aarch64_ops_hsh = str_htab_create ();
+  aarch64_cond_hsh = str_htab_create ();
+  aarch64_shift_hsh = str_htab_create ();
+  aarch64_sys_regs_hsh = str_htab_create ();
+  aarch64_pstatefield_hsh = str_htab_create ();
+  aarch64_sys_regs_ic_hsh = str_htab_create ();
+  aarch64_sys_regs_dc_hsh = str_htab_create ();
+  aarch64_sys_regs_at_hsh = str_htab_create ();
+  aarch64_sys_regs_tlbi_hsh = str_htab_create ();
+  aarch64_sys_regs_sr_hsh = str_htab_create ();
+  aarch64_reg_hsh = str_htab_create ();
+  aarch64_barrier_opt_hsh = str_htab_create ();
+  aarch64_nzcv_hsh = str_htab_create ();
+  aarch64_pldop_hsh = str_htab_create ();
+  aarch64_hint_opt_hsh = str_htab_create ();
 
   fill_instruction_hash_table ();
 
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 36a0898088..32369a56a1 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -772,9 +772,6 @@ arc_insert_opcode (const struct arc_opcode *opcode)
   entry->opcode = XRESIZEVEC (const struct arc_opcode *, entry->opcode,
 			      entry->count + 1);
 
-  if (entry->opcode == NULL)
-    as_fatal (_("Virtual memory exhausted"));
-
   entry->opcode[entry->count] = opcode;
   entry->count++;
 }
@@ -2611,8 +2608,6 @@ md_begin (void)
 
   /* Set up a hash table for the instructions.  */
   arc_opcode_hash = str_htab_create ();
-  if (arc_opcode_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   /* Initialize the hash table with the insns.  */
   do
@@ -2629,8 +2624,6 @@ md_begin (void)
 
   /* Register declaration.  */
   arc_reg_hash = str_htab_create ();
-  if (arc_reg_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   declare_register_set ();
   declare_register ("gp", 26);
@@ -2682,8 +2675,6 @@ md_begin (void)
 
   /* Aux register declaration.  */
   arc_aux_hash = str_htab_create ();
-  if (arc_aux_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   const struct arc_aux_reg *auxr = &arc_aux_regs[0];
   unsigned int i;
@@ -2702,8 +2693,6 @@ md_begin (void)
 
   /* Address type declaration.  */
   arc_addrtype_hash = str_htab_create ();
-  if (arc_addrtype_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   declare_addrtype ("bd", ARC_NPS400_ADDRTYPE_BD);
   declare_addrtype ("jid", ARC_NPS400_ADDRTYPE_JID);
@@ -4904,8 +4893,6 @@ arc_extcorereg (int opertype)
       ext_condcode.arc_ext_condcode =
 	XRESIZEVEC (struct arc_flag_operand, ext_condcode.arc_ext_condcode,
 		    ext_condcode.size + 1);
-      if (ext_condcode.arc_ext_condcode == NULL)
-	as_fatal (_("Virtual memory exhausted"));
 
       ccode = ext_condcode.arc_ext_condcode + ext_condcode.size - 1;
       ccode->name   = ereg.name;
@@ -4971,8 +4958,6 @@ arc_stralloc (char * s1, const char * s2)
   len += strlen (s2) + 1;
 
   p = (char *) xmalloc (len);
-  if (p == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   if (s1)
     {
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 3eb7e9640a..1cc0cea25e 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -30717,16 +30717,15 @@ md_begin (void)
   unsigned mach;
   unsigned int i;
 
-  if (	 (arm_ops_hsh = str_htab_create ()) == NULL
-      || (arm_cond_hsh = str_htab_create ()) == NULL
-      || (arm_vcond_hsh = str_htab_create ()) == NULL
-      || (arm_shift_hsh = str_htab_create ()) == NULL
-      || (arm_psr_hsh = str_htab_create ()) == NULL
-      || (arm_v7m_psr_hsh = str_htab_create ()) == NULL
-      || (arm_reg_hsh = str_htab_create ()) == NULL
-      || (arm_reloc_hsh = str_htab_create ()) == NULL
-      || (arm_barrier_opt_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  arm_ops_hsh = str_htab_create ();
+  arm_cond_hsh = str_htab_create ();
+  arm_vcond_hsh = str_htab_create ();
+  arm_shift_hsh = str_htab_create ();
+  arm_psr_hsh = str_htab_create ();
+  arm_v7m_psr_hsh = str_htab_create ();
+  arm_reg_hsh = str_htab_create ();
+  arm_reloc_hsh = str_htab_create ();
+  arm_barrier_opt_hsh = str_htab_create ();
 
   for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++)
     if (str_hash_find (arm_ops_hsh, insns[i].template_name) == NULL)
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index c0627ff488..e85e5fa82f 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -801,8 +801,6 @@ initialise_reg_hash_table (htab_t *hash_table,
   const reg_entry *rreg;
 
   *hash_table = str_htab_create ();
-  if (*hash_table == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   for (rreg = register_table;
        rreg < (register_table + num_entries);
@@ -820,8 +818,7 @@ md_begin (void)
   int i = 0;
 
   /* Set up a hash table for the instructions.  */
-  if ((cr16_inst_hash = str_htab_create ()) == NULL)
-    as_fatal (_("Virtual memory exhausted"));
+  cr16_inst_hash = str_htab_create ();
 
   while (cr16_instruction[i].mnemonic != NULL)
     {
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 873f28bd71..92cb64af89 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -1190,8 +1190,6 @@ md_begin (void)
 
   /* Set up a hash table for the instructions.  */
   op_hash = str_htab_create ();
-  if (op_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   /* Enable use of ".if ..asm.arch.cris.v32"
      and ".if ..asm.arch.cris.common_v10_v32" and a few others.  */
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index 10f3880c60..03a5e6e322 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -530,8 +530,7 @@ md_begin (void)
   int i = 0;
 
   /* Set up a hash table for the instructions.  */
-  if ((crx_inst_hash = str_htab_create ()) == NULL)
-    as_fatal (_("Virtual memory exhausted"));
+  crx_inst_hash = str_htab_create ();
 
   while (crx_instruction[i].mnemonic != NULL)
     {
@@ -553,9 +552,7 @@ md_begin (void)
     }
 
   /* Initialize reg_hash hash table.  */
-  if ((reg_hash = str_htab_create ()) == NULL)
-    as_fatal (_("Virtual memory exhausted"));
-
+  reg_hash = str_htab_create ();
   {
     const reg_entry *regtab;
 
@@ -566,9 +563,7 @@ md_begin (void)
   }
 
   /* Initialize copreg_hash hash table.  */
-  if ((copreg_hash = str_htab_create ()) == NULL)
-    as_fatal (_("Virtual memory exhausted"));
-
+  copreg_hash = str_htab_create ();
   {
     const reg_entry *copregtab;
 
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 9a24978724..1230daee34 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -189,8 +189,6 @@ md_begin (void)
   init_defaults ();
 
   insn_hash = str_htab_create ();
-  if (insn_hash == NULL)
-    as_fatal (_("Virtual memory exhausted"));
 
   for (i = 0; i < pdp11_num_opcodes; i++)
     str_hash_insert (insn_hash, pdp11_opcodes[i].name, pdp11_opcodes + i, 0);
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 739df15841..e4b4934ff8 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -6277,14 +6277,9 @@ s3_build_reg_hsh (struct s3_reg_map *map)
 {
   const struct s3_reg_entry *r;
 
-  if ((map->htab = str_htab_create ()) == NULL)
-    {
-      as_fatal (_("virtual memory exhausted"));
-    }
+  map->htab = str_htab_create ();
   for (r = map->names; r->name != NULL; r++)
-    {
-      s3_insert_reg (r, map->htab);
-    }
+    s3_insert_reg (r, map->htab);
 }
 
 /* Iterate over the base tables to create the instruction patterns.  */
@@ -6507,13 +6502,11 @@ s3_begin (void)
   segT seg;
   subsegT subseg;
 
-  if ((s3_score_ops_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s3_score_ops_hsh = str_htab_create ();
 
   s3_build_score_ops_hsh ();
 
-  if ((s3_dependency_insn_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s3_dependency_insn_hsh = str_htab_create ();
 
   s3_build_dependency_insn_hsh ();
 
diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c
index aba8b6c9ab..bd4923a258 100644
--- a/gas/config/tc-score7.c
+++ b/gas/config/tc-score7.c
@@ -5369,14 +5369,9 @@ s7_build_reg_hsh (struct s7_reg_map *map)
 {
   const struct s7_reg_entry *r;
 
-  if ((map->htab = str_htab_create ()) == NULL)
-    {
-      as_fatal (_("virtual memory exhausted"));
-    }
+  map->htab = str_htab_create ();
   for (r = map->names; r->name != NULL; r++)
-    {
-      s7_insert_reg (r, map->htab);
-    }
+    s7_insert_reg (r, map->htab);
 }
 
 
@@ -6116,13 +6111,11 @@ s7_begin (void)
   segT seg;
   subsegT subseg;
 
-  if ((s7_score_ops_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s7_score_ops_hsh = str_htab_create ();
 
   s7_build_score_ops_hsh ();
 
-  if ((s7_dependency_insn_hsh = str_htab_create ()) == NULL)
-    as_fatal (_("virtual memory exhausted"));
+  s7_dependency_insn_hsh = str_htab_create ();
 
   s7_build_dependency_insn_hsh ();
 

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list