Skip to content

CoreFoundation: handle LLP64 as LP64 #1808

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

Merged
merged 1 commit into from
Dec 17, 2018
Merged

Conversation

compnerd
Copy link
Member

Adjust the various sites that consider LP64 to also consider LLP64
environments. This is needed to support Windows x86_64. Normalize the checks
across the code base to use TARGET_RT_64_BIT which is defined in
TargetConditionals.h.

@compnerd
Copy link
Member Author

CC: @parkera @millenomi @phausler

@compnerd
Copy link
Member Author

@swift-ci please test

@@ -9,6 +9,7 @@
Original author: Zhi Feng Huang
*/

#include <CoreFoundation/TargetConditionals.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

We cant do this since it only exists on non-darwin platforms. The Darwin variant is just <TargetConditionals.h> additionally the proper TargetConditionals header should be included by CFBase.h so any additions should not be needed.

This applies to all other instances of the addition of this header.

Copy link
Contributor

Choose a reason for hiding this comment

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

even though TARGET_RT_64_BIT is ok, the CoreFoundation/TargetConditionals thing still holds. These header includes would be a breaking change for cycling back to the Darwin implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I'll adjust the sites to use CFBase.h instead. The locations that I included this header were not already including CFBase.h.

@@ -229,7 +229,7 @@ extern void __CFGenericValidateType_(CFTypeRef cf, CFTypeID type, const char *fu
#define __CFBitfield64GetValue(V, N1, N2) (((V) & __CFBitfield64Mask(N1, N2)) >> (N2))
#define __CFBitfield64SetValue(V, N1, N2, X) ((V) = ((V) & ~__CFBitfield64Mask(N1, N2)) | ((((uint64_t)X) << (N2)) & __CFBitfield64Mask(N1, N2)))

#if __LP64__ || DEPLOYMENT_TARGET_ANDROID
#if TARGET_RT_64_BIT || DEPLOYMENT_TARGET_ANDROID
Copy link
Contributor

Choose a reason for hiding this comment

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

TARGET_ are usually only from TargetConditionals.h which CoreFoundation does not control on Darwin. So we probably need to first define something along the lines of CFRUNTIME_64BIT. Additionally this should be defined if it does not get defined in a public header; CFBase.h is a good spot to do this.

#ifndef CFRUNTIME_64BIT
#if __LLP64__ || __LP64__
#define CFRUNTIME_64BIT 1
#else
#define CFRUNTIME_64BIT 0
#endif
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I take that back: TARGET_RT_64_BIT is defined by TargetConditionals on Darwin.

Do we have that defined in <CoreFoundation/TargetConditionals.h>?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that is defined in the <CoreFoundation/TargetConditionals.h> header.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@phausler - does this look good now? or are there other changes to be made?

Copy link
Contributor

@phausler phausler left a comment

Choose a reason for hiding this comment

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

looks good to me

Adjust the various sites that consider LP64 to also consider LLP64
environments.  This is needed to support Windows x86_64.  Normalize the checks
across the code base to use `TARGET_RT_64_BIT` which is defined in
TargetConditionals.h.
@compnerd
Copy link
Member Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit e216c61 into swiftlang:master Dec 17, 2018
@compnerd compnerd deleted the llp64-is-64 branch December 17, 2018 23:11
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.

3 participants