garrigue / lablgtk

LablGTK 2 and 3: an interface to the GIMP Tool Kit
https://garrigue.github.io/lablgtk
Other
89 stars 40 forks source link

Fix incompatible pointer type error #175

Closed jamesjer closed 1 month ago

jamesjer commented 5 months ago

The Fedora project is starting to build packages with a GCC 14 prerelease. It is pickier about incompatible types than previous versions. Building lablgtk3 3.1.4 yields this error:

ml_gtk.c: In function ‘ml_gtk_style_context_list_classes’:
wrappers.h:422:20: error: passing argument 2 of ‘Val_GList’ from incompatible pointer type [-Wincompatible-pointer-types]
  422 | #define Val_string copy_string_check
      |                    ^~~~~~~~~~~~~~~~~
      |                    |
      |                    value (*)(const char *) {aka long int (*)(const char *)}
ml_gtk.c:236:78: note: in expansion of macro ‘Val_string’
  236 | { return Val_GList(gtk_style_context_list_classes(GtkStyleContext_val(ctx)), Val_string); }
      |                                                                              ^~~~~~~~~~
In file included from ml_gtk.c:37:
ml_glib.h:30:42: note: expected ‘value_in’ {aka ‘long int (*)(void *)’} but argument is of type ‘value (*)(const char *)’ {aka ‘long int (*)(const char *)’}
   30 | CAMLexport value Val_GList (GList *list, value_in);
      |                                          ^~~~~~~~

Completely unrelated, but I would also like to point out that dune-project still has (version 3.1.2).

vbgl commented 5 months ago

I’ve observed the same error with Clang 16.0.6:

ml_gtk.c:236:78: error: incompatible function pointer types passing 'value (const char )' (aka 'long (const char )') to parameter of type 'value_in' (aka 'long ()(void )') [-Wincompatible-function-pointer-types] { return Val_GList(gtk_style_context_list_classes(GtkStyleContext_val(ctx)), Val_string); } ^~~~~~ ./wrappers.h:422:20: note: expanded from macro 'Val_string'

define Val_string copy_string_check

^~~~~ ./ml_glib.h:30:50: note: passing argument to parameter here CAMLexport value Val_GList (GList *list, value_in); ^

garrigue commented 1 month ago

Already fixed in fix to #178.