microsoft / plcrashreporter

Reliable, open-source crash reporting for iOS, macOS and tvOS
Other
2.88k stars 537 forks source link

"Implicit conversion loses integer precision" warnings when building swift package for ios device/simulator #225

Closed BlixLT closed 2 years ago

BlixLT commented 2 years ago

Description

We are trying to get rid of all warnings in our project and noticed some in plcrashreporter swift package. Hopefully you will be able to fix them in the future. Thanks.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Open swift Package (Package.swift) with Xcode
  2. Build it for iOS device/Simulator (it doesn't happen when building for macOS - there are no such warnings)
  3. ~40 warnings similar to protobuf-c.c:447:27: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') appear

Details

  1. Which SDK version are you using? plcrashreport version 1.10.1

  2. Which OS version did you experience the issue on? iOS 15.1 on Device/Simulator

  3. Which CocoaPods/Carthage/Xcode version are you using? Xcode 13.2.1

  4. What device version did you see this error on? Were you using an emulator or a physical device? iPhone X (device), iPhone 13 Pro Max (simulator)

  5. What language are you using?

    • [X] Objective C
    • [ ] Swift
  6. What third party libraries are you using? None. It can be reproduced simply by building PLCrashReporter's Swift Package project

DmitriyKirakosyan commented 2 years ago

Hi @BlixLT , thank you for reaching out to us!

I'll mark this as a feature request.

Meanwhile, as a workaround you can try using the following flags in your swift package for a specific target:

swiftSettings: [
    .unsafeFlags(["-suppress-warnings"]),
])
futuretap commented 2 years ago

@DmitriyKirakosyan How can I set these flags when including PLCrashReporter via Swift Package Manager?

DmitriyKirakosyan commented 2 years ago

Hi @futuretap , sorry for the confusion, the workaround only helps if you have a swift package project.

If you enable treating warning as errors in your project and this issue is blocker for you, please integrate PLCrashReporter as xcframework or via CocoaPods until the issue is fixed.

MatkovIvan commented 2 years ago

All these warnings are from protobuf-c library. I'm going to update it to latest stable 1.4.0 version (#241), but it still is not fixed there. Even if we DO copy these files manually to our repo (as SwiftPM workaround), we're not going to change it to avoid conflicts during future updates.

futuretap commented 1 year ago

This is not completed. The warning still occurs. I understand that protobuf-c is to blame but I'm not sure if they're even aware of the issue.