Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 383783

Summary: media-libs/libpng: should not use macro OF
Product: Gentoo Linux Reporter: Martin von Gagern <Martin.vGagern>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: CONFIRMED ---    
Severity: trivial CC: codec, pacho
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 383179    
Bug Blocks:    

Description Martin von Gagern 2011-09-20 07:31:32 UTC
/usr/include/libpng15/pngconf.h from media-libs/libpng-1.5.4 declares its PNGARG macro to equal the OF macro from zlib if the latter has been defined. Bug 383179 gets rid of that macro, renaming it to _Z_OF instead, and argues that OF is such a common name that applications should be allowed to use it freely.

So by the same argument, libpng shouldn't be using that macro if it is available, because as applications start using that name for their own purposes, the fact that it is defined says nothing about its semantics. Furthermore, there is nothing to be gained from using it, as there are very few non-standard K&R style compilers out there (does Gentoo support any of them? I doubt it!), and even for those, the _NO_PROTO switch should be sufficient to make PNGARG do the appropriate thing.

While packages are being converted to work around bug 383179, they might be tempted to #define OF _Z_OF or, equivalently, add -DOF=_Z_OF to their preprocessor flags. If one of those packages includes the png headers but fails to include the zlib ones, then OF is defined but _Z_OF is not, causing the latter to remain in place, which can lead to strange errors. Yes I know, this practice should be discouraged in any case, but nevertheless, users trying this might lead to strange reports like my own sad bug #383731.
Comment 1 SpanKY gentoo-dev 2011-09-20 17:09:22 UTC
we can probably have the ebuild force:
#define PNGARG(x) x
Comment 2 Pacho Ramos gentoo-dev 2018-04-18 08:57:10 UTC
it looks solved in 1.6.34