public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, fortran@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, v4] Fortran: detect blanks within literal constants in free-form mode [PR92805]
Date: Sun, 31 Jul 2022 10:35:20 +0200	[thread overview]
Message-ID: <af461f76-5c5d-da1f-a0a6-802cffc51c57@orange.fr> (raw)
In-Reply-To: <1073012a-e384-77e6-6cc8-7069dabab862@gmx.de>

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


  reply	other threads:[~2022-07-31  8:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 20:11 [PATCH] " Harald Anlauf
2022-07-29 11:11 ` Mikael Morin
2022-07-29 19:59   ` [PATCH, v2] " Harald Anlauf
2022-07-29 19:59     ` Harald Anlauf
2022-07-29 20:36     ` Mikael Morin
2022-07-29 21:09       ` [PATCH, v3] " Harald Anlauf
2022-07-29 21:09         ` Harald Anlauf
2022-07-30  7:46         ` Thomas Koenig
2022-07-30 18:32           ` Harald Anlauf
2022-07-30 18:32             ` Harald Anlauf
2022-07-30  8:28         ` Mikael Morin
2022-07-30 19:40           ` [PATCH, v4] " Harald Anlauf
2022-07-31  8:35             ` Mikael Morin [this message]
2022-07-31 19:01               ` Harald Anlauf
2022-07-31 19:01                 ` Harald Anlauf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af461f76-5c5d-da1f-a0a6-802cffc51c57@orange.fr \
    --to=morin-mikael@orange.fr \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).