From a2b89c4ae1c94005b3762e7ff06d73096fa97644 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 16 Apr 2014 17:36:51 +0100 Subject: [PATCH] =?utf8?q?auxiliary/os,auxiliary/util:=20Fix=20the=20`?= =?utf8?q?=E2=80=98noreturn=E2=80=99=20function=20does=20return`=20warning?= =?utf8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Now that _debug_assert_fail() has the noreturn attribute, it is better that execution truly never returns. Not just for sake of silencing the warning, but because the code at the return IP address may be invalid or lead to inconsistent results. This removes support for the GALLIUM_ABORT_ON_ASSERT debugging environment variable, but between the usefulness of GALLIUM_ABORT_ON_ASSERT and better static code analysis I think better static code analysis wins. Reviewed-by: Brian Paul --- src/gallium/auxiliary/os/os_misc.h | 2 +- src/gallium/auxiliary/util/u_debug.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/os/os_misc.h b/src/gallium/auxiliary/os/os_misc.h index 5029ab96aac..582931fe96a 100644 --- a/src/gallium/auxiliary/os/os_misc.h +++ b/src/gallium/auxiliary/os/os_misc.h @@ -67,7 +67,7 @@ extern "C" { * Abort the program. */ #if defined(DEBUG) -# define os_abort() os_break() +# define os_abort() do { os_break(); abort(); } while(0) #else # define os_abort() abort() #endif diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index ae248e02081..fe517175eb1 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -274,10 +274,7 @@ void _debug_assert_fail(const char *expr, const char *function) { _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr); - if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE)) - os_abort(); - else - _debug_printf("continuing...\n"); + os_abort(); } -- 2.30.2