change TARGET_OS_IPHONE preprocessor handling#931
Merged
mflatt merged 1 commit intocisco:mainfrom Apr 7, 2025
Merged
Conversation
Bogdanp
reviewed
Apr 3, 2025
c/version.h
Outdated
| #define IEEE_DOUBLE | ||
| /* for both iPhone and iPhoneSimulator */ | ||
| #if defined(TARGET_OS_IPHONE) | ||
| #if TARGET_OS_IPHONE |
Contributor
There was a problem hiding this comment.
When I build this patch on my machine with clang 16, I get warnings like:
gcc -DPORTABLE_BYTECODE -Ipb/boot/pb -Ipb/c -Ic/ -Ipb/zlib -Ipb/lz4/lib -arch arm64 -O2 -Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough -o pb/c/pb.o -c c/pb.c
In file included from c/pb.c:1:
In file included from c/system.h:29:
c/version.h:314:5: warning: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
314 | #if TARGET_OS_IPHONE
| ^
1 warning generated.
Maybe it would be better to go with #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE instead?
Contributor
Author
There was a problem hiding this comment.
Ugh, ok. I actually tried looking at documentation to make sure that -Wall and -Wextra do not imply -Wundef, and I ran some experiments to check my conclusion. But I had never heard of -Wundef-prefix, and it didn't occur to me that I would need to experiment with a name that starts TARGET_OS_. Thanks again, Apple.
TARGET_OS_IPHONE from #ifdef to #ifTARGET_OS_IPHONE preprocessor handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recent versions of the build tools on macOS define
TARGET_OS_IPHONEas 0 when not compiling for iOS.Closes #896 and #928