-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libpng18] [build system] Require ISO-C when building libpng #603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I agree with the intention.
Unless there is some important government contract or similar obligating pre-ISO-C support, I don't think the cost of maintaining this support is worth it.
There isn't. It was always available as a "suck it and see" option. Traditionally the response to, "I sucked and got sick" was that the maintainer would either attempt to fix it or say, "You need to use an ANSI-C compiler." My patch removes the privilege of appealing to the maintainer. Compiles fail if the compiler fails to define |
fc4423b
to
17822c6
Compare
17822c6
to
830240e
Compare
d05cf86
to
90260b6
Compare
Previously the build systems would accept any old compiler and those compilers would define any old symbol or macro name. ISO (well, ANSI) defined a strict set of symbols/macros which may be defined by the implementation leaving the remainder for application programs. Adding a requirement for an ISO-C compiler (any version) ensures that a check for name clashes on one compiler (with a sufficient level of diagnostics) works for every ISO-C compiler. In other words if it builds on one it builds on all. The check is in pngpriv.h; the same restrictions do not apply to code that calls the public interface of libpng, only to the compiler used to build ligpng. Signed-off-by: John Bowler <[email protected]>
90260b6
to
bb84942
Compare
* standard (C89, ISO-C90) is required. | ||
*/ | ||
#if __STDC__ != 1 | ||
# error A compiler compliant with ISO-C90 is required to build libpng |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thumb up on the principle that we're straight-up requiring a modern C compiler 👍
...and...
One thumb down on the technicality that neither __STDC__
nor __STDC_VERSION__
are mandatory for a standard-conforming C compiler (at least in my interpretation of their meaning), and that, indeed, some compilers that do support C99 and newer (e.g. Microsoft C/C++ and Borland C/C++) do not define __STDC__
👎
I might be persuaded to accept code that checks both __STDC__
and __STDC_VERSION__
, and aborts the compilation if both of these symbols are missing; but even that is debatable.
The good news is that we don't need this change: we don't accept code that caters to the pre-ANSI C compilers, and that is that. In any case, libpng16 is already pretty much cleared of pre-ANSI C constructs.
The bad news is that I need to reopen #601; but the good news to the bad news is that the fix for #601 is rather trivial.
One more thing before I close this PR as WONTFIX: I'll be happy to accept, with both of my thumbs up and both of my palms open, any code contribution that consists in removing pre-ANSI C "compatibility" noise (of whose existence I might be unaware), in libpng16 (conditionally, if it doesn't break the ABI) and in libpng18 (unconditionally). |
Previously the build systems would accept any old compiler and those
compilers would define any old symbol or macro name. ISO (well, ANSI)
defined a strict set of symbols/macros which may be defined by the
implementation leaving the remainder for application programs.
Adding a requirement for an ISO-C compiler (any version) ensures that a
check for name clashes on one compiler (with a sufficient level of
diagnostics) works for every ISO-C compiler. In other words if it
builds on one it builds on all.
The check is in pngpriv.h; the same restrictions do not apply to code
that calls the public interface of libpng, only to the compiler used to
build ligpng.
Signed-off-by: John Bowler [email protected]