From: Tom de Vries <Tom_deVries@mentor.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: Add -Wsuggest-attribute=cold
Date: Mon, 09 Oct 2017 11:42:00 -0000 [thread overview]
Message-ID: <ea7c296a-b7dd-4ddc-cf07-0b6b3f7202c2@mentor.com> (raw)
In-Reply-To: <20170724185633.GA43541@kam.mff.cuni.cz>
[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]
On 07/24/2017 08:56 PM, Jan Hubicka wrote:
> * gcc.dg/cold-1.c: New testcase.
> Index: testsuite/gcc.dg/cold-1.c
> ===================================================================
> --- testsuite/gcc.dg/cold-1.c (revision 0)
> +++ testsuite/gcc.dg/cold-1.c (working copy)
> @@ -0,0 +1,21 @@
> +/* { dg-do compile { target nonpic } } */
> +/* { dg-options "-O2 -Wsuggest-attribute=cold" } */
> +
> +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 ();
> +}
> +
> +int
> +foo2(int a)
> +{
> + if (a)
> + do_something_interesting_and_never_return ();
> + abort ();
> +}
>
Hi,
this test-case failed for me due to:
- excess errors due to missing abort declaration
- warning emitted on line 7, but is expected on line 8
This patch that:
- fixes the warning line number
- rewrites the absolute warning line number into a relative one
- adds the abort declaration
Committed as obvious.
Thanks,
- Tom
[-- Attachment #2: 0001-Fix-gcc.dg-cold-1.c.patch --]
[-- Type: text/x-patch, Size: 861 bytes --]
Fix gcc.dg/cold-1.c
2017-10-09 Tom de Vries <tom@codesourcery.com>
* gcc.dg/cold-1.c (foo1): Fix warning line number. Make warning line
number relative.
(abort): Declare.
---
gcc/testsuite/gcc.dg/cold-1.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/cold-1.c b/gcc/testsuite/gcc.dg/cold-1.c
index 8ea88dd..ba1cd3a 100644
--- a/gcc/testsuite/gcc.dg/cold-1.c
+++ b/gcc/testsuite/gcc.dg/cold-1.c
@@ -1,11 +1,12 @@
/* { dg-do compile { target nonpic } } */
/* { dg-options "-O2 -Wsuggest-attribute=cold" } */
+extern void abort (void);
extern void do_something_interesting_and_never_return ();
int
foo1(int a)
-{ /* { dg-warning "cold" "detect cold candidate" { target *-*-* } "8" } */
+{ /* { dg-warning "cold" "detect cold candidate" { target *-*-* } ".-1" } */
if (a)
abort ();
else
prev parent reply other threads:[~2017-10-09 11:12 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
2017-10-09 11:42 ` Tom de Vries [this message]
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=ea7c296a-b7dd-4ddc-cf07-0b6b3f7202c2@mentor.com \
--to=tom_devries@mentor.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).