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
The Catalina Merge #2782
The Catalina Merge #2782
Conversation
This patch brings swift-corelibs-foundation closer to behavior parity with released versions of macOS Catalina and aligned Apple releases. Most of these changes are under-the-hood bug fixes or performance improvements, but a few may affect the behavior of your applications. In particular: - The deprecation of NSURL.parameterString is now also effective in Swift for Linux, with similar effects. This brings URL parsing in line with Catalina. Note that Swift for Linux does not support link checks, since there is no binary compatibility guarantee on Linux; this change will be effective to all application code running on Swift for Linux 5.3 or later. - Certain CFXML… types that have been deprecated on macOS are now removed, along with their associated implementation: CFXMLInputStream, CFXMLNode, CFXMLParser. Modern code should be using the FoundationXML module (or, on Darwin, the XMLDocument and related classes in Foundation) to parse documents.
@swift-ci please test |
https://dev.azure.com/compnerd/swift-build/_build/results?buildId=31292&view=results for a run on Windows |
@swift-ci please test |
@swift-ci please test |
return NULL; | ||
} | ||
return data->value; | ||
return (CFTypeRef)FlsGetValue(key); |
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.
return (CFTypeRef)FlsGetValue(key); | |
return (CFTypeRef)FlsGetValue(key); |
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.
I've seen a few like this. Especially wrt the implementation of TSDs on Windows, @compnerd, let me know if it looks bad?
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.
My mental map of The Whole Of Foundation gets a little murky around the Windows bits.
static bool warnonce = false; \ | ||
if (!warnonce) { \ | ||
warnonce = true; \ | ||
CFLog(kCFLogLevelWarning, CFSTR("*** %@: Range {%lu, %lu} out of bounds; string length %lu. This will become an exception for apps linked after 10.10 and iOS 8. Warning shown once per app execution."), __CFExceptionProem((id)self, _cmd), (unsigned long)range.location, (unsigned long)range.length, (unsigned long)len); \ | ||
} \ | ||
} | ||
} while(0) |
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.
Nit: the indentation is off here.
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.
I'm gonna note these down and work on them later, for internal back-and-forth merging reasons.
@swift-ci please test |
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.
Some more nits.
CFDictionarySetValue(objects, (const void *)(uintptr_t)startOffset, *plist); | ||
} | ||
return (*plist) ? true : false; | ||
if (outPlistTypeID) *outPlistTypeID = _kCFRuntimeIDCFNumber; |
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.
Nit: indentation appears off here and below.
CFDictionarySetValue(objects, (const void *)(uintptr_t)startOffset, *plist); | ||
} | ||
return (*plist) ? true : false; | ||
if (outPlistTypeID) *outPlistTypeID = _kCFRuntimeIDCFNumber; |
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.
Nit: likewise indentation appears off here and below, and it appears pervasively throughout the rest of the file.
} | ||
} else { | ||
//#warning CF: should create a no-copy data here that has a custom VM-freeing allocator, and not vm_dealloc here | ||
} else { |
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.
Nit: indentation consistency problem here also, it appears.
|
||
if (timers) CFRelease(timers); | ||
|
||
if (timers) CFRelease(timers); |
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.
if (timers) CFRelease(timers); | |
if (timers) CFRelease(timers); |
@@ -6420,7 +6495,7 @@ reswtch:switch (ch) { | |||
if (spec->size != CFFormatSize16) spec->size = CFFormatSize8; | |||
return true; | |||
case 'n': /* %n is not handled correctly; for Leopard or newer apps, we disable it further */ | |||
spec->type = 1 ? CFFormatDummyPointerType : CFFormatPointerType; | |||
spec->type = CFFormatDummyPointerType; |
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.
spec->type = CFFormatDummyPointerType; | |
spec->type = CFFormatDummyPointerType; |
// | ||
// 👩 ❤ Var_Sel 💋 👨 | ||
// ┌──────────┐│┌───────┐┌─────┐┌──────┐┌──────┐┌─────┐┌───────┐┌─────┐┌───────┐│┌──────────┐ | ||
// │ stuff... │ │ 1F469 ││ ZWJ ││ 2764 ││ FE0F ││ ZWJ ││ 1F48B ││ ZWJ ││ 1F468 │ │ stuff... │ |
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.
These diagrams are fantastic!
@@ -607,6 +607,7 @@ static const _CFEncodingConverter *__CFGetConverter(uint32_t encoding) { | |||
#warning This case must match __defaultEncoding value defined in CFString.c | |||
case kCFStringEncodingISOLatin1: commonConverterSlot = (const _CFEncodingConverter **)(&(commonConverters[1])); break; | |||
#endif | |||
case kCFStringEncodingInvalidId: return NULL; |
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.
Nit: space-tab mismatch here.
@@ -3756,7 +3715,7 @@ static Boolean decomposeToRFC1808(CFURLRef url, CFURLComponentsRFC1808 *componen | |||
} else { | |||
components->port = kCFNotFound; | |||
} | |||
components->parameterString = _retainedComponentString(url, HAS_PARAMETERS, false, false); | |||
components->parameterString = NULL; |
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.
components->parameterString = NULL; | |
components->parameterString = NULL; |
@@ -629,7 +629,9 @@ static Boolean _CFDataURLCreateDataAndPropertiesFromResource(CFAllocatorRef allo | |||
if (! parseDataRequestURL(url, &data, &mimeType, &textEncodingName)) { | |||
if (errorCode) | |||
*errorCode = kCFURLUnknownError; | |||
*fetchedData = NULL; | |||
if (fetchedData) { |
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.
Nit: space-tab mismatch here.
@swift-ci please test |
1 similar comment
@swift-ci please test |
The patch passes on Linux and Mac but breaks the Windows build; there will be some iteration. |
This reverts #2764. I'm afraid NotificationQueue could be affected n Windows, as well as Operation/OperationQueue. |
Thank you for catching that. I’ll un-revert. |
For ease of reviewing, would it be possible to commit the ICU upgrade separately? It would at least make the GitHub interface slightly more usable. |
I haven't tested the ICU upgrade with the previous version of the code, and I don't know that I want to put in the time to do that. I understand this is a large patch, but extricating it would add more to what has been so far already ~1 work-hours-month-person of work that I need to coordinate with some expedition, and I'd rather not unless the need is really strong. |
(The ICU parts are showing collapsed for me? I'm not sure how their presence impacts usability. While you can review them, I'm not going to modify them: this is just a straight import of the headers generated by compiling Apple ICU from https://opensource.apple.com/source/ICU/ICU-64252.0.1/.) |
@swift-ci please test |
@millenomi Yeah, I mention this thought precisely because there is no point in reviewing the ICU parts. Having not interfaced with the library extensively myself, I don't have a sense of its forward compatibility guarantees. If it's essentially a drop-in replacement, then perhaps there's some net benefit to doing that separately. If it's much more involved than that, then there's certainly no point in extricating it. |
@swift-ci please test |
1 similar comment
@swift-ci please test |
I'm going to avoid starting tests when I'm doing Windows runs. |
…operands because the compiler runtime may not have an implementation.
This one needs a test. |
@swift-ci please test |
@swift-ci please test |
…he double negation.
@swift-ci please test |
@swift-ci please test |
1 similar comment
@swift-ci please test |
This is going to be merged today barring last-minute objections. |
Never mind, saw the |
Thanks for checking! |
Merging this. |
PR apple#2782 references symbol __kCFAllocatorTypeID_CONST in CFRuntime.c but this was removed in apple#1708. After interpreting the commit, it looks like this symbol was renamed to _kCFRuntimeIDCFAllocator. Therefore, make this rename again.
Looks like this broke the linux CI, because of this line:
|
This patch brings swift-corelibs-foundation closer to behavior parity with released versions of macOS Catalina and aligned Apple releases. Most of these changes are under-the-hood bug fixes or performance improvements, but a few may affect the behavior of your applications. In particular:
The deprecation of NSURL.parameterString is now also effective in Swift for Linux, with similar effects. This brings URL parsing in line with Catalina. Note that Swift for Linux does not support link checks, since there is no binary compatibility guarantee on Linux; this change will be effective to all application code running on Swift for Linux 5.3 or later.
Certain CFXML… types that have been deprecated on macOS are now removed, along with their associated implementation: CFXMLInputStream, CFXMLNode, CFXMLParser. Modern code should be using the FoundationXML module (or, on Darwin, the XMLDocument and related classes in Foundation) to parse documents.