You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "HIRANO Satoshi (Updated) (JIRA)" <ji...@apache.org> on 2011/11/14 06:05:51 UTC

[jira] [Updated] (THRIFT-1340) Add support of ARC to Objective-C

     [ https://issues.apache.org/jira/browse/THRIFT-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

HIRANO Satoshi updated THRIFT-1340:
-----------------------------------

    Attachment: THRIFT-0.8.0-dev_cocoa_ARC.patch

(Cocoa) Patch for adding support of ARC, initializing constants, initializing struct/map/list/set with default values

I confirmed that the generated code from test/*.thrift	passes code analyzer and can be compiled without warning.

* t_cocoa_generator.cc

- Generates code compatible with both ARC (Automatic Reference Counting) compilation mode and non-ARC compilation mode.
- Initializes struct/exception/map/list/set with defalut values.
- Generates much better code for initializing constants.

* lib/cocoa/src/transport/TSocketClient.h

- get rid of warning on NSStreamDelegate

* lib/cocoa
- works with both ARC (Automatic Reference Counting) compilation mode and non-ARC compilation mode.

                
> Add support of ARC to Objective-C
> ---------------------------------
>
>                 Key: THRIFT-1340
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1340
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Cocoa - Compiler, Cocoa - Library
>    Affects Versions: 0.7
>         Environment: Mac OS X Lion, iOS 4.2, 4.3, 5.0..
>            Reporter: HIRANO Satoshi
>         Attachments: THRIFT-0.8.0-dev_cocoa_ARC.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Objective-C in Xcode 4.2 supports ARC (Automatic Reference Counting, not GC but similar) and now it is the default both on OS X Lion and iOS 5. (ARC works on iOS 4.2 or higher.)
> The conventional Objective-C code includes many retain/release/autorelease for maintaining  the life time of objects.
> Since the latest Objective-C compiler automatically generates stubs for reference counting, code should not include any retain/release/autorelease.
> Many Mac OS/iOS projects are moving to ARC mode. Although we can specify a compiler flag which tells ARC or no-ARC file by file in Xcode 4.2, there is no means to tell the Xcode that files generated by the thrift compiler are no-ARC. Xcode produces many error messages like "retain is not allowed in ARC mode". 
> So, the thrift compiler should support ARC mode.
> What we need are:
> 1) add -objc-arc flag to the thrift compiler.
> 2) If -objc-arc flag exists, omit generating code for retain/release/autorelease.
> Please look at "Programming with ARC reference notes" in iOS developer library.
> http://andpdas.com/wp-content/uploads/2011/06/ARCProgrammingGuide.pdf

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira