Build failure with upcoming Clang 16 (-Wincompatible-function-pointer-types)

GitHub issues - opened github at alsa-project.org
Sat Nov 12 00:29:15 CET 2022


alsa-project/alsa-tools issue #12 was opened from thesamesam:

Clang 16 will make -Wincompatible-function-pointer-types an error by default.

You can emulate this error using:
* GCC via -Werror=incompatible-pointer-types (GCC lacks a more specific warning for just func. ptrs)
* Clang <16 via -Werror=incompatible-function-pointer-types

Originally reported downstream in Gentoo at https://bugs.gentoo.org/880997.

```
echomixer.c:2108:7: error: incompatible function pointer types passing 'void
      (GtkWidget *, gpointer)' (aka 'void (struct _GtkWidget *, void *)') to
      parameter of type 'GCallback' (aka 'void (*)(void)')
      [-Werror,-Wincompatible-function-pointer-types]
  ...gtk_signal_connect(GTK_OBJECT(menuitem), "activate", Digital_mode_activate, (gpointer)(long)i);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/gtk-2.0/gtk/gtksignal.h:51:47: note: expanded from macro
      'gtk_signal_connect'
   gtk_signal_connect_full ((object), (name), (func), NULL, (func_data)...
                                              ^~~~~~
/usr/include/gtk-2.0/gtk/gtksignal.h:123:23: note: passing argument to parameter
      'func' here
                                                 GCallback           func,
                                                                     ^
[...]
```

Full build log: https://bugs.gentoo.org/attachment.cgi?id=831477

Issue URL     : https://github.com/alsa-project/alsa-tools/issues/12
Repository URL: https://github.com/alsa-project/alsa-tools


More information about the Alsa-devel mailing list