Clang 16 has a new error about incompatible function types, which shows up when building graphics/sdl_image: IMG_png.c:266:30: error: incompatible function pointer types assigning to 'png_infop (*)(png_structp)' (aka 'struct png_info_def *(*)(struct png_struct_def *)') from 'png_infop (png_const_structrp)' (aka 'struct png_info_def *(const struct png_struct_def *restrict)') [-Wincompatible-function-pointer-types] lib.png_create_info_struct = png_create_info_struct; ^ ~~~~~~~~~~~~~~~~~~~~~~ IMG_png.c:269:20: error: incompatible function pointer types assigning to 'png_uint_32 (*)(png_structp, png_infop, png_uint_32 *, png_uint_32 *, int *, int *, int *, int *, int *)' (aka 'unsigned int (*)(struct png_struct_def *, struct png_info_def *, unsigned int *, unsigned int *, int *, int *, int *, int *, int *)') from 'png_uint_32 (png_const_structrp, png_const_inforp, png_uint_32 *, png_uint_32 *, int *, int *, int *, int *, int *)' (aka 'unsigned int (const struct png_struct_def *restrict, const struct png_info_def *restrict, unsigned int *, unsigned int *, int *, int *, int *, int *, int *)') [-Wincompatible-function-pointer-types] lib.png_get_IHDR = png_get_IHDR; ^ ~~~~~~~~~~~~ Similar errors occur for IMG_webp.c. I backported a few changes from SDL_image 2 that fix the prototypes to be compatible with the versions of graphics/png and and graphics/webp.
Created attachment 242287 [details] graphics/sdl_image: fix build with clang 16
Thanks! I've used simpler IMG_png patch, we don't need to check for older png versions.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=9b762306ec7d96352d13eb62f42697c2ad65a23f commit 9b762306ec7d96352d13eb62f42697c2ad65a23f Author: Dmitry Marakasov <amdmi3@FreeBSD.org> AuthorDate: 2023-05-24 14:32:38 +0000 Commit: Dmitry Marakasov <amdmi3@FreeBSD.org> CommitDate: 2023-05-24 14:33:49 +0000 graphics/sdl_image: fix build with clang 16 Use correct png and webp function prototypes PR: 271520 Submitted by: dim graphics/sdl_image/files/patch-IMG__png.c (new) | 55 ++++++++++++++++++++++++ graphics/sdl_image/files/patch-IMG__webp.c (new) | 15 +++++++ 2 files changed, 70 insertions(+)