From patchwork Sun Oct 24 22:30:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 1545458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=OsfwH59H; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HctMn6JBKz9s1l for ; Mon, 25 Oct 2021 09:40:37 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B2FE13858439 for ; Sun, 24 Oct 2021 22:40:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2FE13858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635115235; bh=UJ5EQCMpk5YcqAz5SMSMyF4WdplwBrMnuT02PFzfQ8E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OsfwH59H+qUDI8YF5nEfaTx4srRIS8BtEGqxFs3nIK//1ElMJvo/4tW145HwFWoUM bwJ3z85Kv0IKkCH6NjuopJTQK9qgmX9vsu2fTB1KQx5rKiFBb2T9BjHS49a8T2Mi09 k6BhvXQPGhlJesx1Zt9d42QsbHn5oxl1vN/EGCiE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id BC9233858400; Sun, 24 Oct 2021 22:30:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC9233858400 Received: by mail-wr1-x429.google.com with SMTP id d10so5143053wrb.1; Sun, 24 Oct 2021 15:30:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UJ5EQCMpk5YcqAz5SMSMyF4WdplwBrMnuT02PFzfQ8E=; b=uZTpp34ISy61n+tAUuztQEG/Ji3tc1uB7kvtqfFKFK6BqB/y7To8m/Fr+cyWyUtoNL I+jeKky89tAWlbFEIGcxCsW1XpET8pOgqufZ6dmEMiaRRNWXfNtq9pl1Gvt203sPoq72 l+jwMaSxXzFpnuD4vEjgtvqRHQqPxixLTME53BEonXUR217aI7yVkhT07trYaAuubO/h 1KBIzGt7MFYN4WGM0hR7kptqQvIWggygqndY5YoaMwgI9C8UFXVOfDpv2kIjK2NnQGQL fGt8SqUtbcynndE+nQOdGQLUay8lKMaoZ/g+6xgfu4COft6Hvtk1aNehDVMb82B7Tl/S dwzA== X-Gm-Message-State: AOAM530cCgKGMOAijRr9wgqIIfXS196w665brPSrehHWg0dwfHupG6QW Okglu38sYmKoDKYLxx/t7ftADDG1w4Q= X-Google-Smtp-Source: ABdhPJzHlsAl23WV22C8naK12vCLgJQIFLZ+0MS+hJ1UtSUSUFFYt4LAq+gwGQMaTGapOlcX7nco7A== X-Received: by 2002:adf:b350:: with SMTP id k16mr18351628wrd.368.1635114641815; Sun, 24 Oct 2021 15:30:41 -0700 (PDT) Received: from nbbrfq.weghof (dynamic-2bq7di4u2lfl4qjka9-pd01.res.v6.highway.a1.net. [2001:871:227:33a8:f6a3:c58c:7641:e771]) by smtp.gmail.com with ESMTPSA id f3sm17138033wmb.12.2021.10.24.15.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Oct 2021 15:30:40 -0700 (PDT) Received: from b by nbbrfq.weghof with local (Exim 4.95) (envelope-from ) id 1mem0j-005usu-O2; Mon, 25 Oct 2021 00:30:37 +0200 To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH,Fortran 1/7] Fortran: make some trans* functions static Date: Mon, 25 Oct 2021 00:30:17 +0200 Message-Id: <20211024223023.1410274-2-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211024223023.1410274-1-rep.dot.nop@gmail.com> References: <20211024223023.1410274-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Cc: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Bernhard Reutner-Fischer 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 | 2 +- gcc/fortran/gfortran.h | 1 - gcc/fortran/match.c | 2 +- gcc/fortran/match.h | 1 - gcc/fortran/scanner.c | 4 ++-- gcc/fortran/trans-expr.c | 10 +++++----- gcc/fortran/trans-types.c | 25 +++---------------------- gcc/fortran/trans-types.h | 1 - gcc/fortran/trans.c | 1 - gcc/fortran/trans.h | 11 ----------- 10 files changed, 12 insertions(+), 46 deletions(-) diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index b19d3a26c60..4dea840e348 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -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) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 66192c07d8c..f7662c59a5d 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -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); diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 53a575e616e..91cde55d7a1 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -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]; diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index 21e94f79d95..eb9459ea99c 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -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 *); diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 5a450692ba3..69b81ab97f8 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -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; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 2d7f9e0fb91..e7aec3845d3 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -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) { diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 42778067dbe..947ab5a099b 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -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; diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h index 15d206b9443..1b43503092b 100644 --- a/gcc/fortran/trans-types.h +++ b/gcc/fortran/trans-types.h @@ -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 (); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 22f267645e8..a377d0eeb24 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -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 diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 7ec4ca53a2c..0d4eed20d20 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -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