public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael.morin@sfr.fr>
To: Evangelos Drikos <drikosev@otenet.gr>, fortran@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: pr59016
Date: Mon, 06 Apr 2015 18:27:00 -0000	[thread overview]
Message-ID: <5522CFEC.4070802@sfr.fr> (raw)
In-Reply-To: <D3055C23-8B7E-4DAD-9080-138320656E99@otenet.gr>

Le 06/04/2015 01:04, Evangelos Drikos a écrit :
> 
> Hi,
> 
> The attached patch, type 0, has been discussed a little at:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59016
> 
> Yet, the final version submitted is slightly different from the ones discussed and tested in the above link.
> 
> Having read the GNU Coding Conventions, I created a patch using svn diff (“-up”) and I added a small test case.
> 
> Further, I've run the “check_GNU_style.sh” script to ensure that the source code meets the GNU style requirements. 
> 
> Also, I donÂ’t have DejaGNU installed and thus I think that I cannot run all the tests. In other words, evaluation is up to the GNU team.
> 
> Finally, it might be obvious that the patch is for trunk (not gcc-4.9.2).
> 
Hello,

first, have you signed the copyright assignment form?  See the legal
prerequisites section at https://gcc.gnu.org/contribute.html but I think
you have read that page already.

Regarding the patch, I don't understand why the existing symbol
restoration code doesn't work here (see
gfc_restore_last_undo_checkpoint, restore_old_symbol).  I have to
investigate more.  For now, I have made below a few comments about the
patch in its current state.

Most of the comments are purely syntactic: the code you insert should
have the same formatting as the rest of the code.

Mikael

PS: It's better if you manage to install DejaGNU, so that you can run
the testsuite yourself.  We are already short of manpower.


> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c	(revision 221872)
> +++ gcc/fortran/decl.c	(working copy)
> @@ -4427,6 +4432,40 @@ ok:
>    gfc_free_data_all (gfc_current_ns);
>  
>  cleanup:
> +  //<pr59016> in gfc_match_data_decl; cleanup the garbages
No need to reference the PR, unless the code is so subtle that one has
to read the PR to understand it.
And don't produce code that subtle. ;-)

> +  gfc_symbol *csym=NULL;
> +  if ( (m==MATCH_ERROR)       //clean only if stmt not matched and
No extra parenthesis around the equality, single spaces around an
operator, no space inside parenthesis.

> +  &&   (ifunlink!=NULL)     //the symbol was indeed linked in chain.
Indent the operator the same as its left operand

> +  &&   (current_ts.u.derived &&
> +		current_ts.u.derived->name))
No extra parenthesis, operator at the beginning of the line, not at the end.

> +  {
indent the brace by two spaces wrt the preceding indentation.

> +      const char *pname = current_ts.u.derived->name;
> +      //In case the dt name is in title instead of lower case.
> +      if ( current_ts.u.derived->name[0] !=
> +		   TOLOWER (current_ts.u.derived->name[0]))
> +	  {
> +		  char iname[129]; iname[128]=0;
Indent the inner code two spaces more than the preceding indentation
(that of the brace).

> +		  for (int i=0; (i < 128);i++)
> +		  {
> +			  iname[i]=current_ts.u.derived->name[i];
> +			  if (current_ts.u.derived->name[i]==0)
> +				  break;
> +		  }//for
Comment useless.

> +		  iname[0] = TOLOWER (iname[0]);
> +		  pname    = iname ;
> +	  }//if
> +	  for (int i=0; i<4;i++) {  //try iface=0, 1, 2, and 3
This loop doesn't make sense; gfc_find_symbol's third argument shall be
either zero or non-zero, and it doesn't make sense to test both variants
in a row.

> +		  gfc_find_symbol (pname, NULL, i, &csym) ;
> +		  if ( csym && csym->generic &&
> +			 ( csym->generic->sym == current_ts.u.derived))
> +		  {
> +			  ifunlink->generic->next=csym->generic->next;	//remove from chain
> +			  csym->generic = old_generic;					//restore old value
> +			  break;
> +		  }//if
> +	  }//for
> +  }//if
> +  //</pr59016>
>    gfc_free_array_spec (current_as);
>    current_as = NULL;
>    return m;

  reply	other threads:[~2015-04-06 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05 23:04 pr59016 Evangelos Drikos
2015-04-06 18:27 ` Mikael Morin [this message]
2015-04-07 12:25   ` pr59016 Mikael Morin
2015-04-08 10:29     ` pr59016 Mikael Morin
2015-04-08 11:26       ` pr59016 Mikael Morin
2015-04-09 22:19         ` [Patch, fortran] PR59016, second version Mikael Morin
2015-04-10 10:24           ` Tobias Burnus
  -- strict thread matches above, loose matches on Subject: below --
2015-04-07  8:54 pr59016 Dominique Dhumieres
2015-04-05 19:04 pr59016 Evangelos Drikos

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=5522CFEC.4070802@sfr.fr \
    --to=mikael.morin@sfr.fr \
    --cc=drikosev@otenet.gr \
    --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).