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

-Wincompatible-function-pointer-types warnings (becomes fatal with upcoming Clang 16) #50

Open
thesamesam opened this issue Oct 4, 2022 · 3 comments

Comments

@thesamesam
Copy link
Contributor

Originally reported downstream in Gentoo at https://bugs.gentoo.org/870565 when building 3.9.2.

Clang 16 makes -Wincompatible-function-pointer-types fatal. I had the following errors when building mlterm:

bl_conf.c:146:3: warning: comparison of distinct pointer types ('int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') and 'int (*)(int, u_int)' (aka 'int (*)(int, unsigned int)')) [-Wcompare-distinct-pointer-types]
  bl_map_set(result, conf->conf_entries, key, entry);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:141:30: note: expanded from macro 'bl_map_set'
        if ((map)->hash_func == bl_map_hash_int || (map)->hash_func == bl_map_hash_int_fast) { \
            ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
bl_conf.c:146:3: warning: comparison of distinct pointer types ('int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') and 'int (*)(int, u_int)' (aka 'int (*)(int, unsigned int)')) [-Wcompare-distinct-pointer-types]
  bl_map_set(result, conf->conf_entries, key, entry);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:141:69: note: expanded from macro 'bl_map_set'
        if ((map)->hash_func == bl_map_hash_int || (map)->hash_func == bl_map_hash_int_fast) { \
                                                   ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
bl_conf.c:146:3: error: incompatible function pointer types assigning to 'int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') from 'int (int, u_int)' (aka 'int (int, unsigned int)') [-Wincompatible-function-pointer-types]
  bl_map_set(result, conf->conf_entries, key, entry);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:143:30: note: expanded from macro 'bl_map_set'
            (map)->hash_func = bl_map_hash_int;                                                \
                             ^ ~~~~~~~~~~~~~~~
bl_conf.c:146:3: error: incompatible function pointer types assigning to 'int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') from 'int (int, u_int)' (aka 'int (int, unsigned int)') [-Wincompatible-function-pointer-types]
  bl_map_set(result, conf->conf_entries, key, entry);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:146:30: note: expanded from macro 'bl_map_set'
            (map)->hash_func = bl_map_hash_int_fast;                                           \
                             ^ ~~~~~~~~~~~~~~~~~~~~
bl_conf.c:205:3: warning: comparison of distinct pointer types ('int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') and 'int (*)(int, u_int)' (aka 'int (*)(int, unsigned int)')) [-Wcompare-distinct-pointer-types]
  bl_map_new_with_size(char *, bl_conf_entry_t *, conf->conf_entries, bl_map_hash_str,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:50:21: note: expanded from macro 'bl_map_new_with_size'
    if (__hash_func == bl_map_hash_int) {                                                \
        ~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
bl_conf.c:205:3: error: incompatible function pointer types assigning to 'int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') from 'int (int, u_int)' (aka 'int (int, unsigned int)') [-Wincompatible-function-pointer-types]
  bl_map_new_with_size(char *, bl_conf_entry_t *, conf->conf_entries, bl_map_hash_str,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:52:26: note: expanded from macro 'bl_map_new_with_size'
        (map)->hash_func = bl_map_hash_int;                                              \
                         ^ ~~~~~~~~~~~~~~~
bl_conf.c:205:3: error: incompatible function pointer types assigning to 'int (*)(char *, u_int)' (aka 'int (*)(char *, unsigned int)') from 'int (int, u_int)' (aka 'int (int, unsigned int)') [-Wincompatible-function-pointer-types]
  bl_map_new_with_size(char *, bl_conf_entry_t *, conf->conf_entries, bl_map_hash_str,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./bl_map.h:55:26: note: expanded from macro 'bl_map_new_with_size'
        (map)->hash_func = bl_map_hash_int_fast;                                         \
                         ^ ~~~~~~~~~~~~~~~~~~~~
4 warnings and 4 errors generated.

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

@arakiken
Copy link
Owner

Thanks.
I fixed incompatible function pointer types error.
dbf581c

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 4, 2023
pkgsrc changes:
* make mlconfig.po installed properly (#66)
* remove local patches integrated into upstream

Upstream changes (noted in doc/en/ReleaseNote):

ver 3.9.3
* mlterm-wl supports xdg-decoration.
* Add --disable-compact-truecolor option to ./configure script.
* Add vte 0.68 API symbols to libvte compatible library.
* Add libvterm 0.2 API symbols to libvterm compatible library.
* Add --sdpr / simple_scrollbar_dpr option.
  (arakiken/mlterm#64)
* Set "COLORTERM=truecolor" environmental variable.
  (arakiken/mlterm#36)
* Update unicode property table (generated from UnicodeData.txt and
  EastAsianWidth.txt) to version 15.0.0.
* Support mosh-1.4.0.
* Merge patches:
  arakiken/mlterm#45.
  arakiken/mlterm#46.
  arakiken/mlterm#48.
  arakiken/mlterm#49.
  arakiken/mlterm#55. (Add --role / wm_role option)
  arakiken/mlterm#57.
  arakiken/mlterm#61.
  arakiken/mlterm#62.
  arakiken/mlterm#63.
* Bug fixes:
  Fix arakiken/mlterm#34.
  Fix arakiken/mlterm#35.
  Fix arakiken/mlterm#39.
  Fix arakiken/mlterm#44.
  Fix arakiken/mlterm#50.
  Fix arakiken/mlterm#51.
  Fix arakiken/mlterm#53.
  Fix https://twitter.com/isaki68k/status/1555895011991883783.
  Fix segfault in starting mlterm with --dyncomb and --otl.
@thesamesam
Copy link
Contributor Author

We seem to still be seeing this in ui_window_cairo.c (https://bugs.gentoo.org/919221):

ui_window_cairo.c:57:12: error: incompatible pointer to integer conversion
      initializing 'u_long' (aka 'unsigned long') with an expression of type
      'void *' [-Wint-conversion]
   57 |     u_long pixel = cairo_get_user_data(cr, (cairo_user_data_key_t*)2);
      |            ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ui_window_cairo.c:112:25: warning: cast to 'void *' from smaller integer type
      'int' [-Wint-to-void-pointer-cast]
  112 |                         (void*)((fg_color->red << 16) | (fg_color->green << 8) |
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  113 |                                 (fg_color->blue) | (fg_color->alpha << 24)),
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ui_window_cairo.c:205:25: warning: cast to 'void *' from smaller integer type
      'int' [-Wint-to-void-pointer-cast]
  205 |                         (void*)((fg_color->red << 16) | (fg_color->green << 8) |
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  206 |                                 (fg_color->blue) | (fg_color->alpha << 24)),
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GCC 14 will make this an error by default.

@arakiken
Copy link
Owner

Thanks.
This error has been already fixed. -> f971955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants