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