Fortran: make some trans* functions static

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.
This commit is contained in:
Bernhard Reutner-Fischer 2021-10-24 21:04:44 +02:00
parent 1f98c4e0c5
commit fd39c4bf55
10 changed files with 12 additions and 46 deletions

View 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)

View 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);

View 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];

View 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 *);

View 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;

View 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)
{

View 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;

View 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 ();

View 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

View 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