Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GCC15] error: passing argument 2 of a_Timeout_add from incompatible pointer type [-Wincompatible-pointer-types] #322

Open
Kangie opened this issue Dec 12, 2024 · 1 comment
Labels
build Related with the build process

Comments

@Kangie
Copy link
Contributor

Kangie commented Dec 12, 2024

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -DDILLO_SYSCONF='"/etc/dillo/"' -DDILLO_DOCDIR='"/usr/share/doc/dillo-3.1.1/"' -DCUR_WORKING_DIR='"/var/tmp/portage/www-client/dillo-3.1.1/work/dillo-3.1.1/src"'   -I/usr/include/libpng16 -O2 -pipe -march=native -fno-diagnostics-color -DENABLE_I
cache.c: In function Cache_delayed_process_queue:
cache.c:1388:26: error: passing argument 2 of a_Timeout_add from incompatible pointer type [-Wincompatible-pointer-types]
 1388 |       a_Timeout_add(0.0, Cache_delayed_process_queue_callback, NULL);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See: https://bugs.gentoo.org/944457

@Kangie Kangie changed the title [GCC15] [GCC15] error: passing argument 2 of a_Timeout_add from incompatible pointer type [-Wincompatible-pointer-types] Dec 12, 2024
@rodarima
Copy link
Member

rodarima commented Dec 12, 2024

Not sure what the problem is here:

/* timeout.hh */
typedef void (*TimeoutCb_t)(void *data);
void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata);

/* cache.c */
static void Cache_delayed_process_queue_callback(void *ptr)
{
  /* ... */
}

static void Cache_delayed_process_queue(CacheEntry_t *entry)
{
   /* ... */
   a_Timeout_add(0.0, Cache_delayed_process_queue_callback, NULL);
   /* ... */
}

It is compiling ok on gcc trunk: https://godbolt.org/z/adPcq8G5d

(GCC 15 is not released yet)

Edit: Looking at the logs, it looks like a gcc bug:

cache.c: In function ‘Cache_delayed_process_queue’:
cache.c:1388:26: error: passing argument 2 of ‘a_Timeout_add’ from incompatible pointer type [-Wincompatible-pointer-types]
 1388 |       a_Timeout_add(0.0, Cache_delayed_process_queue_callback, NULL);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void (*)(void)
In file included from cache.c:37:
timeout.hh:10:41: note: expected ‘TimeoutCb_t’ {aka ‘void (*)(void *)’} but argument is of type ‘void (*)(void)’
   10 | void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata);
      |                             ~~~~~~~~~~~~^~
make[3]: *** [Makefile:691: cache.o] Error 1

The argument Cache_delayed_process_queue_callback seems to me to have type void (*)(void *).

@rodarima rodarima added the build Related with the build process label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related with the build process
Projects
None yet
Development

No branches or pull requests

2 participants