Changeset 133793 in webkit


Ignore:
Timestamp:
Nov 7, 2012 12:35:27 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Function adoptNS and adoptCF should not generate memory leak diagnostic with Clang Static Analyzer.
https://bugs.webkit.org/show_bug.cgi?id=101420

Patch by Remy Demarest <rdemarest@apple.com> on 2012-11-07
Reviewed by Benjamin Poulain.

Add attributes to the adoptNS and adoptCF function arguments to remove Clang Static Analyzer diagnotics.
Define CF_RELEASES_ARGUMENT and NS_RELEASES_ARGUMENT if not available, use them in function declarations.

  • wtf/RetainPtr.h:

(WTF::adoptCF): Adds CF_RELEASES_ARGUMENT attribute to the argument.
(WTF::adoptNS): Adds NS_RELEASES_ARGUMENT attribute to the argument.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r133731 r133793  
     12012-11-07  Remy Demarest  <rdemarest@apple.com>
     2
     3        Function adoptNS and adoptCF should not generate memory leak diagnostic with Clang Static Analyzer.
     4        https://bugs.webkit.org/show_bug.cgi?id=101420
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Add attributes to the adoptNS and adoptCF function arguments to remove Clang Static Analyzer diagnotics.
     9        Define CF_RELEASES_ARGUMENT and NS_RELEASES_ARGUMENT if not available, use them in function declarations.
     10
     11        * wtf/RetainPtr.h:
     12        (WTF::adoptCF): Adds CF_RELEASES_ARGUMENT attribute to the argument.
     13        (WTF::adoptNS): Adds NS_RELEASES_ARGUMENT attribute to the argument.
     14
    1152012-11-07  Christophe Dumez  <christophe.dumez@intel.com>
    216
  • trunk/Source/WTF/wtf/RetainPtr.h

    r132711 r133793  
    3535#endif
    3636
     37#ifndef CF_RELEASES_ARGUMENT
     38#define CF_RELEASES_ARGUMENT
     39#endif
     40
     41#ifndef NS_RELEASES_ARGUMENT
     42#define NS_RELEASES_ARGUMENT
     43#endif
     44
    3745namespace WTF {
    3846
     
    258266    }
    259267
    260     template<typename T> inline RetainPtr<T> adoptCF(T) WARN_UNUSED_RETURN;
     268    template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
    261269    template<typename T> inline RetainPtr<T> adoptCF(T o)
    262270    {
     
    264272    }
    265273
    266     template<typename T> inline RetainPtr<T> adoptNS(T) WARN_UNUSED_RETURN;
     274    template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
    267275    template<typename T> inline RetainPtr<T> adoptNS(T o)
    268276    {
Note: See TracChangeset for help on using the changeset viewer.