From patchwork Sun Oct 24 22:30:18 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: 1545457 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=KTNqg54o; 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 4HctKf28Jkz9s1l for ; Mon, 25 Oct 2021 09:38:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2315F385842A for ; Sun, 24 Oct 2021 22:38:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2315F385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635115124; bh=jTbgzbc1jruB++bCvOX3zdlaTtk9aZvKB5Hy2LyCcaY=; 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=KTNqg54oleeVYfEp69XxCdbVIkLI4DI3qdh8sMtw8I/YOVlFt6gIlYdUbvLPxb0H7 L+Z6Qt8S04TWPePXFw2XGg1bgELzRDsKaFV+NUkDbPr86FFxaE7biwUjVUBb1PLtdW EG8Qur9g+TEmgGOB46xyFkI7a5aBlZfFJ5kLXioY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 9AD423858404; Sun, 24 Oct 2021 22:30:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9AD423858404 Received: by mail-wr1-x42f.google.com with SMTP id v17so7935028wrv.9; Sun, 24 Oct 2021 15:30:41 -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=jTbgzbc1jruB++bCvOX3zdlaTtk9aZvKB5Hy2LyCcaY=; b=BkuRp8G7ueQO9aI/l5/CRDCALKiEL0VjXkR+oz0OX4gOyXRTvTszjikm4NEqVeNQJe eklViDWro5vuKYD+gcEJWwQn1wcZMosgKlL2/8Jh91fCKuKLS2BIy1plLRBdhqK4OqHV H0bLF7EHBKT16OODpQdOoFT7jsQEefqHw/uh18R4YbAOl6zZbFenrHrWXXpwGH8X/GoT 5T9kJGyloufsMyqZuVI6Jql2bzRFhbFbPkRLzcp0+p2BDhXSA/lmezb2NkEjbiWLPsKW FnsSh8Fq2nDmdYwtlL+bETx3HKUuVUtjIu0cz7x4Xb7G2pYG9AAkMlA50H4FJSp9cpIi gO/A== X-Gm-Message-State: AOAM533Skd4fq4WhEJg3EA3jzdPs7j+RXDKc8loEhioiSEazwMPswRNV VrDEiIy43DRB3jB/6E9NtmGeJ9CzRM4= X-Google-Smtp-Source: ABdhPJxjZMUBWOZPsPFYgD9Ld8x6x8xEEIpU+98cLlUxREvotGK1bbxAebU8JqeOK08Nj2ExYOoCJA== X-Received: by 2002:adf:f48d:: with SMTP id l13mr18903886wro.94.1635114640686; Sun, 24 Oct 2021 15:30:40 -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 e18sm5880469wrv.44.2021.10.24.15.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Oct 2021 15:30:38 -0700 (PDT) Received: from b by nbbrfq.weghof with local (Exim 4.95) (envelope-from ) id 1mem0j-005usx-ON; Mon, 25 Oct 2021 00:30:37 +0200 To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH,Fortran 2/7] Fortran: make some match* functions static Date: Mon, 25 Oct 2021 00:30:18 +0200 Message-Id: <20211024223023.1410274-3-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.1 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 gfc_match_small_int_expr was unused, delete it. gfc_match_gcc_unroll should use gfc_match_small_literal_int and then gfc_match_small_int can be deleted since it will be unused. gcc/fortran/ChangeLog: * decl.c (gfc_match_old_kind_spec, set_com_block_bind_c, set_verify_bind_c_sym, set_verify_bind_c_com_block, get_bind_c_idents, gfc_match_suffix, gfc_get_type_attr_spec, (check_extended_derived_type): Make static. (gfc_match_gcc_unroll): Add comment. * match.c (gfc_match_small_int_expr): Delete definition. * match.h (gfc_match_small_int_expr): Delete declaration. (gfc_match_name_C, gfc_match_old_kind_spec, set_com_block_bind_c, set_verify_bind_c_sym, set_verify_bind_c_com_block, get_bind_c_idents, gfc_match_suffix, gfc_get_type_attr_spec): Delete declaration. --- gcc/fortran/decl.c | 15 ++++++++------- gcc/fortran/match.c | 26 -------------------------- gcc/fortran/match.h | 9 --------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 6043e100fbb..1e034d1b344 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3128,7 +3128,7 @@ cleanup: This assumes that the byte size is equal to the kind number for non-COMPLEX types, and equal to twice the kind number for COMPLEX. */ -match +static match gfc_match_old_kind_spec (gfc_typespec *ts) { match m; @@ -5867,7 +5867,7 @@ set_binding_label (const char **dest_label, const char *sym_name, /* Set the status of the given common block as being BIND(C) or not, depending on the given parameter, is_bind_c. */ -void +static void set_com_block_bind_c (gfc_common_head *com_block, int is_bind_c) { com_block->is_bind_c = is_bind_c; @@ -6055,7 +6055,7 @@ verify_bind_c_sym (gfc_symbol *tmp_sym, gfc_typespec *ts, the type is C interoperable. Errors are reported by the functions used to set/test these fields. */ -bool +static bool set_verify_bind_c_sym (gfc_symbol *tmp_sym, int num_idents) { bool retval = true; @@ -6075,7 +6075,7 @@ set_verify_bind_c_sym (gfc_symbol *tmp_sym, int num_idents) /* Set the fields marking the given common block as BIND(C), including a binding label, and report any errors encountered. */ -bool +static bool set_verify_bind_c_com_block (gfc_common_head *com_block, int num_idents) { bool retval = true; @@ -6095,7 +6095,7 @@ set_verify_bind_c_com_block (gfc_common_head *com_block, int num_idents) /* Retrieve the list of one or more identifiers that the given bind(c) attribute applies to. */ -bool +static bool get_bind_c_idents (void) { char name[GFC_MAX_SYMBOL_LEN + 1]; @@ -6804,7 +6804,7 @@ match_result (gfc_symbol *function, gfc_symbol **result) clause and BIND(C), either one, or neither. The draft does not require them to come in a specific order. */ -match +static match gfc_match_suffix (gfc_symbol *sym, gfc_symbol **result) { match is_bind_c; /* Found bind(c). */ @@ -10116,7 +10116,7 @@ check_extended_derived_type (char *name) not a handled attribute, and MATCH_YES otherwise. TODO: More error checking on attribute conflicts needs to be done. */ -match +static match gfc_get_type_attr_spec (symbol_attribute *attr, char *name) { /* See if the derived type is marked as private. */ @@ -11794,6 +11794,7 @@ gfc_match_gcc_unroll (void) { int value; + /* FIXME: use gfc_match_small_literal_int instead, delete small_int */ if (gfc_match_small_int (&value) == MATCH_YES) { if (value < 0 || value > USHRT_MAX) diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 91cde55d7a1..5d07f897e45 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -530,32 +530,6 @@ gfc_match_small_int (int *value) } -/* This function is the same as the gfc_match_small_int, except that - we're keeping the pointer to the expr. This function could just be - removed and the previously mentioned one modified, though all calls - to it would have to be modified then (and there were a number of - them). Return MATCH_ERROR if fail to extract the int; otherwise, - return the result of gfc_match_expr(). The expr (if any) that was - matched is returned in the parameter expr. */ - -match -gfc_match_small_int_expr (int *value, gfc_expr **expr) -{ - match m; - int i; - - m = gfc_match_expr (expr); - if (m != MATCH_YES) - return m; - - if (gfc_extract_int (*expr, &i, 1)) - m = MATCH_ERROR; - - *value = i; - return m; -} - - /* Matches a statement label. Uses gfc_match_small_literal_int() to do most of the work. */ diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index eb9459ea99c..e9368db281d 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -48,9 +48,7 @@ match gfc_match_eos (void); match gfc_match_small_literal_int (int *, int *); match gfc_match_st_label (gfc_st_label **); match gfc_match_small_int (int *); -match gfc_match_small_int_expr (int *, gfc_expr **); match gfc_match_name (char *); -match gfc_match_name_C (const char **buffer); match gfc_match_symbol (gfc_symbol **, int); match gfc_match_sym_tree (gfc_symtree **, int); match gfc_match_intrinsic_op (gfc_intrinsic_op *); @@ -236,7 +234,6 @@ match gfc_match_omp_end_single (void); match gfc_match_data (void); match gfc_match_null (gfc_expr **); match gfc_match_kind_spec (gfc_typespec *, bool); -match gfc_match_old_kind_spec (gfc_typespec *); match gfc_match_decl_type_spec (gfc_typespec *, int); match gfc_match_end (gfc_statement *); @@ -295,14 +292,8 @@ match gfc_match_volatile (void); /* Fortran 2003 c interop. TODO: some of these should be moved to another file rather than decl.c */ -void set_com_block_bind_c (gfc_common_head *, int); -bool set_verify_bind_c_sym (gfc_symbol *, int); -bool set_verify_bind_c_com_block (gfc_common_head *, int); -bool get_bind_c_idents (void); match gfc_match_bind_c_stmt (void); -match gfc_match_suffix (gfc_symbol *, gfc_symbol **); match gfc_match_bind_c (gfc_symbol *, bool); -match gfc_get_type_attr_spec (symbol_attribute *, char*); /* primary.c. */ match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **);