diff mbox

Use gfc_add_*_component defines where appropriate

Message ID 1448974501-30981-1-git-send-email-rep.dot.nop@gmail.com
State New
Headers show

Commit Message

Bernhard Reutner-Fischer Dec. 1, 2015, 12:54 p.m. UTC
A couple of places used gfc_add_component_ref(expr, "string") instead of
the defines from gfortran.h

Regstrapped without regressions, ok for trunk stage3 now / next stage1?

gcc/fortran/ChangeLog

2015-11-29  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

        * class.c (gfc_add_class_array_ref): Call gfc_add_data_component()
        instead of gfc_add_component_ref().
        (gfc_get_len_component): Call gfc_add_len_component() instead of
        gfc_add_component_ref().
        * trans-intrinsic.c (gfc_conv_intrinsic_loc): Call
        gfc_add_data_component() instead of gfc_add_component_ref().
        * trans.c (gfc_add_finalizer_call): Call
        gfc_add_final_component() and gfc_add_size_component() instead
        of gfc_add_component_ref.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 gcc/fortran/class.c           | 4 ++--
 gcc/fortran/trans-intrinsic.c | 2 +-
 gcc/fortran/trans.c           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Bernhard Reutner-Fischer June 18, 2016, 7:47 p.m. UTC | #1
Ping.

On December 1, 2015 1:54:58 PM GMT+01:00, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
>A couple of places used gfc_add_component_ref(expr, "string") instead
>of
>the defines from gfortran.h
>
>Regstrapped without regressions, ok for trunk stage3 now / next stage1?
>
>gcc/fortran/ChangeLog
>
>2015-11-29  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
>
>     * class.c (gfc_add_class_array_ref): Call gfc_add_data_component()
>        instead of gfc_add_component_ref().
>       (gfc_get_len_component): Call gfc_add_len_component() instead of
>        gfc_add_component_ref().
>        * trans-intrinsic.c (gfc_conv_intrinsic_loc): Call
>        gfc_add_data_component() instead of gfc_add_component_ref().
>        * trans.c (gfc_add_finalizer_call): Call
>        gfc_add_final_component() and gfc_add_size_component() instead
>        of gfc_add_component_ref.
>
>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>---
> gcc/fortran/class.c           | 4 ++--
> gcc/fortran/trans-intrinsic.c | 2 +-
> gcc/fortran/trans.c           | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
>index 8b49ae9..027cb89 100644
>--- a/gcc/fortran/class.c
>+++ b/gcc/fortran/class.c
>@@ -258,7 +258,7 @@ gfc_add_class_array_ref (gfc_expr *e)
>   int rank = CLASS_DATA (e)->as->rank;
>   gfc_array_spec *as = CLASS_DATA (e)->as;
>   gfc_ref *ref = NULL;
>-  gfc_add_component_ref (e, "_data");
>+  gfc_add_data_component (e);
>   e->rank = rank;
>   for (ref = e->ref; ref; ref = ref->next)
>     if (!ref->next)
>@@ -584,7 +584,7 @@ gfc_get_len_component (gfc_expr *e)
>       ref = ref->next;
>     }
>   /* And replace if with a ref to the _len component.  */
>-  gfc_add_component_ref (ptr, "_len");
>+  gfc_add_len_component (ptr);
>   return ptr;
> }
> 
>diff --git a/gcc/fortran/trans-intrinsic.c
>b/gcc/fortran/trans-intrinsic.c
>index 1dabc26..2ef0709 100644
>--- a/gcc/fortran/trans-intrinsic.c
>+++ b/gcc/fortran/trans-intrinsic.c
>@@ -7112,7 +7112,7 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr *
>expr)
>   if (arg_expr->rank == 0)
>     {
>       if (arg_expr->ts.type == BT_CLASS)
>-	gfc_add_component_ref (arg_expr, "_data");
>+	gfc_add_data_component (arg_expr);
>       gfc_conv_expr_reference (se, arg_expr);
>     }
>   else
>diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
>index 2a91c35..14dad0f 100644
>--- a/gcc/fortran/trans.c
>+++ b/gcc/fortran/trans.c
>@@ -1132,11 +1132,11 @@ gfc_add_finalizer_call (stmtblock_t *block,
>gfc_expr *expr2)
> 
>       final_expr = gfc_copy_expr (expr);
>       gfc_add_vptr_component (final_expr);
>-      gfc_add_component_ref (final_expr, "_final");
>+      gfc_add_final_component (final_expr);
> 
>       elem_size = gfc_copy_expr (expr);
>       gfc_add_vptr_component (elem_size);
>-      gfc_add_component_ref (elem_size, "_size");
>+      gfc_add_size_component (elem_size);
>     }
> 
>   gcc_assert (final_expr->expr_type == EXPR_VARIABLE);
Paul Richard Thomas June 19, 2016, 9:18 a.m. UTC | #2
Hi Bernhard,

Thanks for doing some of this tidying up. The patch is OK to commit on
both trunk and 6-branch. It might be worth going back to 5-branch as
well, if you feel up to it.

Cheers

Paul

On 18 June 2016 at 21:47, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
> Ping.
>
> On December 1, 2015 1:54:58 PM GMT+01:00, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
>>A couple of places used gfc_add_component_ref(expr, "string") instead
>>of
>>the defines from gfortran.h
>>
>>Regstrapped without regressions, ok for trunk stage3 now / next stage1?
>>
>>gcc/fortran/ChangeLog
>>
>>2015-11-29  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
>>
>>     * class.c (gfc_add_class_array_ref): Call gfc_add_data_component()
>>        instead of gfc_add_component_ref().
>>       (gfc_get_len_component): Call gfc_add_len_component() instead of
>>        gfc_add_component_ref().
>>        * trans-intrinsic.c (gfc_conv_intrinsic_loc): Call
>>        gfc_add_data_component() instead of gfc_add_component_ref().
>>        * trans.c (gfc_add_finalizer_call): Call
>>        gfc_add_final_component() and gfc_add_size_component() instead
>>        of gfc_add_component_ref.
>>
>>Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>>---
>> gcc/fortran/class.c           | 4 ++--
>> gcc/fortran/trans-intrinsic.c | 2 +-
>> gcc/fortran/trans.c           | 4 ++--
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>>
>>diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
>>index 8b49ae9..027cb89 100644
>>--- a/gcc/fortran/class.c
>>+++ b/gcc/fortran/class.c
>>@@ -258,7 +258,7 @@ gfc_add_class_array_ref (gfc_expr *e)
>>   int rank = CLASS_DATA (e)->as->rank;
>>   gfc_array_spec *as = CLASS_DATA (e)->as;
>>   gfc_ref *ref = NULL;
>>-  gfc_add_component_ref (e, "_data");
>>+  gfc_add_data_component (e);
>>   e->rank = rank;
>>   for (ref = e->ref; ref; ref = ref->next)
>>     if (!ref->next)
>>@@ -584,7 +584,7 @@ gfc_get_len_component (gfc_expr *e)
>>       ref = ref->next;
>>     }
>>   /* And replace if with a ref to the _len component.  */
>>-  gfc_add_component_ref (ptr, "_len");
>>+  gfc_add_len_component (ptr);
>>   return ptr;
>> }
>>
>>diff --git a/gcc/fortran/trans-intrinsic.c
>>b/gcc/fortran/trans-intrinsic.c
>>index 1dabc26..2ef0709 100644
>>--- a/gcc/fortran/trans-intrinsic.c
>>+++ b/gcc/fortran/trans-intrinsic.c
>>@@ -7112,7 +7112,7 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr *
>>expr)
>>   if (arg_expr->rank == 0)
>>     {
>>       if (arg_expr->ts.type == BT_CLASS)
>>-      gfc_add_component_ref (arg_expr, "_data");
>>+      gfc_add_data_component (arg_expr);
>>       gfc_conv_expr_reference (se, arg_expr);
>>     }
>>   else
>>diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
>>index 2a91c35..14dad0f 100644
>>--- a/gcc/fortran/trans.c
>>+++ b/gcc/fortran/trans.c
>>@@ -1132,11 +1132,11 @@ gfc_add_finalizer_call (stmtblock_t *block,
>>gfc_expr *expr2)
>>
>>       final_expr = gfc_copy_expr (expr);
>>       gfc_add_vptr_component (final_expr);
>>-      gfc_add_component_ref (final_expr, "_final");
>>+      gfc_add_final_component (final_expr);
>>
>>       elem_size = gfc_copy_expr (expr);
>>       gfc_add_vptr_component (elem_size);
>>-      gfc_add_component_ref (elem_size, "_size");
>>+      gfc_add_size_component (elem_size);
>>     }
>>
>>   gcc_assert (final_expr->expr_type == EXPR_VARIABLE);
>
>
Bernhard Reutner-Fischer June 19, 2016, 10:39 a.m. UTC | #3
On Sun, Jun 19, 2016 at 11:18:08AM +0200, Paul Richard Thomas wrote:
> Hi Bernhard,
> 
> Thanks for doing some of this tidying up. The patch is OK to commit on
> both trunk and 6-branch. It might be worth going back to 5-branch as
> well, if you feel up to it.

Applied to trunk as r237580 so far.

thanks,
diff mbox

Patch

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 8b49ae9..027cb89 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -258,7 +258,7 @@  gfc_add_class_array_ref (gfc_expr *e)
   int rank = CLASS_DATA (e)->as->rank;
   gfc_array_spec *as = CLASS_DATA (e)->as;
   gfc_ref *ref = NULL;
-  gfc_add_component_ref (e, "_data");
+  gfc_add_data_component (e);
   e->rank = rank;
   for (ref = e->ref; ref; ref = ref->next)
     if (!ref->next)
@@ -584,7 +584,7 @@  gfc_get_len_component (gfc_expr *e)
       ref = ref->next;
     }
   /* And replace if with a ref to the _len component.  */
-  gfc_add_component_ref (ptr, "_len");
+  gfc_add_len_component (ptr);
   return ptr;
 }
 
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 1dabc26..2ef0709 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -7112,7 +7112,7 @@  gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr * expr)
   if (arg_expr->rank == 0)
     {
       if (arg_expr->ts.type == BT_CLASS)
-	gfc_add_component_ref (arg_expr, "_data");
+	gfc_add_data_component (arg_expr);
       gfc_conv_expr_reference (se, arg_expr);
     }
   else
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 2a91c35..14dad0f 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1132,11 +1132,11 @@  gfc_add_finalizer_call (stmtblock_t *block, gfc_expr *expr2)
 
       final_expr = gfc_copy_expr (expr);
       gfc_add_vptr_component (final_expr);
-      gfc_add_component_ref (final_expr, "_final");
+      gfc_add_final_component (final_expr);
 
       elem_size = gfc_copy_expr (expr);
       gfc_add_vptr_component (elem_size);
-      gfc_add_component_ref (elem_size, "_size");
+      gfc_add_size_component (elem_size);
     }
 
   gcc_assert (final_expr->expr_type == EXPR_VARIABLE);