public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>,
	Tobias Burnus <burnus@net-b.de>,
	       "fortran\@gcc.gnu.org List" <fortran@gcc.gnu.org>
Subject: Re: [PATCH diagnostics/fortran] Handle two locations for the same diagnostic. Convert all gfc_warning_1 and gfc_notify_std_1 calls
Date: Fri, 15 May 2015 08:41:00 -0000	[thread overview]
Message-ID: <86mw16utdv.fsf@redhat.com> (raw)
In-Reply-To: <CAESRpQDdrOwNZd74JO5u-7nVOH5_n1h+KsMwvtkhaPTQ6d9UxQ@mail.gmail.com>	("Manuel \=\?utf-8\?B\?TMOzcGV6LUliw6HDsWV6Iidz\?\= message of "Sat, 9 May 2015 00:12:45 +0200")

Manuel López-Ibáñez <lopezibanez@gmail.com> writes:

> Thanks for the review. I followed all your suggestions. For the
> accessor functions, I was not sure what type you would prefer, so I
> implemented them as C++ methods and made use of 'private' to be sure
> they are the only way to access the locations array. If you want me to
> change it, just tell me what you prefer. I also replaced
> diagnostic_same_locus with diagnostic_same_line.

Great, thank you.

>
> Bootstrapped & regression tested on x86_64-linux-gnu.
>
> OK?

Yes, but with the slight changes below.  Sorry I spotted them just now,
but they are quick to fix, I believe.

>
> Manuel.
>

[...]

> -/* Expand the location of this diagnostic. Use this function for consistency. */
> +/* Return the location associated to this diagnostic. WHICH specifies

Here, I think only the 'W' (in WHICH) should be uppercase.


[...]


>  /* The type of a text to be formatted according a format specification
>     along with a list of things.  */
>  struct text_info
>  {
> +public:

As this is a struct, the 'public' here is not necessary, as the members
are public by default.

>    const char *format_spec;
>    va_list *args_ptr;
>    int err_no;  /* for %m */
> -  location_t *locus;
>    void **x_data;
> +
> +  inline location_t & set_location (unsigned int index_of_location)

I think it's less surprising to have the this function take two
parameters:  The index_of_location and the new new location.

So that it's used by doing: set_location (0, the_new_location);

> +  {
> +    gcc_checking_assert (index_of_location < MAX_LOCATIONS_PER_MESSAGE);
> +    return this->locations[index_of_location];
> +  }
> +
> +  inline location_t get_location (unsigned int index_of_location) const
> +  {
> +    gcc_checking_assert (index_of_location < MAX_LOCATIONS_PER_MESSAGE);
> +    return this->locations[index_of_location];
> +  }
> +
> +private:
> +  location_t locations[MAX_LOCATIONS_PER_MESSAGE];
>  };
>  

[...]

OK to commit with the changes above.

Thanks a lot!

-- 
		Dodji

  reply	other threads:[~2015-05-15  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 20:01 Manuel López-Ibáñez
2015-05-03 22:31 ` Manuel López-Ibáñez
2015-05-07 20:16 ` Dodji Seketeli
2015-05-08 22:13   ` Manuel López-Ibáñez
2015-05-15  8:41     ` Dodji Seketeli [this message]
2015-05-15 12:23       ` Manuel López-Ibáñez
2015-05-18  7:35         ` Dodji Seketeli
2015-05-06  7:21 Tobias Burnus

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=86mw16utdv.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lopezibanez@gmail.com \
    /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).