Tk Source Code

View Ticket
Login
Ticket UUID: 0c734dde2ac835371232bb544a25a1b481354910
Title: Xlib.h: avoid -Wstrict-prototypes warnings
Type: Patch Version: 8.6.13
Submitter: chrstphrchvz Created on: 2023-04-14 15:13:25
Subsystem: 81. Portability Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2023-04-17 13:10:51
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2023-04-17 13:10:51
Description:

Would it be okay to backport certain Xlib.h changes to 8.6 so as to avoid warnings from -Wstrict-prototypes (at least with newer Clang)?

Newer Xlib.h removes a number of fields from the public declaration of Display. There is one instance where cursor_font is written (TkpOpenDisplay() in tkWinX.c), but it is never read from, so maybe it can be removed.

See attached patch.

User Comments: jan.nijtmans added on 2023-04-17 13:10:51:

Fixed [80e5be23a91a8273|here]. Also, a lot of other changes in X11R6 were backported tom Tk's Xlib.h, it might help to improve the compatibility between Tk extensions based on X11 with those on Win32/MacOS.

Thanks for the suggestion!


chrstphrchvz added on 2023-04-14 15:21:08:

The warnings, for reference:

X11/Xlib.h:131:21: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        int (*free_private)();  /* called to free private storage */
                           ^
                            void
X11/Xlib.h:334:33: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        struct _XImage *(*create_image)();
                                       ^
                                        void
X11/Xlib.h:453:23: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        XID (*resource_alloc)(); /* allocator function */
                             ^
                              void
X11/Xlib.h:471:20: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        int (*synchandler)();   /* Synchronization handler */
                          ^
                           void
X11/Xlib.h:496:24: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        Bool (*event_vec[128])();  /* vector for wire to event */
                              ^
                               void
X11/Xlib.h:497:25: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        Status (*wire_vec[128])(); /* vector for event to wire */
                               ^
                                void
X11/Xlib.h:509:20: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        Bool (**error_vec)();      /* vector for wire to error */
                          ^
                           void
X11/Xlib.h:522:25: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        int (*savedsynchandler)(); /* user synchandler when Xlib usurps */
                               ^
                                void
X11/Xlib.h:1053:24: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef void (*XIMProc)();
                       ^
                        void
9 warnings generated.


Attachments: