Skip to content

Commit 18b9686

Browse files
committed
Enable 64bit enums on Windows and Fix CFDateComponentUndefined
Since CoreFoundation on Windows doesn't compile with cplusplus and doesn't have objc_fixed_enum, it goes down the wrong path for enums and defaults them to a 32 bit backing. This causes CFDateComponentUndefined to be 32bit value which then doesn't match NSDateComponentUndefined which is an Int64.
1 parent fff2489 commit 18b9686

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CoreFoundation/Base.subproj/CFAvailability.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
#endif
124124

125125
#define __CF_ENUM_GET_MACRO(_1, _2, NAME, ...) NAME
126-
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
126+
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && (__has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum)))
127127
#define __CF_NAMED_ENUM(_type, _name) enum __CF_ENUM_ATTRIBUTES _name : _type _name; enum _name : _type
128128
#define __CF_ANON_ENUM(_type) enum __CF_ENUM_ATTRIBUTES : _type
129129
#define CF_CLOSED_ENUM(_type, _name) enum __CF_CLOSED_ENUM_ATTRIBUTES _name : _type _name; enum _name : _type

CoreFoundation/Locale.subproj/CFDateComponents.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ CF_IMPLICIT_BRIDGING_ENABLED
1616
CF_EXTERN_C_BEGIN
1717
CF_ASSUME_NONNULL_BEGIN
1818

19+
// Must match NSDateComponentUndefined
1920
CF_ENUM(CFIndex) {
20-
CFDateComponentUndefined = __LONG_MAX__ // Must match NSDateComponentUndefined
21+
#if TARGET_OS_WIN32
22+
CFDateComponentUndefined = LLONG_MAX
23+
#else
24+
CFDateComponentUndefined = __LONG_MAX__
25+
#endif
2126
};
2227

2328
enum {

0 commit comments

Comments
 (0)