Skip to content
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

Incorrect ValidateDocumentationComments warning for rethrows function #928

Open
rauhul opened this issue Feb 10, 2025 · 1 comment
Open

Comments

@rauhul
Copy link
Member

rauhul commented Feb 10, 2025

Sources/ArgumentParser/Utilities/Mutex.swift:53:5: warning: [ValidateDocumentationComments] remove the 'Throws:' sections of 'withLock'; it does not throw any errors

  /// Calls the given closure after acquiring the lock and then releases
  /// ownership.
  ///
  /// - Warning: Recursive calls to `withLock` within the closure parameter has
  ///   behavior that is platform dependent. Some platforms may choose to panic
  ///   the process, deadlock, or leave this behavior unspecified. This will
  ///   never reacquire the lock however.
  ///
  /// - Parameter body: A closure with a parameter of `Value` that has exclusive
  ///   access to the value being stored within this mutex. This closure is
  ///   considered the critical section as it will only be executed once the
  ///   calling thread has acquired the lock.
  ///
  /// - Throws: Re-throws any error thrown by `body`.
  ///
  /// - Returns: The return value, if any, of the `body` closure parameter.
  func withLock<U>(
    _ body: (inout T) throws -> U
  ) rethrows -> U {
    self.lock.lock()
    defer { self.lock.unlock() }
    return try body(&self.value)
  }
@ahoppen
Copy link
Member

ahoppen commented Feb 10, 2025

Synced to Apple’s issue tracker as rdar://144562352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants