[gcc(refs/users/mikael/heads/refactor_descriptor_v291 .01)] Déplacement gfc_init_static_descriptor

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:df25c9c8e718ffd032390f3d279757e191b49849

commit df25c9c8e718ffd032390f3d279757e191b49849
Author: Mikael Morin <[email protected]>
Date:   Fri Jul 24 17:25:00 2026 +0200

    Déplacement gfc_init_static_descriptor

Diff:
---
 gcc/fortran/trans-descriptor.cc | 72 ++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index d4018860828a..9608fff9a56c 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -717,6 +717,42 @@ gfc_build_null_descriptor (tree type)
 }
 
 
+void
+gfc_init_static_descriptor (gfc_symbol *sym)
+{
+  vec<constructor_elt, va_gc> *v = NULL;
+
+  tree descr = sym->backend_decl;
+  tree type = TREE_TYPE (descr);
+
+  gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
+  tree fields = TYPE_FIELDS (type);
+
+  tree data_field = gfc_advance_chain (fields, DATA_FIELD);
+  CONSTRUCTOR_APPEND_ELT (v, data_field,
+			  fold_convert (TREE_TYPE (data_field),
+					null_pointer_node));
+
+  gfc_array_spec *as;
+  if (sym->ts.type == BT_CLASS)
+    as = CLASS_DATA (sym)->as;
+  else
+    as = sym->as;
+
+  int rank = as ? as->rank : 0;
+  tree dtype_field = gfc_advance_chain (fields, DTYPE_FIELD);
+  tree dtype_value = gfc_get_dtype_rank_type (rank,
+					      gfc_get_element_type (type));
+  CONSTRUCTOR_APPEND_ELT (v, dtype_field,
+			  fold_convert (TREE_TYPE (dtype_field), dtype_value));
+
+  tree constr = build_constructor (type, v);
+  TREE_CONSTANT (constr) = 1;
+
+  DECL_INITIAL (descr) = constr;
+}
+
+
 /* Cleanup those #defines.  */
 
 #undef DATA_FIELD
@@ -979,42 +1015,6 @@ gfc_init_absent_descriptor (stmtblock_t *block, tree descr)
 }
 
 
-void
-gfc_init_static_descriptor (gfc_symbol *sym)
-{
-  vec<constructor_elt, va_gc> *v = NULL;
-
-  tree descr = sym->backend_decl;
-  tree type = TREE_TYPE (descr);
-
-  gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-  tree fields = TYPE_FIELDS (type);
-
-  tree data_field = gfc_advance_chain (fields, DATA_FIELD);
-  CONSTRUCTOR_APPEND_ELT (v, data_field,
-			  fold_convert (TREE_TYPE (data_field),
-					null_pointer_node));
-
-  gfc_array_spec *as;
-  if (sym->ts.type == BT_CLASS)
-    as = CLASS_DATA (sym)->as;
-  else
-    as = sym->as;
-
-  int rank = as ? as->rank : 0;
-  tree dtype_field = gfc_advance_chain (fields, DTYPE_FIELD);
-  tree dtype_value = gfc_get_dtype_rank_type (rank,
-					      gfc_get_element_type (type));
-  CONSTRUCTOR_APPEND_ELT (v, dtype_field,
-			  fold_convert (TREE_TYPE (dtype_field), dtype_value));
-
-  tree constr = build_constructor (type, v);
-  TREE_CONSTANT (constr) = 1;
-
-  DECL_INITIAL (descr) = constr;
-}
-
-
 void
 gfc_nullify_descriptor (stmtblock_t *block, gfc_symbol *sym, gfc_expr *expr,
 			tree descr, tree string_length)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.