]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: make some trans* functions static
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Sun, 24 Oct 2021 19:04:44 +0000 (21:04 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Wed, 27 Oct 2021 19:17:44 +0000 (21:17 +0200)
This makes some trans* functions static and deletes declarations of
functions that either do not exist anymore like gfc_get_function_decl
or that are unused like gfc_check_any_c_kind.

gcc/fortran/ChangeLog:

* expr.c (is_non_empty_structure_constructor): Make static.
* gfortran.h (gfc_check_any_c_kind): Delete.
* match.c (gfc_match_label): Make static.
* match.h (gfc_match_label): Delete declaration.
* scanner.c (file_changes_cur, file_changes_count,
file_changes_allocated): Make static.
* trans-expr.c (gfc_get_character_len): Make static.
(gfc_class_len_or_zero_get): Make static.
(VTAB_GET_FIELD_GEN): Undefine.
(gfc_get_class_array_ref): Make static.
(gfc_finish_interface_mapping): Make static.
* trans-types.c (gfc_check_any_c_kind): Delete.
(pfunc_type_node, dtype_type_node, gfc_get_ppc_type): Make static.
* trans-types.h (gfc_get_ppc_type): Delete declaration.
* trans.c (gfc_msg_wrong_return): Delete.
* trans.h (gfc_class_len_or_zero_get, gfc_class_vtab_extends_get,
gfc_vptr_extends_get, gfc_get_class_array_ref, gfc_get_character_len,
gfc_finish_interface_mapping, gfc_msg_wrong_return,
gfc_get_function_decl): Delete declaration.

gcc/fortran/expr.c
gcc/fortran/gfortran.h
gcc/fortran/match.c
gcc/fortran/match.h
gcc/fortran/scanner.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-types.c
gcc/fortran/trans-types.h
gcc/fortran/trans.c
gcc/fortran/trans.h

index b19d3a26c605e78bb777f8c2a1c4a0e0c921b745..4dea840e3486a834d76a65d8c5cd2d41ff710911 100644 (file)
@@ -4817,7 +4817,7 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init)
 /* Check whether an expression is a structure constructor and whether it has
    other values than NULL.  */
 
-bool
+static bool
 is_non_empty_structure_constructor (gfc_expr * e)
 {
   if (e->expr_type != EXPR_STRUCTURE)
index 66192c07d8c8b215725307287555fc75f2b74f5b..f7662c59a5df2a85b5cb90d42cab01e8ecb060e8 100644 (file)
@@ -3284,7 +3284,6 @@ bool gfc_check_character_range (gfc_char_t, int);
 extern bool gfc_seen_div0;
 
 /* trans-types.c */
-bool gfc_check_any_c_kind (gfc_typespec *);
 int gfc_validate_kind (bt, int, bool);
 int gfc_get_int_kind_from_width_isofortranenv (int size);
 int gfc_get_real_kind_from_width_isofortranenv (int size);
index 53a575e616e2c5a184cc120d894f8e361e55205a..91cde55d7a18cfeebb5385866c47d23ce4eaeb12 100644 (file)
@@ -599,7 +599,7 @@ cleanup:
    it.  We also make sure the symbol does not refer to another
    (active) block.  A matched label is pointed to by gfc_new_block.  */
 
-match
+static match
 gfc_match_label (void)
 {
   char name[GFC_MAX_SYMBOL_LEN + 1];
index 21e94f79d9502da0dcc9fa406e4add8adc495420..eb9459ea99ca74707b4478280313eb23ee297084 100644 (file)
@@ -47,7 +47,6 @@ match gfc_match_space (void);
 match gfc_match_eos (void);
 match gfc_match_small_literal_int (int *, int *);
 match gfc_match_st_label (gfc_st_label **);
-match gfc_match_label (void);
 match gfc_match_small_int (int *);
 match gfc_match_small_int_expr (int *, gfc_expr **);
 match gfc_match_name (char *);
index 5a450692ba3958712fad203e387f35b897e0f98e..69b81ab97f8f04f7bec7972e4243d7be08847ba9 100644 (file)
@@ -78,8 +78,8 @@ static struct gfc_file_change
   gfc_linebuf *lb;
   int line;
 } *file_changes;
-size_t file_changes_cur, file_changes_count;
-size_t file_changes_allocated;
+static size_t file_changes_cur, file_changes_count;
+static size_t file_changes_allocated;
 
 static gfc_char_t *last_error_char;
 
index 2d7f9e0fb91a7dc1a28609dce284ffff77aff90f..e7aec3845d3db3ddaf0eedbeee9a6c3b4ef826be 100644 (file)
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Calculate the number of characters in a string.  */
 
-tree
+static tree
 gfc_get_character_len (tree type)
 {
   tree len;
@@ -278,7 +278,7 @@ gfc_class_len_get (tree decl)
 /* Try to get the _len component of a class.  When the class is not unlimited
    poly, i.e. no _len field exists, then return a zero node.  */
 
-tree
+static tree
 gfc_class_len_or_zero_get (tree decl)
 {
   tree len;
@@ -382,7 +382,7 @@ VTAB_GET_FIELD_GEN (def_init, VTABLE_DEF_INIT_FIELD)
 VTAB_GET_FIELD_GEN (copy, VTABLE_COPY_FIELD)
 VTAB_GET_FIELD_GEN (final, VTABLE_FINAL_FIELD)
 VTAB_GET_FIELD_GEN (deallocate, VTABLE_DEALLOCATE_FIELD)
-
+#undef VTAB_GET_FIELD_GEN
 
 /* The size field is returned as an array index type.  Therefore treat
    it and only it specially.  */
@@ -1367,7 +1367,7 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
 /* Given a class array declaration and an index, returns the address
    of the referenced element.  */
 
-tree
+static tree
 gfc_get_class_array_ref (tree index, tree class_decl, tree data_comp,
                         bool unlimited)
 {
@@ -4531,7 +4531,7 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
    the length of each argument, adding any initialization code to PRE and
    any finalization code to POST.  */
 
-void
+static void
 gfc_finish_interface_mapping (gfc_interface_mapping * mapping,
                              stmtblock_t * pre, stmtblock_t * post)
 {
index 42778067dbeb55950d7e5f60dbcd9affb13b210b..947ab5a099b32207afc24be12b7c87c8c1d3a606 100644 (file)
@@ -61,7 +61,7 @@ tree pvoid_type_node;
 tree prvoid_type_node;
 tree ppvoid_type_node;
 tree pchar_type_node;
-tree pfunc_type_node;
+static tree pfunc_type_node;
 
 tree logical_type_node;
 tree logical_true_node;
@@ -133,7 +133,7 @@ int gfc_size_kind;
 int gfc_numeric_storage_size;
 int gfc_character_storage_size;
 
-tree dtype_type_node = NULL_TREE;
+static tree dtype_type_node = NULL_TREE;
 
 
 /* Build the dtype_type_node if necessary.  */
@@ -175,25 +175,6 @@ tree get_dtype_type_node (void)
   return dtype_type_node;
 }
 
-bool
-gfc_check_any_c_kind (gfc_typespec *ts)
-{
-  int i;
-
-  for (i = 0; i < ISOCBINDING_NUMBER; i++)
-    {
-      /* Check for any C interoperable kind for the given type/kind in ts.
-         This can be used after verify_c_interop to make sure that the
-         Fortran kind being used exists in at least some form for C.  */
-      if (c_interop_kinds_table[i].f90_type == ts->type &&
-          c_interop_kinds_table[i].value == ts->kind)
-        return true;
-    }
-
-  return false;
-}
-
-
 static int
 get_real_kind_from_node (tree type)
 {
@@ -2470,7 +2451,7 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
 
 /* Build a tree node for a procedure pointer component.  */
 
-tree
+static tree
 gfc_get_ppc_type (gfc_component* c)
 {
   tree t;
index 15d206b9443b7744531e48d26185c74fa710f98a..1b43503092bb3d6313a9b22935c98660b0c48456 100644 (file)
@@ -117,7 +117,6 @@ int gfc_is_nodesc_array (gfc_symbol *);
 tree gfc_get_dtype_rank_type (int, tree);
 tree gfc_get_dtype (tree, int *rank = NULL);
 
-tree gfc_get_ppc_type (gfc_component *);
 tree gfc_get_caf_vector_type (int dim);
 tree gfc_get_caf_reference_type ();
 
index 22f267645e8fb59ad17efc9a577c5abde245b4d5..a377d0eeb24472694d6fb5505419d64ff4859815 100644 (file)
@@ -45,7 +45,6 @@ along with GCC; see the file COPYING3.  If not see
 static gfc_file *gfc_current_backend_file;
 
 const char gfc_msg_fault[] = N_("Array reference out of bounds");
-const char gfc_msg_wrong_return[] = N_("Incorrect function return value");
 
 
 /* Return a location_t suitable for 'tree' for a gfortran locus.  The way the
index 7ec4ca53a2c69d5884bedecf93c86ddb5f47dbf7..0d4eed20d20a111225dcc202dcc7a21d4e9bb152 100644 (file)
@@ -425,7 +425,6 @@ tree gfc_class_set_static_fields (tree, tree, tree);
 tree gfc_class_data_get (tree);
 tree gfc_class_vptr_get (tree);
 tree gfc_class_len_get (tree);
-tree gfc_class_len_or_zero_get (tree);
 tree gfc_resize_class_size_with_len (stmtblock_t *, tree, tree);
 gfc_expr * gfc_find_and_cut_at_last_class_ref (gfc_expr *, bool is_mold = false,
                                               gfc_typespec **ts = NULL);
@@ -433,14 +432,12 @@ gfc_expr * gfc_find_and_cut_at_last_class_ref (gfc_expr *, bool is_mold = false,
    available.  */
 tree gfc_class_vtab_hash_get (tree);
 tree gfc_class_vtab_size_get (tree);
-tree gfc_class_vtab_extends_get (tree);
 tree gfc_class_vtab_def_init_get (tree);
 tree gfc_class_vtab_copy_get (tree);
 tree gfc_class_vtab_final_get (tree);
 /* Get an accessor to the vtab's * field, when a vptr handle is present.  */
 tree gfc_vptr_hash_get (tree);
 tree gfc_vptr_size_get (tree);
-tree gfc_vptr_extends_get (tree);
 tree gfc_vptr_def_init_get (tree);
 tree gfc_vptr_copy_get (tree);
 tree gfc_vptr_final_get (tree);
@@ -450,7 +447,6 @@ void gfc_reset_len (stmtblock_t *, gfc_expr *);
 tree gfc_get_class_from_gfc_expr (gfc_expr *);
 tree gfc_get_class_from_expr (tree);
 tree gfc_get_vptr_from_expr (tree);
-tree gfc_get_class_array_ref (tree, tree, tree, bool);
 tree gfc_copy_class_to_class (tree, tree, tree, bool);
 bool gfc_add_finalizer_call (stmtblock_t *, gfc_expr *);
 bool gfc_add_comp_finalizer_call (stmtblock_t *, tree, gfc_component *, bool);
@@ -509,7 +505,6 @@ void gfc_conv_expr_type (gfc_se * se, gfc_expr *, tree);
 
 
 /* trans-expr.c */
-tree gfc_get_character_len (tree);
 tree gfc_get_character_len_in_bytes (tree);
 tree gfc_conv_scalar_to_descriptor (gfc_se *, tree, symbol_attribute);
 tree gfc_get_ultimate_alloc_ptr_comps_caf_token (gfc_se *, gfc_expr *);
@@ -621,9 +616,6 @@ tree gfc_get_extern_function_decl (gfc_symbol *,
                                   gfc_actual_arglist *args = NULL,
                                   const char *fnspec = NULL);
 
-/* Return the decl for a function.  */
-tree gfc_get_function_decl (gfc_symbol *);
-
 /* Build an ADDR_EXPR.  */
 tree gfc_build_addr_expr (tree, tree);
 
@@ -1171,15 +1163,12 @@ void gfc_init_interface_mapping (gfc_interface_mapping *);
 void gfc_free_interface_mapping (gfc_interface_mapping *);
 void gfc_add_interface_mapping (gfc_interface_mapping *,
                                gfc_symbol *, gfc_se *, gfc_expr *);
-void gfc_finish_interface_mapping (gfc_interface_mapping *,
-                                  stmtblock_t *, stmtblock_t *);
 void gfc_apply_interface_mapping (gfc_interface_mapping *,
                                  gfc_se *, gfc_expr *);
 
 
 /* Standard error messages used in all the trans-*.c files.  */
 extern const char gfc_msg_fault[];
-extern const char gfc_msg_wrong_return[];
 
 #define OMPWS_WORKSHARE_FLAG   1       /* Set if in a workshare construct.  */
 #define OMPWS_CURR_SINGLEUNIT  2       /* Set if current gfc_code in workshare