Re: Successfully defining png_int_16 in pngconf.h

Michael Enright <[email protected]> Fri, 15 Feb 2019 09:31:54 -0800
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAOC2fq9-ge3W7vs5KXzOK8zXvr9fk9+o+t5ro9DfpFyc2z8iyg@mail.gmail.com>
On Thu, Feb 14, 2019 at 7:11 PM Cosmin Truta <[email protected]> wrote:
>
> I thought that gcc was a requirement to compile linux/kernel.h. If
> that's still the case, this should not have been an issue, because gcc
> has an internally-predefined macro __INT_MAX__ (and others) that can
> be used.
>

Thanks for researching the standard's words.

GCC is currently the primary Linux compiler, but it appears that
Google and Linaro are definitely trying to elevate the status of
clang, and devices are shipping with *Android* kernels compiled with
clang. See https://www.phoronix.com/scan.php?page=news_item&px=Clang-Kernel-2018
for a summary from this past November. My impression is that this is
not yet mainstream.

Back in my world, where Linux 2.6.31.1 is a thing, and standards I
wish I could take for granted have yet to have effect,

A kernel patch would have to be developed and approved for a bunch of
kernel versions. The line where INT_MAX is defined is the same from
2.6.31.1 until now (master branch on github.com/torvalds).

I would not want to add to my troubles by using the
__DOUBLE__UNDERSCORE__ symbols of a particular compiler on a new
source code line. My understanding of those names is they are not
meant to be referred to except within the implementation of the
standard libraries. The linux kernel header linux/types.h defines
typedefs that could be used to define most or all of the png_
typedefs. The typedefs have the same names as stdint.h defines. I did
a trial compile by using them in pngconf.h but it's not just a
one-line change. I want to show my colleagues the minumum that would
work.