public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: Add -Wsuggest-attribute=cold
Date: Mon, 24 Jul 2017 22:58:00 -0000	[thread overview]
Message-ID: <41c2bdc5-8962-51ee-ecf3-08e85f9d6328@gmail.com> (raw)
In-Reply-To: <20170724185633.GA43541@kam.mff.cuni.cz>

> +extern void do_something_interesting_and_never_return ();
> +
> +int
> +foo1(int a)
> +{ /* { dg-warning "cold" "detect cold candidate" { target *-*-* } "8" } */
> +  if (a)
> +    abort ();
> +  else
> +    abort ();
> +}

In this case it looks to me like with the patch GCC will actually
issue two suggestions: the new -Wsuggest-attribute=cold and the
existing -Wsuggest-attrribute=noreturn.

It's probably fine to have the same function annotated with both
attributes but I think it would be nice to give just one suggestion,
and recommend the optimal of the two (presumably noreturn).

Martin

> +
> +int
> +foo2(int a)
> +{
> +  if (a)
> +    do_something_interesting_and_never_return ();
> +  abort ();
> +}
>

  parent reply	other threads:[~2017-07-24 22:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 18:56 Jan Hubicka
2017-07-24 19:02 ` Eric Gallager
2017-07-24 19:08   ` Jan Hubicka
2017-07-24 22:01     ` Jeff Law
2017-07-24 22:06       ` Jan Hubicka
2017-07-24 22:19         ` Jeff Law
2017-07-24 22:58 ` Martin Sebor [this message]
2017-10-09 11:42 ` Tom de Vries

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=41c2bdc5-8962-51ee-ecf3-08e85f9d6328@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /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).