Skip to content

Fix GCC warning causing the build to fail with -Werror

Emanuele Aina requested to merge wip/em/fix-build into apertis/v2020dev0

Builds were failing:

In file included from /usr/include/glib-2.0/glib/glist.h:32,
                 from /usr/include/glib-2.0/glib/ghash.h:33,
                 from /usr/include/glib-2.0/glib.h:50,
                 from /usr/include/glib-2.0/gobject/gbinding.h:28,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /usr/include/glib-2.0/gio/gioenums.h:28,
                 from /usr/include/glib-2.0/gio/giotypes.h:28,
                 from /usr/include/glib-2.0/gio/gio.h:26,
                 from src/app-db.h:14,
                 from src/app-db.c:13:
src/app-db.c: In function ‘frome_app_db_find_entry’:
/usr/include/glib-2.0/glib/gmem.h:212:30: error: returning ‘GomResource *’ {aka ‘struct _GomResource *’} from a function with incompatible return type ‘FromeAppDBEntry *’ {aka ‘struct _FromeAppDBEntry *’} [-Werror=incompatible-pointer-types]
 #define g_steal_pointer(pp) ((__typeof__(*pp)) (g_steal_pointer) (pp))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app-db.c:213:10: note: in expansion of macro ‘g_steal_pointer’
   return g_steal_pointer (&entry);
          ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1748: src/libfrome_internal_la-app-db.lo] Error 1

The code was correct since FromeAppDBEntry is a GomResource subclass, but add a FROME_APP_DB_ENTRY() cast to make things a bit more robust and make the compiler happy.

Merge request reports