From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by sourceware.org (Postfix) with ESMTPS id DF1AD3857824 for ; Sun, 31 Jul 2022 08:35:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF1AD3857824 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=orange.fr Received: from [192.168.1.17] ([86.215.161.154]) by smtp.orange.fr with ESMTPA id I4PxoAr64AZYmI4Q2om3Li; Sun, 31 Jul 2022 10:35:28 +0200 X-ME-Helo: [192.168.1.17] X-ME-Auth: MDU4MTIxYWM4YWI0ZGE4ZTUwZWZmNTExZmI2ZWZlMThkM2ZhYiE5OWRkOGM= X-ME-Date: Sun, 31 Jul 2022 10:35:28 +0200 X-ME-IP: 86.215.161.154 Message-ID: Date: Sun, 31 Jul 2022 10:35:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: Mikael Morin Subject: Re: [PATCH, v4] Fortran: detect blanks within literal constants in free-form mode [PR92805] To: Harald Anlauf , fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org References: <46cc765d-469e-d6e8-23c5-dc470028d881@orange.fr> <1073012a-e384-77e6-6cc8-7069dabab862@gmx.de> Content-Language: en-US In-Reply-To: <1073012a-e384-77e6-6cc8-7069dabab862@gmx.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2022 08:35:32 -0000 Le 30/07/2022 à 21:40, Harald Anlauf a écrit : > Hi Mikael, > > Am 30.07.22 um 10:28 schrieb Mikael Morin: >> Meh! We killed one check for gfc_current_form but the other one is still >> there. >> OK, match_kind_param calls two functions that also gobble space, so >> there is work remaining here. >> So please make match_small_literal_constant and gfc_match_name >> space-gobbling wrappers around space-non-gobbling inner functions and >> call those inner functions instead in match_kind_param. > > well, here's the shortest solution I could come up with. > I added a new argument to 3 functions used in parsing that > controls the gobbling of whitespace.  We use this to handle > whitespace for numerical literals, while the parsing of string > literals remains as in the previous version of the patch. > > This version obviously ignores Thomas' request, as that would > require to treat gfc_match_char specially... > > Regtested again.  OK now? > PR fortran/92805 > * match.cc (gfc_match_small_literal_int): Make gobbling of leading > whitespace optional. > (gfc_match_name): Likewise. > (gfc_match_char): Likewise. > * match.h (gfc_match_small_literal_int): Adjust prototype. > (gfc_match_name): Likewise. > (gfc_match_char): Likewise. > * primary.cc (match_kind_param): Match small literal int or name > without gobbling whitespace. > (get_kind): Do not skip over blanks in free-form mode. I think the "in free-form mode" applied to the preceding patches but can be dropped now. > (match_string_constant): Likewise. > diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc > index 1aa3053e70e..c0dc0e89361 100644 > --- a/gcc/fortran/match.cc > +++ b/gcc/fortran/match.cc > @@ -457,7 +457,7 @@ gfc_match_eos (void) > will be set to the number of digits. */ Please add a note about GOBBLE_WS here, like you did for gfc_match_char. > > match > -gfc_match_small_literal_int (int *value, int *cnt) > +gfc_match_small_literal_int (int *value, int *cnt, bool gobble_ws) > { > locus old_loc; > char c; (...) > @@ -611,14 +612,15 @@ gfc_match_label (void) > than GFC_MAX_SYMBOL_LEN. */ Same here. > > match > -gfc_match_name (char *buffer) > +gfc_match_name (char *buffer, bool gobble_ws) > { > locus old_loc; > int i; > char c; > (...) > @@ -1052,16 +1054,19 @@ cleanup: > } > > > -/* Tries to match the next non-whitespace character on the input. > - This subroutine does not return MATCH_ERROR. */ > +/* Tries to match the next non-whitespace character on the input. This > + subroutine does not return MATCH_ERROR. When gobble_ws is false, do not > + skip over leading blanks. > +*/ There should be no line feed before end of comment. OK with those changes. thanks for your patience. Mikael