From 6bdf640f51cf11916decbf3c6c20e567ea65b6cc Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sun, 28 Jun 2020 17:01:50 -0700 Subject: [PATCH] gtestutils: Mark that g_assert_whatever() macros do not normally return g_assert_true(), g_assert_cmpint(), and friends, can return to the caller if test_nonfatal_assertions is set, but this is normally not the case. In particular, for the purposes of static analysis, we specifically don't want to assume that they might return. Clang has an analyzer_noreturn attribute for this exact purpose, which conveniently already has a macro in gmacros.h. Fixes: #1288 Fixes: #1200 --- glib/gtestutils.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glib/gtestutils.h b/glib/gtestutils.h index 298caa403..10b65c164 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -467,7 +467,7 @@ void g_assertion_message (const char *domain, const char *file, int line, const char *func, - const char *message); + const char *message) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_expr (const char *domain, const char *file, @@ -482,7 +482,7 @@ void g_assertion_message_cmpstr (const char *domain, const char *expr, const char *arg1, const char *cmp, - const char *arg2); + const char *arg2) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_cmpnum (const char *domain, const char *file, @@ -492,7 +492,7 @@ void g_assertion_message_cmpnum (const char *domain, long double arg1, const char *cmp, long double arg2, - char numtype); + char numtype) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_error (const char *domain, const char *file, @@ -501,7 +501,7 @@ void g_assertion_message_error (const char *domain, const char *expr, const GError *error, GQuark error_domain, - int error_code); + int error_code) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_test_add_vtable (const char *testpath, gsize data_size,