We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4311 - warnings when building against libpng-1.4/1.5
Summary: warnings when building against libpng-1.4/1.5
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Assignee: Ozkan Sezer
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-13 12:20 UTC by Ozkan Sezer
Modified: 2018-10-23 20:01 UTC (History)
0 users

See Also:


Attachments
IMG_png warnings patch (8.01 KB, patch)
2018-10-13 12:20 UTC, Ozkan Sezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2018-10-13 12:20:06 UTC
Created attachment 3371 [details]
IMG_png warnings patch

When building against libpng-1.4/1.5 with --disable-png-shared, warnings
are emitted:
I20/IMG_png.c:145: warning: assignment from incompatible pointer type
I20/IMG_png.c:146: warning: assignment from incompatible pointer type
I20/IMG_png.c:147: warning: assignment from incompatible pointer type
I20/IMG_png.c:148: warning: assignment from incompatible pointer type

Some libpng functions take non-const args in 1.2..1.5, but take const
args in 1.6.  To make it worse, some funcs, e.g. png_get_PLTE(), take
const args in 1.4..1.5 but take non-const args in 1.6+, like:
1.4/1.5: (png_const_structp , png_const_infop, png_colorp *, int *)
1.6/1.7: (png_const_structrp, png_inforp     , png_colorp *, int *)

I came up with the following quick'n'dirty patch, which adds noconst15
and noconst16 to affected function pointer typedefs:
noconst15: version < 1.6 doesn't have const, >= 1.6 adds it
noconst16: version < 1.6 does have const, >= 1.6 removes it

Should I apply, or should we live with the warnings (which would break
builds if one uses -Werror) ?
Comment 1 Ozkan Sezer 2018-10-23 20:01:18 UTC
Went ahead and applied this:
http://hg.libsdl.org/SDL_image/rev/89225c8816d6
http://hg.libsdl.org/SDL_image/rev/fa3c53a205a9