Skip to content

An incompatible-pointer-types in pTk/Xlib.t that induces an error with gcc 14 #106

@cessenat

Description

@cessenat

In file pTk/Xlib.t line 334 there is
VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned int, int)))
which, at compile time, induces with gcc 11.3 on Ubuntu 22.04

x86_64-linux-gnu-gcc -c  -I..  -I. -Ibitmaps  -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"804.036\" -DXS_VERSION=\"804.036\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.34/CORE"    Xlib_f.c
In file included from Xlib_f.c:17:
Xlib.t:334:1: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
  334 | VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned int, int)))
      | ^~~~~
In file included from Xlib_f.c:4:
/usr/include/X11/Xlib.h:1687:15: note: declared here
 1687 | extern KeySym XKeycodeToKeysym(
      |               ^~~~~~~~~~~~~~~~
Xlib.t:334:14: warning: initialization of ‘KeySym (*)(Display *, unsigned int,  int)’ {aka ‘long unsigned int (*)(Display *, unsigned int,  int)’} from incompatible pointer type ‘KeySym (*)(Display *, KeyCode,  int)’ {aka ‘long unsigned int (*)(Display *, unsigned char,  int)’} [-Wincompatible-pointer-types]
  334 | VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned int, int)))
      |              ^~~~~~~~~~~~~~~~

while with gcc 14.1 on Fedora 40 the warning is now en error.

Therefore I would suggest to write instead
VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned char, int)))
to correct that.
What do you think @eserte ? Thanks.

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