From 63957877f216adb26340e0733cd298daebf62978 Mon Sep 17 00:00:00 2001 From: William Dillon Date: Sat, 19 Dec 2015 17:33:26 +0000 Subject: [PATCH 1/4] Fixed compile and link issue on arm --- Foundation/NSXMLNodeOptions.swift | 54 +++++++++++++++---------------- lib/target.py | 5 ++- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Foundation/NSXMLNodeOptions.swift b/Foundation/NSXMLNodeOptions.swift index a4ef6f13db..feb9d12ca1 100644 --- a/Foundation/NSXMLNodeOptions.swift +++ b/Foundation/NSXMLNodeOptions.swift @@ -46,46 +46,46 @@ public var NSXMLNodeOptionsNone: Int { return 0 } // Init -public var NSXMLNodeIsCDATA: Int { return 1 << 0 } -public var NSXMLNodeExpandEmptyElement: Int { return 1 << 1 } // -public var NSXMLNodeCompactEmptyElement: Int { return 1 << 2 } // -public var NSXMLNodeUseSingleQuotes: Int { return 1 << 3 } -public var NSXMLNodeUseDoubleQuotes: Int { return 1 << 4 } -public var NSXMLNodeNeverEscapeContents: Int { return 1 << 5 } +public var NSXMLNodeIsCDATA: UInt { return 1 << 0 } +public var NSXMLNodeExpandEmptyElement: UInt { return 1 << 1 } // +public var NSXMLNodeCompactEmptyElement: UInt { return 1 << 2 } // +public var NSXMLNodeUseSingleQuotes: UInt { return 1 << 3 } +public var NSXMLNodeUseDoubleQuotes: UInt { return 1 << 4 } +public var NSXMLNodeNeverEscapeContents: UInt { return 1 << 5 } // Tidy -public var NSXMLDocumentTidyHTML: Int { return 1 << 9 } -public var NSXMLDocumentTidyXML: Int { return 1 << 10 } +public var NSXMLDocumentTidyHTML: UInt { return 1 << 9 } +public var NSXMLDocumentTidyXML: UInt { return 1 << 10 } // Validate -public var NSXMLDocumentValidate: Int { return 1 << 13 } +public var NSXMLDocumentValidate: UInt { return 1 << 13 } // External Entity Loading // Choose only zero or one option. Choosing none results in system-default behavior. -public var NSXMLNodeLoadExternalEntitiesAlways: Int { return 1 << 14 } -public var NSXMLNodeLoadExternalEntitiesSameOriginOnly: Int { return 1 << 15 } -public var NSXMLNodeLoadExternalEntitiesNever: Int { return 1 << 19 } +public var NSXMLNodeLoadExternalEntitiesAlways: UInt { return 1 << 14 } +public var NSXMLNodeLoadExternalEntitiesSameOriginOnly: UInt { return 1 << 15 } +public var NSXMLNodeLoadExternalEntitiesNever: UInt { return 1 << 19 } // Parse -public var NSXMLDocumentXInclude: Int { return 1 << 16 } +public var NSXMLDocumentXInclude: UInt { return 1 << 16 } // Output -public var NSXMLNodePrettyPrint: Int { return 1 << 17 } -public var NSXMLDocumentIncludeContentTypeDeclaration: Int { return 1 << 18 } +public var NSXMLNodePrettyPrint: UInt { return 1 << 17 } +public var NSXMLDocumentIncludeContentTypeDeclaration: UInt { return 1 << 18 } // Fidelity -public var NSXMLNodePreserveNamespaceOrder: Int { return 1 << 20 } -public var NSXMLNodePreserveAttributeOrder: Int { return 1 << 21 } -public var NSXMLNodePreserveEntities: Int { return 1 << 22 } -public var NSXMLNodePreservePrefixes: Int { return 1 << 23 } -public var NSXMLNodePreserveCDATA: Int { return 1 << 24 } -public var NSXMLNodePreserveWhitespace: Int { return 1 << 25 } -public var NSXMLNodePreserveDTD: Int { return 1 << 26 } -public var NSXMLNodePreserveCharacterReferences: Int { return 1 << 27 } -public var NSXMLNodePromoteSignificantWhitespace: Int { return 1 << 28 } -public var NSXMLNodePreserveEmptyElements: Int { return NSXMLNodeExpandEmptyElement | NSXMLNodeCompactEmptyElement } -public var NSXMLNodePreserveQuotes: Int { return NSXMLNodeUseSingleQuotes | NSXMLNodeUseDoubleQuotes } -public var NSXMLNodePreserveAll: Int { return +public var NSXMLNodePreserveNamespaceOrder: UInt { return 1 << 20 } +public var NSXMLNodePreserveAttributeOrder: UInt { return 1 << 21 } +public var NSXMLNodePreserveEntities: UInt { return 1 << 22 } +public var NSXMLNodePreservePrefixes: UInt { return 1 << 23 } +public var NSXMLNodePreserveCDATA: UInt { return 1 << 24 } +public var NSXMLNodePreserveWhitespace: UInt { return 1 << 25 } +public var NSXMLNodePreserveDTD: UInt { return 1 << 26 } +public var NSXMLNodePreserveCharacterReferences: UInt { return 1 << 27 } +public var NSXMLNodePromoteSignificantWhitespace: UInt { return 1 << 28 } +public var NSXMLNodePreserveEmptyElements: UInt { return NSXMLNodeExpandEmptyElement | NSXMLNodeCompactEmptyElement } +public var NSXMLNodePreserveQuotes: UInt { return NSXMLNodeUseSingleQuotes | NSXMLNodeUseDoubleQuotes } +public var NSXMLNodePreserveAll: UInt { return NSXMLNodePreserveNamespaceOrder | NSXMLNodePreserveAttributeOrder | NSXMLNodePreserveEntities | diff --git a/lib/target.py b/lib/target.py index a8472ba650..48cf79d03b 100644 --- a/lib/target.py +++ b/lib/target.py @@ -364,7 +364,10 @@ def swift_triple(self): if self.sdk == OSType.MacOSX: return None elif self.sdk == OSType.Linux: - triple += "-unknown-linux" + if self.arch == ArchType.arm: + triple += "-unknown-linux-gnueabihf" + else: + triple += "-unknown-linux" elif self.sdk == OSType.FreeBSD: triple += "-unknown-freebsd" else: From ddcc82d8a1882463dac8343e77d1816eb57ad4db Mon Sep 17 00:00:00 2001 From: William Dillon Date: Sun, 20 Dec 2015 19:41:20 -0800 Subject: [PATCH 2/4] Added a fixme for assuming the ABI on ARM. The compile process must be provided an ABI on ARM, otherwise it doesn't know whether the CPU supports hard float. --- lib/target.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/target.py b/lib/target.py index 48cf79d03b..cd96f1e402 100644 --- a/lib/target.py +++ b/lib/target.py @@ -364,6 +364,7 @@ def swift_triple(self): if self.sdk == OSType.MacOSX: return None elif self.sdk == OSType.Linux: + # FIXME: It would be nice to detect the host ABI here if self.arch == ArchType.arm: triple += "-unknown-linux-gnueabihf" else: From d2ec47f352db1e0837351a5eb763a8dd10fc4183 Mon Sep 17 00:00:00 2001 From: William Dillon Date: Sun, 20 Dec 2015 19:47:43 -0800 Subject: [PATCH 3/4] Fixed an inconsistency in NSXMLNodeOptions --- Foundation/NSXMLNodeOptions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Foundation/NSXMLNodeOptions.swift b/Foundation/NSXMLNodeOptions.swift index feb9d12ca1..a9aee5721c 100644 --- a/Foundation/NSXMLNodeOptions.swift +++ b/Foundation/NSXMLNodeOptions.swift @@ -43,7 +43,7 @@ @constant NSXMLDocumentIncludeContentTypeDeclaration Include a content type declaration for HTML or XHTML */ -public var NSXMLNodeOptionsNone: Int { return 0 } +public var NSXMLNodeOptionsNone: UInt { return 0 } // Init public var NSXMLNodeIsCDATA: UInt { return 1 << 0 } From d8c30d14f6c820fcd0a68636d3528d9d0bc9355f Mon Sep 17 00:00:00 2001 From: William Dillon Date: Wed, 23 Dec 2015 18:30:09 +0000 Subject: [PATCH 4/4] Created an intermediate type for NSXMLNodeOptions This is intended to smooth issues with alternate definitions of Int on 32/64 bit platforms. --- Foundation/NSXMLNodeOptions.swift | 62 +++++++++++++++++-------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/Foundation/NSXMLNodeOptions.swift b/Foundation/NSXMLNodeOptions.swift index feb9d12ca1..2c49580f78 100644 --- a/Foundation/NSXMLNodeOptions.swift +++ b/Foundation/NSXMLNodeOptions.swift @@ -43,49 +43,55 @@ @constant NSXMLDocumentIncludeContentTypeDeclaration Include a content type declaration for HTML or XHTML */ -public var NSXMLNodeOptionsNone: Int { return 0 } +#if arch(x86_64) +public typealias NSXMLNodeOptionRawType = Int +#else +public typealias NSXMLNodeOptionRawType = Int64 +#endif + +public var NSXMLNodeOptionsNone: NSXMLNodeOptionRawType { return 0 } // Init -public var NSXMLNodeIsCDATA: UInt { return 1 << 0 } -public var NSXMLNodeExpandEmptyElement: UInt { return 1 << 1 } // -public var NSXMLNodeCompactEmptyElement: UInt { return 1 << 2 } // -public var NSXMLNodeUseSingleQuotes: UInt { return 1 << 3 } -public var NSXMLNodeUseDoubleQuotes: UInt { return 1 << 4 } -public var NSXMLNodeNeverEscapeContents: UInt { return 1 << 5 } +public var NSXMLNodeIsCDATA: NSXMLNodeOptionRawType { return 1 << 0 } +public var NSXMLNodeExpandEmptyElement: NSXMLNodeOptionRawType { return 1 << 1 } // +public var NSXMLNodeCompactEmptyElement: NSXMLNodeOptionRawType { return 1 << 2 } // +public var NSXMLNodeUseSingleQuotes: NSXMLNodeOptionRawType { return 1 << 3 } +public var NSXMLNodeUseDoubleQuotes: NSXMLNodeOptionRawType { return 1 << 4 } +public var NSXMLNodeNeverEscapeContents: NSXMLNodeOptionRawType { return 1 << 5 } // Tidy -public var NSXMLDocumentTidyHTML: UInt { return 1 << 9 } -public var NSXMLDocumentTidyXML: UInt { return 1 << 10 } +public var NSXMLDocumentTidyHTML: NSXMLNodeOptionRawType { return 1 << 9 } +public var NSXMLDocumentTidyXML: NSXMLNodeOptionRawType { return 1 << 10 } // Validate -public var NSXMLDocumentValidate: UInt { return 1 << 13 } +public var NSXMLDocumentValidate: NSXMLNodeOptionRawType { return 1 << 13 } // External Entity Loading // Choose only zero or one option. Choosing none results in system-default behavior. -public var NSXMLNodeLoadExternalEntitiesAlways: UInt { return 1 << 14 } -public var NSXMLNodeLoadExternalEntitiesSameOriginOnly: UInt { return 1 << 15 } -public var NSXMLNodeLoadExternalEntitiesNever: UInt { return 1 << 19 } +public var NSXMLNodeLoadExternalEntitiesAlways: NSXMLNodeOptionRawType { return 1 << 14 } +public var NSXMLNodeLoadExternalEntitiesSameOriginOnly: NSXMLNodeOptionRawType { return 1 << 15 } +public var NSXMLNodeLoadExternalEntitiesNever: NSXMLNodeOptionRawType { return 1 << 19 } // Parse -public var NSXMLDocumentXInclude: UInt { return 1 << 16 } +public var NSXMLDocumentXInclude: NSXMLNodeOptionRawType { return 1 << 16 } // Output -public var NSXMLNodePrettyPrint: UInt { return 1 << 17 } -public var NSXMLDocumentIncludeContentTypeDeclaration: UInt { return 1 << 18 } +public var NSXMLNodePrettyPrint: NSXMLNodeOptionRawType { return 1 << 17 } +public var NSXMLDocumentIncludeContentTypeDeclaration: NSXMLNodeOptionRawType { return 1 << 18 } // Fidelity -public var NSXMLNodePreserveNamespaceOrder: UInt { return 1 << 20 } -public var NSXMLNodePreserveAttributeOrder: UInt { return 1 << 21 } -public var NSXMLNodePreserveEntities: UInt { return 1 << 22 } -public var NSXMLNodePreservePrefixes: UInt { return 1 << 23 } -public var NSXMLNodePreserveCDATA: UInt { return 1 << 24 } -public var NSXMLNodePreserveWhitespace: UInt { return 1 << 25 } -public var NSXMLNodePreserveDTD: UInt { return 1 << 26 } -public var NSXMLNodePreserveCharacterReferences: UInt { return 1 << 27 } -public var NSXMLNodePromoteSignificantWhitespace: UInt { return 1 << 28 } -public var NSXMLNodePreserveEmptyElements: UInt { return NSXMLNodeExpandEmptyElement | NSXMLNodeCompactEmptyElement } -public var NSXMLNodePreserveQuotes: UInt { return NSXMLNodeUseSingleQuotes | NSXMLNodeUseDoubleQuotes } -public var NSXMLNodePreserveAll: UInt { return +public var NSXMLNodePreserveNamespaceOrder: NSXMLNodeOptionRawType { return 1 << 20 } +public var NSXMLNodePreserveAttributeOrder: NSXMLNodeOptionRawType { return 1 << 21 } +public var NSXMLNodePreserveEntities: NSXMLNodeOptionRawType { return 1 << 22 } +public var NSXMLNodePreservePrefixes: NSXMLNodeOptionRawType { return 1 << 23 } +public var NSXMLNodePreserveCDATA: NSXMLNodeOptionRawType { return 1 << 24 } +public var NSXMLNodePreserveWhitespace: NSXMLNodeOptionRawType { return 1 << 25 } +public var NSXMLNodePreserveDTD: NSXMLNodeOptionRawType { return 1 << 26 } +public var NSXMLNodePreserveCharacterReferences: NSXMLNodeOptionRawType { return 1 << 27 } +public var NSXMLNodePromoteSignificantWhitespace: NSXMLNodeOptionRawType { return 1 << 28 } +public var NSXMLNodePreserveEmptyElements: NSXMLNodeOptionRawType { return NSXMLNodeExpandEmptyElement | NSXMLNodeCompactEmptyElement } +public var NSXMLNodePreserveQuotes: NSXMLNodeOptionRawType { return NSXMLNodeUseSingleQuotes | NSXMLNodeUseDoubleQuotes } +public var NSXMLNodePreserveAll: NSXMLNodeOptionRawType { return NSXMLNodePreserveNamespaceOrder | NSXMLNodePreserveAttributeOrder | NSXMLNodePreserveEntities |