Skip to content

Conversation

@zixu-w
Copy link
Contributor

@zixu-w zixu-w commented Jan 18, 2024

In a similar manner as zlib (madler/zlib#895), libpng contains a header configuration that's no longer valid and hasn't been exercised for the macOS target.

  • The target OS conditional macros are misused. Specifically TARGET_OS_MAC covers all Apple targets, including iOS, and it should not be checked with #if defined as they would always be defined (to either 1 or 0) on Apple platforms.
  • #include <fp.h> no longer works for the macOS target and results in a compilation failure. macOS ships all required functions in math.h, and clients should use math.h instead.

This problem has not been noticed until a recent extension in clang (llvm/llvm-project#74676) exposed the issue and broke libpng builds on Apple platforms. The failure can be reproduced now by adding #include <TargetConditionals.h> before the block.

In a similar manner as zlib (madler/zlib#895),
libpng contains a header configuration that's no longer valid and
hasn't been exercised for the macOS target.

- The target OS conditional macros are misused. Specifically
  `TARGET_OS_MAC` covers all Apple targets, including iOS, and it
  should not be checked with `#if defined` as they would always be
  defined (to either 1 or 0) on Apple platforms.
- `#include <fp.h>` no longer works for the macOS target and results
  in a compilation failure. macOS ships all required functions in
  `math.h`, and clients should use `math.h` instead.

This problem has not been noticed until a recent extension in clang
(llvm/llvm-project#74676) exposed the issue
and broke libpng builds on Apple platforms. The failure can be
reproduced now by adding `#include <TargetConditionals.h>` before the
block.
Copy link
Member

@ctruta ctruta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ctruta
Copy link
Member

ctruta commented Jan 18, 2024

Thank you very much for making the kind of contribution that I personally like the most: deleting code that should no longer be in there 😛

I landed your commit with your name added to the AUTHORS file, but may I please kindly ask for the native spelling of your name as well? Although that file is in ASCII right now, I want to convert it to Markdown and Unicode, eventually.

@ctruta ctruta closed this Jan 18, 2024
@zixu-w
Copy link
Contributor Author

zixu-w commented Jan 18, 2024

Thanks for the quick review!

FYI: 王子旭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants