[FORTRAN,07/29] Use stringpool for some gfc_code2string return values
diff mbox series

Message ID 20180905145732.404-8-rep.dot.nop@gmail.com
State New
Headers show
Series
  • [FORTRAN,01/29] gdbinit: break on gfc_internal_error
Related show

Commit Message

Bernhard Reutner-Fischer Sept. 5, 2018, 2:57 p.m. UTC
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

Use a stringpool-node for those gfc_code2string values that are used as
names.

gcc/fortran/ChangeLog:

2017-10-26  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* interface.c (gfc_match_generic_spec, gfc_check_dtio_interfaces,
	gfc_find_typebound_dtio_proc, gfc_find_specific_dtio_proc): Use
	stringpool node for those return values of gfc_code2string that
	are used as names.
---
 gcc/fortran/interface.c | 50 ++++++++++++++++-------------------------
 1 file changed, 19 insertions(+), 31 deletions(-)

Patch
diff mbox series

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 19a0eb28edd..8716813b7b2 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -182,12 +182,12 @@  gfc_match_generic_spec (interface_type *type,
       *op = dtio_op (name);
       if (*op == INTRINSIC_FORMATTED)
 	{
-	  name = gfc_code2string (dtio_procs, DTIO_RF);
+	  name = gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RF));
 	  *type = INTERFACE_DTIO;
 	}
       if (*op == INTRINSIC_UNFORMATTED)
 	{
-	  name = gfc_code2string (dtio_procs, DTIO_RUF);
+	  name = gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RUF));
 	  *type = INTERFACE_DTIO;
 	}
       if (*op != INTRINSIC_NONE)
@@ -199,12 +199,12 @@  gfc_match_generic_spec (interface_type *type,
       *op = dtio_op (name);
       if (*op == INTRINSIC_FORMATTED)
 	{
-	  name = gfc_code2string (dtio_procs, DTIO_WF);
+	  name = gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WF));
 	  *type = INTERFACE_DTIO;
 	}
       if (*op == INTRINSIC_UNFORMATTED)
 	{
-	  name = gfc_code2string (dtio_procs, DTIO_WUF);
+	  name = gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WUF));
 	  *type = INTERFACE_DTIO;
 	}
       if (*op != INTRINSIC_NONE)
@@ -4927,8 +4927,8 @@  gfc_check_dtio_interfaces (gfc_symbol *derived)
 		   || ((dtio_codes)code == DTIO_WF);
 
       tb_io_st = gfc_find_typebound_proc (derived, &t,
-					  gfc_code2string (dtio_procs, code),
-					  true, &derived->declared_at);
+	  gfc_get_string ("%s", gfc_code2string (dtio_procs, code)),
+	  true, &derived->declared_at);
       if (tb_io_st != NULL)
 	check_dtio_interface1 (derived, tb_io_st, true, formatted, code);
     }
@@ -4940,7 +4940,7 @@  gfc_check_dtio_interfaces (gfc_symbol *derived)
 		   || ((dtio_codes)code == DTIO_WF);
 
       tb_io_st = gfc_find_symtree (derived->ns->sym_root,
-				   gfc_code2string (dtio_procs, code));
+	  gfc_get_string ("%s", gfc_code2string (dtio_procs, code)));
       if (tb_io_st != NULL)
 	check_dtio_interface1 (derived, tb_io_st, false, formatted, code);
     }
@@ -4961,31 +4961,23 @@  gfc_find_typebound_dtio_proc (gfc_symbol *derived, bool write, bool formatted)
     {
       if (write == true)
         tb_io_st = gfc_find_typebound_proc (derived, &t,
-					    gfc_code2string (dtio_procs,
-							     DTIO_WF),
-					    true,
-					    &derived->declared_at);
+	    gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WF)),
+	    true, &derived->declared_at);
       else
         tb_io_st = gfc_find_typebound_proc (derived, &t,
-					    gfc_code2string (dtio_procs,
-							     DTIO_RF),
-					    true,
-					    &derived->declared_at);
+	    gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RF)),
+	    true, &derived->declared_at);
     }
   else
     {
       if (write == true)
         tb_io_st = gfc_find_typebound_proc (derived, &t,
-					    gfc_code2string (dtio_procs,
-							     DTIO_WUF),
-					    true,
-					    &derived->declared_at);
+	    gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WUF)),
+	    true, &derived->declared_at);
       else
         tb_io_st = gfc_find_typebound_proc (derived, &t,
-					    gfc_code2string (dtio_procs,
-							     DTIO_RUF),
-					    true,
-					    &derived->declared_at);
+	    gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RUF)),
+	    true, &derived->declared_at);
     }
   return tb_io_st;
 }
@@ -5041,23 +5033,19 @@  gfc_find_specific_dtio_proc (gfc_symbol *derived, bool write, bool formatted)
 	{
 	  if (write == true)
 	    tb_io_st = gfc_find_symtree (extended->ns->sym_root,
-					 gfc_code2string (dtio_procs,
-							  DTIO_WF));
+		gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WF)));
 	  else
 	    tb_io_st = gfc_find_symtree (extended->ns->sym_root,
-					 gfc_code2string (dtio_procs,
-							  DTIO_RF));
+		gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RF)));
 	}
       else
 	{
 	  if (write == true)
 	    tb_io_st = gfc_find_symtree (extended->ns->sym_root,
-					 gfc_code2string (dtio_procs,
-							  DTIO_WUF));
+		gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_WUF)));
 	  else
 	    tb_io_st = gfc_find_symtree (extended->ns->sym_root,
-					 gfc_code2string (dtio_procs,
-							  DTIO_RUF));
+		gfc_get_string ("%s", gfc_code2string (dtio_procs, DTIO_RUF)));
 	}
 
       if (tb_io_st != NULL