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



commit b93f76f9633e766eadd6022b5794c52deb7d81b3
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-call-args.cpp | 6 ++++++
 test/gjs-test-common.cpp    | 6 ++++++
 test/gjs-test-coverage.cpp  | 6 ++++++
 test/gjs-test-rooting.cpp   | 6 ++++++
 test/gjs-tests.cpp          | 6 ++++++
 5 files changed, 30 insertions(+)
---
diff --git a/test/gjs-test-call-args.cpp b/test/gjs-test-call-args.cpp
index 5511717d..670e1d70 100644
--- a/test/gjs-test-call-args.cpp
+++ b/test/gjs-test-call-args.cpp
@@ -24,6 +24,12 @@ namespace mozilla {
 union Utf8Unit;
 }
 
+// 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
+
 #define assert_match(str, pattern)                                           \
     G_STMT_START {                                                           \
         const char *__s1 = (str), *__s2 = (pattern);                         \
diff --git a/test/gjs-test-common.cpp b/test/gjs-test-common.cpp
index e74c01f1..8e85c1aa 100644
--- a/test/gjs-test-common.cpp
+++ b/test/gjs-test-common.cpp
@@ -33,6 +33,12 @@
 
 #include "test/gjs-test-common.h"
 
+// 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
+
 char* gjs_test_get_exception_message(JSContext* cx) {
     if (!JS_IsExceptionPending(cx))
         return nullptr;
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 6496f1c2..38780c1a 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -36,6 +36,12 @@
 #include "gjs/coverage.h"
 #include "gjs/jsapi-util.h"
 
+// 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
+
 typedef struct _GjsCoverageFixture {
     GjsContext    *context;
     GjsCoverage   *coverage;
diff --git a/test/gjs-test-rooting.cpp b/test/gjs-test-rooting.cpp
index 3dfa4cd4..3fa26cdc 100644
--- a/test/gjs-test-rooting.cpp
+++ b/test/gjs-test-rooting.cpp
@@ -12,6 +12,12 @@
 #include "gjs/jsapi-util-root.h"
 #include "test/gjs-test-utils.h"
 
+// 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
+
 static GMutex gc_lock;
 static GCond gc_finished;
 static volatile int gc_counter;
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 8c2e596c..67bfcf5a 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -46,6 +46,12 @@
 #include "test/gjs-test-utils.h"
 #include "util/misc.h"
 
+// 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
+
 #define VALID_UTF8_STRING "\303\211\303\226 foobar \343\203\237"
 
 static void


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