[gjs/june-maintenance: 3/3] test: Mark that g_assertion_message() does not normally return



commit 4d6164c925eba288780c0aa4a4168ec25591a98c
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Jul 4 12:11:25 2020 -0700

    test: Mark that g_assertion_message() does not normally return
    
    g_assertion_message() can return if nonfatal assertions are enabled, but
    for the purposes of static analysis, we want to consider it non-
    returning.
    
    See: GNOME/glib!1553

 test/gjs-test-common.h     | 6 ++++++
 test/gjs-test-coverage.cpp | 1 +
 test/gjs-test-rooting.cpp  | 1 +
 test/gjs-tests.cpp         | 1 +
 4 files changed, 9 insertions(+)
---
diff --git a/test/gjs-test-common.h b/test/gjs-test-common.h
index 91f78dcb..548ca605 100644
--- a/test/gjs-test-common.h
+++ b/test/gjs-test-common.h
@@ -28,4 +28,10 @@ struct JSContext;
 
 char* gjs_test_get_exception_message(JSContext* cx);
 
+// COMPAT: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1553
+#ifdef __clang_analyzer__
+void g_assertion_message(const char*, const char*, int, const char*,
+                         const char*) __attribute__((analyzer_noreturn));
+#endif
+
 #endif  // TEST_GJS_TEST_COMMON_H_
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 6496f1c2..8271a434 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -35,6 +35,7 @@
 #include "gjs/context.h"
 #include "gjs/coverage.h"
 #include "gjs/jsapi-util.h"
+#include "test/gjs-test-common.h"
 
 typedef struct _GjsCoverageFixture {
     GjsContext    *context;
diff --git a/test/gjs-test-rooting.cpp b/test/gjs-test-rooting.cpp
index 3dfa4cd4..401006bd 100644
--- a/test/gjs-test-rooting.cpp
+++ b/test/gjs-test-rooting.cpp
@@ -10,6 +10,7 @@
 #include <jsapi.h>  // for JS_GetPrivate, JS_NewObject, JS_Set...
 
 #include "gjs/jsapi-util-root.h"
+#include "test/gjs-test-common.h"
 #include "test/gjs-test-utils.h"
 
 static GMutex gc_lock;
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 8c2e596c..326e35b8 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -42,6 +42,7 @@
 #include "gjs/error-types.h"
 #include "gjs/jsapi-util.h"
 #include "gjs/profiler.h"
+#include "test/gjs-test-common.h"
 #include "test/gjs-test-no-introspection-object.h"
 #include "test/gjs-test-utils.h"
 #include "util/misc.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]