* [PATCH] selftest.h: mark failure functions with "noreturn"
@ 2016-08-26 15:36 David Malcolm
2016-08-26 16:00 ` Bernd Schmidt
0 siblings, 1 reply; 5+ messages in thread
From: David Malcolm @ 2016-08-26 15:36 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
selftest::fail and selftest::fail_formatted call abort. Marking
them as "noreturn" can help eliminate false warnings about unreachable
code in selftests.
Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
OK for trunk?
gcc/ChangeLog:
* selftest.h (selftest::fail): Add __attribute__ ((noreturn)).
(selftest::fail_formatted): Likewise.
---
gcc/selftest.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/selftest.h b/gcc/selftest.h
index b073ed6..8636997 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -56,12 +56,13 @@ extern void pass (const location &loc, const char *msg);
/* Report the failed outcome of some aspect of the test and abort. */
-extern void fail (const location &loc, const char *msg);
+extern void fail (const location &loc, const char *msg)
+ __attribute__ ((noreturn));
/* As "fail", but using printf-style formatted output. */
extern void fail_formatted (const location &loc, const char *fmt, ...)
- ATTRIBUTE_PRINTF_2;
+ ATTRIBUTE_PRINTF_2 __attribute__ ((noreturn));
/* Implementation detail of ASSERT_STREQ. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest.h: mark failure functions with "noreturn"
2016-08-26 15:36 [PATCH] selftest.h: mark failure functions with "noreturn" David Malcolm
@ 2016-08-26 16:00 ` Bernd Schmidt
2016-08-26 17:51 ` [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN David Malcolm
2016-08-26 17:59 ` [PATCH] selftest.h: mark failure functions with "noreturn" Eric Gallager
0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schmidt @ 2016-08-26 16:00 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 08/26/2016 06:05 PM, David Malcolm wrote:
> selftest::fail and selftest::fail_formatted call abort. Marking
> them as "noreturn" can help eliminate false warnings about unreachable
> code in selftests.
>
> Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
>
> OK for trunk?
Don't we want to wrap this in some ATTRIBUTE_NORETURN macro for portability?
Bernd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN.
2016-08-26 16:00 ` Bernd Schmidt
@ 2016-08-26 17:51 ` David Malcolm
2016-08-29 9:01 ` Bernd Schmidt
2016-08-26 17:59 ` [PATCH] selftest.h: mark failure functions with "noreturn" Eric Gallager
1 sibling, 1 reply; 5+ messages in thread
From: David Malcolm @ 2016-08-26 17:51 UTC (permalink / raw)
To: gcc-patches; +Cc: Bernd Schmidt, David Malcolm
On Fri, 2016-08-26 at 18:00 +0200, Bernd Schmidt wrote:
> On 08/26/2016 06:05 PM, David Malcolm wrote:
> > selftest::fail and selftest::fail_formatted call abort. Marking
> > them as "noreturn" can help eliminate false warnings about
> > unreachable
> > code in selftests.
> >
> > Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
> >
> > OK for trunk?
>
> Don't we want to wrap this in some ATTRIBUTE_NORETURN macro for
> portability?
>
Oops, yes.
Is this revised version OK for trunk?
Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
gcc/ChangeLog:
* selftest.h (selftest::fail): Add ATTRIBUTE_NORETURN.
(selftest::fail_formatted): Likewise.
---
gcc/selftest.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/selftest.h b/gcc/selftest.h
index b073ed6..e2d7356 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -56,12 +56,13 @@ extern void pass (const location &loc, const char *msg);
/* Report the failed outcome of some aspect of the test and abort. */
-extern void fail (const location &loc, const char *msg);
+extern void fail (const location &loc, const char *msg)
+ ATTRIBUTE_NORETURN;
/* As "fail", but using printf-style formatted output. */
extern void fail_formatted (const location &loc, const char *fmt, ...)
- ATTRIBUTE_PRINTF_2;
+ ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
/* Implementation detail of ASSERT_STREQ. */
--
1.8.5.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest.h: mark failure functions with "noreturn"
2016-08-26 16:00 ` Bernd Schmidt
2016-08-26 17:51 ` [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN David Malcolm
@ 2016-08-26 17:59 ` Eric Gallager
1 sibling, 0 replies; 5+ messages in thread
From: Eric Gallager @ 2016-08-26 17:59 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: David Malcolm, gcc-patches
On 8/26/16, Bernd Schmidt <bschmidt@redhat.com> wrote:
> On 08/26/2016 06:05 PM, David Malcolm wrote:
>> selftest::fail and selftest::fail_formatted call abort. Marking
>> them as "noreturn" can help eliminate false warnings about unreachable
>> code in selftests.
>>
>> Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
>>
>> OK for trunk?
>
> Don't we want to wrap this in some ATTRIBUTE_NORETURN macro for
> portability?
>
One already exist in include/ansidecl.h; lots of files already use the macro:
$ git grep ATTRIBUTE_NORETURN | wc -l
96
So yeah, I'd say it should be used here, too.
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN.
2016-08-26 17:51 ` [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN David Malcolm
@ 2016-08-29 9:01 ` Bernd Schmidt
0 siblings, 0 replies; 5+ messages in thread
From: Bernd Schmidt @ 2016-08-29 9:01 UTC (permalink / raw)
To: David Malcolm, gcc-patches
On 08/26/2016 08:20 PM, David Malcolm wrote:
> Is this revised version OK for trunk?
>
LGTM.
Bernd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-29 9:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 15:36 [PATCH] selftest.h: mark failure functions with "noreturn" David Malcolm
2016-08-26 16:00 ` Bernd Schmidt
2016-08-26 17:51 ` [PATCH] selftest.h: mark failure functions with ATTRIBUTE_NORETURN David Malcolm
2016-08-29 9:01 ` Bernd Schmidt
2016-08-26 17:59 ` [PATCH] selftest.h: mark failure functions with "noreturn" Eric Gallager
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).