diff --git a/cfg/gtk.cfg b/cfg/gtk.cfg
index 2d793484c..ed694398e 100644
--- a/cfg/gtk.cfg
+++ b/cfg/gtk.cfg
@@ -2965,13 +2965,31 @@
false
+
false
+
+
+
+
+
+
+
false
+
+
+
+
+
+
+
+ 1:
+
@@ -19650,6 +19668,24 @@
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/cfg/gtk.c b/test/cfg/gtk.c
index b0d6bcb4a..e89d90854 100644
--- a/test/cfg/gtk.c
+++ b/test/cfg/gtk.c
@@ -53,6 +53,12 @@ void validCode(int argInt)
GError * pGerror = g_error_new(1, -2, "a %d", 1);
g_error_free(pGerror);
+
+ static gsize init_val = 0;
+ if (g_once_init_enter(&init_val)) {
+ gsize result_val = 1;
+ g_once_init_leave(&init_val, result_val);
+ }
}
void g_malloc_test()
@@ -366,3 +372,32 @@ void g_error_new_test()
printf("%p", pNew2);
// cppcheck-suppress memleak
}
+
+void g_once_init_enter_leave_test()
+{
+ static gsize init_val;
+ if (g_once_init_enter(&init_val)) {
+ gsize result_val = 0;
+ // cppcheck-suppress invalidFunctionArg
+ g_once_init_leave(&init_val, result_val);
+ }
+
+ gsize init_val2;
+ // cppcheck-suppress uninitvar
+ // cppcheck-suppress ignoredReturnValue
+ g_once_init_enter(&init_val2);
+
+ gsize * init_val3 = NULL;
+ // cppcheck-suppress nullPointer
+ if (g_once_init_enter(init_val3)) {
+ // cppcheck-suppress nullPointer
+ g_once_init_leave(init_val3, 1);
+ }
+
+ gsize * init_val4;
+ // cppcheck-suppress uninitvar
+ if (g_once_init_enter(init_val4)) {
+ // cppcheck-suppress uninitvar
+ g_once_init_leave(init_val4, 1);
+ }
+}