• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Static Analyzer Question -- Suppressing Message in Special Circumstances
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static Analyzer Question -- Suppressing Message in Special Circumstances


  • Subject: Re: Static Analyzer Question -- Suppressing Message in Special Circumstances
  • From: Wim Lewis <email@hidden>
  • Date: Mon, 4 Oct 2010 16:09:02 -0700

On 4 Oct 2010, at 3:48 PM, Thomas Wetmore wrote:
> [....] I follow a strict memory management policy where all evaluate methods are required to create and return values that have been retained, and all higher level evaluate methods (evaluation is inherently recursive) are required to release the previously retained objects [....]
>
> So my question is, does anyone know of a way to suppress particular static analyzer messages in those situations where I am breaking the rules, but I know I am, in order to conform to another set of conventions?

In this specific case, I think you can use the NS_RETURNS_RETAINED macro (which is defined to an __attribute__ which clang's static analyzer recognizes) to tell the analyzer that the method returns a retain-count to its caller.  This overrides clang's usual behavior of guessing based on the method name.

This mechanism isn't as flexible as one might like, but one advantage over simply suppressing the diagnostics is that clang-sa will now verify that your evaluate methods do in fact always return a retained object, and the methods that call them do in fact release the returned object, etc.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Static Analyzer Question -- Suppressing Message in Special Circumstances (From: Thomas Wetmore <email@hidden>)

  • Prev by Date: Static Analyzer Question -- Suppressing Message in Special Circumstances
  • Next by Date: Making an installer package (locations and, owner/group)
  • Previous by thread: Static Analyzer Question -- Suppressing Message in Special Circumstances
  • Next by thread: Re: Static Analyzer Question -- Suppressing Message in Special Circumstances
  • Index(es):
    • Date
    • Thread