Skip to content

pqiv.c fails to compile in c23 mode: pqiv.c:4246:62: error: passing argument 2 of ‘g_timeout_add’ from incompatible pointer type #251

@NHOrus

Description

@NHOrus

Full error text:

pqiv.c:4246:62: error: passing argument 2 of ‘g_timeout_add’ from incompatible pointer type [-Wincompatible-pointer-types]
 4246 |         fullscreen_transition_source_id = g_timeout_add(500, window_fullscreen_helper_reset_transition_id, NULL);
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                              |
      |                                                              gboolean (*)(void) {aka int (*)(void)}
/usr/include/glib-2.0/glib/gmain.h:878:54: note: expected ‘GSourceFunc’ {aka ‘int (*)(void *)’} but argument is of type ‘gboolean (*)(void)’ {aka ‘int (*)(void)’}
  878 |                                      GSourceFunc     function,
      |                                      ~~~~~~~~~~~~~~~~^~~~~~~~
/home/nho/workshop/pqiv/pqiv.c:4162:10: note: ‘window_fullscreen_helper_reset_transition_id’ declared here
 4162 | gboolean window_fullscreen_helper_reset_transition_id() {/*{{{*/
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmain.h:199:20: note: ‘GSourceFunc’ declared here
  199 | typedef gboolean (*GSourceFunc)       (gpointer user_data);
      |                    ^~~~~~~~~~~

Fix: change definition to
window_fullscreen_helper_reset_transition_id(void *)
Does exactly same thing, but conforms to standards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions