gtk.cfg: Add more details for g_print() and g_printerr()

Reference:
https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-print
This commit is contained in:
versat 2019-02-18 16:48:46 +01:00
parent 8fb4e7dde8
commit dc63cb9f98
2 changed files with 25 additions and 5 deletions

View File

@ -2307,13 +2307,19 @@
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<function name="g_print">
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<function name="g_printerr">
<!-- void g_print (const gchar *format, ...); -->
<!-- void g_printerr (const gchar *format, ...); -->
<function name="g_print,g_printerr">
<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="void"/>
<formatstr/>
<arg nr="1">
<not-null/>
<not-uninit/>
<formatstr/>
<strz/>
</arg>
</function>
<function name="g_printf">
<leak-ignore/>

View File

@ -8,6 +8,8 @@
//
#include <gtk/gtk.h>
#include <glib.h>
void validCode(int argInt)
{
@ -36,6 +38,10 @@ void validCode(int argInt)
int i = GPOINTER_TO_INT(p);
// cppcheck-suppress knownConditionTrueFalse
if (i == 1) {}
g_print("test");
g_print("%d", 1);
g_printerr("err");
}
void g_malloc_test()
@ -56,3 +62,11 @@ void g_assert_test()
// cppcheck-suppress assignmentInAssert
g_assert(a = 5);
}
void g_print_test()
{
// cppcheck-suppress invalidPrintfArgType_uint
g_print("%u", -1);
// cppcheck-suppress invalidPrintfArgType_uint
g_printerr("%x", "a");
}