gtk.cfg: Add type conversion macros
Reference: https://developer.gnome.org/glib/stable/glib-Type-Conversion-Macros.html daca@home found that they are missing.
This commit is contained in:
parent
a6fa13b25f
commit
4dae640e8c
|
@ -9,6 +9,13 @@
|
|||
<define name="G_CALLBACK(cb)" value="cb"/>
|
||||
<define name="G_LIKELY(expr)" value="(expr)"/>
|
||||
<define name="G_UNLIKELY(expr)" value="(expr)"/>
|
||||
<!-- https://developer.gnome.org/glib/stable/glib-Type-Conversion-Macros.html -->
|
||||
<define name="GINT_TO_POINTER(i)" value="((gpointer) (glong) (i))"/>
|
||||
<define name="GPOINTER_TO_INT(p)" value="((gint) (glong) (p))"/>
|
||||
<define name="GUINT_TO_POINTER(u)" value="((gpointer) (gulong) (u))"/>
|
||||
<define name="GPOINTER_TO_UINT(p)" value="((guint) (gulong) (p))"/>
|
||||
<define name="GSIZE_TO_POINTER(s)" value="((gpointer) (gsize) (s))"/>
|
||||
<define name="GPOINTER_TO_SIZE(p)" value="((gsize) (p))"/>
|
||||
<!-- https://developer.gnome.org/glib/stable/glib-I18N.html -->
|
||||
<!-- Using something similar to the gi18n-lib.h macro value here to avoid dependencies to gettext() -->
|
||||
<define name="_(string)" value="((char *) g_dgettext(NULL, string))"/>
|
||||
|
|
|
@ -32,6 +32,10 @@ void validCode(int argInt)
|
|||
// cppcheck-suppress checkLibraryNoReturn
|
||||
g_assert_not_reached();
|
||||
}
|
||||
gpointer p = GINT_TO_POINTER(1);
|
||||
int i = GPOINTER_TO_INT(p);
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (i == 1) {}
|
||||
}
|
||||
|
||||
void g_malloc_test()
|
||||
|
|
Loading…
Reference in New Issue