gtk.cfg: Add/enhance function configurations and tests. (#2101)
Add/enhance: g_once_init_enter(), g_once_init_leave() and g_signal_emit_by_name()
This commit is contained in:
parent
ef47d3d304
commit
a2a874dbd5
36
cfg/gtk.cfg
36
cfg/gtk.cfg
|
@ -2965,13 +2965,31 @@
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- gboolean g_once_init_enter (volatile void *location); -->
|
||||||
<function name="g_once_init_enter">
|
<function name="g_once_init_enter">
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="gboolean"/>
|
||||||
|
<use-retval/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- void g_once_init_leave (volatile void *location,
|
||||||
|
gsize result); -->
|
||||||
<function name="g_once_init_leave">
|
<function name="g_once_init_leave">
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
<valid>1:</valid>
|
||||||
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<function name="g_option_error_quark">
|
<function name="g_option_error_quark">
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
@ -19650,6 +19668,24 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- void g_signal_emit_by_name (gpointer instance,
|
||||||
|
const gchar *detailed_signal,
|
||||||
|
...); -->
|
||||||
|
<function name="g_signal_emit_by_name">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2" direction="in">
|
||||||
|
<not-uninit/>
|
||||||
|
<strz/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="variadic">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
<define name="gchar" value="char"/>
|
<define name="gchar" value="char"/>
|
||||||
<define name="guchar" value="unsigned char"/>
|
<define name="guchar" value="unsigned char"/>
|
||||||
<define name="gint" value="int"/>
|
<define name="gint" value="int"/>
|
||||||
|
|
|
@ -53,6 +53,12 @@ void validCode(int argInt)
|
||||||
|
|
||||||
GError * pGerror = g_error_new(1, -2, "a %d", 1);
|
GError * pGerror = g_error_new(1, -2, "a %d", 1);
|
||||||
g_error_free(pGerror);
|
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()
|
void g_malloc_test()
|
||||||
|
@ -366,3 +372,32 @@ void g_error_new_test()
|
||||||
printf("%p", pNew2);
|
printf("%p", pNew2);
|
||||||
// cppcheck-suppress memleak
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue