Skip to content

[android] fix 32 bit android build #656

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
Sep 3, 2024
Merged

[android] fix 32 bit android build #656

merged 1 commit into from
Sep 3, 2024

Conversation

hyp
Copy link
Contributor

@hyp hyp commented Sep 3, 2024

This fixes the following errors:

S:/SourceCache/swift-testing/Sources/Testing/Support/FileHandle.swift:423:70: error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
421 |       }
422 |       var statStruct = stat()
423 |       return (0 == fstat(fd, &statStruct) && swt_S_ISFIFO(statStruct.st_mode))
    |                                                                      `- error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
424 |     }
425 | #elseif os(Windows)
S:/SourceCache/swift-testing/Sources/Testing/Support/GetSymbol.swift:34:73: error: integer literal '4294967295' overflows when stored into 'Int'
32 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: -2)
33 | #elseif os(Android) && _pointerBitWidth(_32)
34 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: 0xFFFFFFFF)
   |                                                                         `- error: integer literal '4294967295' overflows when stored into 'Int'

Motivation:

Fix 32 bit android build.

Modifications:

Add explicit types to to cast correctly and to pick correct overload.

Result:

Android swift-testing will build for armv7k and i686.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This fixes the following errors:
S:/SourceCache/swift-testing/Sources/Testing/Support/FileHandle.swift:423:70: error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
421 |       }
422 |       var statStruct = stat()
423 |       return (0 == fstat(fd, &statStruct) && swt_S_ISFIFO(statStruct.st_mode))
    |                                                                      `- error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
424 |     }
425 | #elseif os(Windows)
S:/SourceCache/swift-testing/Sources/Testing/Support/GetSymbol.swift:34:73: error: integer literal '4294967295' overflows when stored into 'Int'
32 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: -2)
33 | #elseif os(Android) && _pointerBitWidth(_32)
34 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: 0xFFFFFFFF)
   |                                                                         `- error: integer literal '4294967295' overflows when stored into 'Int'
@hyp
Copy link
Contributor Author

hyp commented Sep 3, 2024

@swift-ci please test

@grynspan
Copy link
Contributor

grynspan commented Sep 3, 2024

@compnerd Mind reviewing? Looks correct to me.

@grynspan grynspan added bug 🪲 Something isn't working android 🤖 Android support labels Sep 3, 2024
@grynspan grynspan merged commit 8e121e4 into main Sep 3, 2024
3 checks passed
@grynspan grynspan deleted the hyp/eng/android32 branch September 3, 2024 16:18
@grynspan
Copy link
Contributor

@hyp Note if you need this fix in Swift 6.0.1, please clone the PR and nominate it using the procedure outlined here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android 🤖 Android support bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants