From 21375a3cd51586ebbb311499f3533210bfab2fd4 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 17 Jul 2009 00:25:49 +0000 Subject: [PATCH] Update cf_returns_retained/ns_returns_retained examples to use __has_feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76130 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/analyzer/annotations.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/www/analyzer/annotations.html b/www/analyzer/annotations.html index e49c327edd..819886e822 100644 --- a/www/analyzer/annotations.html +++ b/www/analyzer/annotations.html @@ -152,8 +152,12 @@ use 'cf_returns_retained'.

$ cat test.m #import <Foundation/Foundation.h> +#ifndef __has_feature // Optional. +#define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #ifndef NS_RETURNS_RETAINED -#if __clang__ +#if __has_feature(attribute_ns_returns_retained) #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) #else #define NS_RETURNS_RETAINED @@ -226,8 +230,12 @@ collection (-fobjc-gc-only).

$ cat test.m #import <Cocoa/Cocoa.h> +#ifndef __has_feature // Optional. +#define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #ifndef CF_RETURNS_RETAINED -#if __clang__ +#if __has_feature(attribute_cf_returns_retained) #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) #else #define CF_RETURNS_RETAINED