Bug 271520 - graphics/sdl_image: fix build with clang 16
Summary: graphics/sdl_image: fix build with clang 16
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-05-19 20:16 UTC by Dimitry Andric
Modified: 2023-05-24 14:36 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (amdmi3)


Attachments
graphics/sdl_image: fix build with clang 16 (7.73 KB, patch)
2023-05-19 20:16 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-05-19 20:16:14 UTC
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.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-19 20:16:35 UTC
Created attachment 242287 [details]
graphics/sdl_image: fix build with clang 16
Comment 2 Dmitry Marakasov freebsd_committer freebsd_triage 2023-05-24 14:36:32 UTC
Thanks! I've used simpler IMG_png patch, we don't need to check for older png versions.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-05-24 14:36:42 UTC
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(+)