From a04b0e57f148698d091c90392901ce92fd0c5623 Mon Sep 17 00:00:00 2001 From: Karl <5254025+karwa@users.noreply.github.com> Date: Tue, 4 Oct 2022 19:56:35 +0200 Subject: [PATCH] [TSan] Work around a bug in TSan --- Sources/WebURL/IPAddress.swift | 6 ++++++ Sources/WebURL/Parser/ValidationError.swift | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Sources/WebURL/IPAddress.swift b/Sources/WebURL/IPAddress.swift index 0fb3aa33d..4af635c3f 100644 --- a/Sources/WebURL/IPAddress.swift +++ b/Sources/WebURL/IPAddress.swift @@ -33,6 +33,12 @@ internal protocol IPAddressParserCallback { @usableFromInline internal struct IgnoreIPAddressParserErrors: IPAddressParserCallback { + #if DEBUG + // TSan encounters internal errors when passing empty structs around 'inout'. + // See: https://github.com/apple/swift/issues/61073 and https://github.com/apple/swift/issues/56405 + let _tsanBugWorkaround = true + #endif + @inlinable internal init() {} diff --git a/Sources/WebURL/Parser/ValidationError.swift b/Sources/WebURL/Parser/ValidationError.swift index 4e1e0a560..21b6f7b0e 100644 --- a/Sources/WebURL/Parser/ValidationError.swift +++ b/Sources/WebURL/Parser/ValidationError.swift @@ -39,6 +39,12 @@ internal protocol URLParserCallback { @usableFromInline internal struct IgnoreValidationErrors: URLParserCallback { + #if DEBUG + // TSan encounters internal errors when passing empty structs around 'inout'. + // See: https://github.com/apple/swift/issues/61073 and https://github.com/apple/swift/issues/56405 + let _tsanBugWorkaround = true + #endif + @inlinable @inline(__always) internal init() {}