[cfe-dev] Blocks and nil termination compiler warnings

Jordan Rose jordan_rose at apple.com
Fri Aug 3 09:43:38 PDT 2012


Sounds like another addition to http://llvm.org/bugs/show_bug.cgi?id=11988 . It looks like we don't support this attribute on types, only on declarations. It makes a lot of sense in my mind to sink the attribute down to the type.

Jordan


On Aug 2, 2012, at 3:58 AM, Kevin Malakoff <xmann.intl at gmail.com> wrote:

> Hello!
> 
> I am starting to really get into Objective-C (looking forward to http://clang.llvm.org/docs/ObjectiveCLiterals.html). I recently ported Underscore.js to Objective-C (https://github.com/kmalakoff/_.m) and had one problem that I couldn't resolve...how to put up a compiler warning for nil termination on blocks.
> 
> Typically, Apple does something like this:
> 
>    + (id)arrayWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION;
> 
> 
> but I need to do something like this:
> 
>    + (A*(^)(NSA* array, NSA* array1, ... NS_REQUIRES_NIL_TERMINATION ))intersection;   // (A is NSMutableArray, NSA is NSArray)
> 
> 
> 
> I played around with combinations of __attribute__((sentinel)) , but nothing produced the correct compiler-time warnings. Is there a way to do this now? Do I need to submit a request to a standards body? Is there already an implementation in the works? Questions, questions.
> 
> 
> 
> Also, I am looking for someone to help me optimize and push my port of Underscore.js in Objective.C (I'm nowhere near guru level to do thorough benchmarking and optimizations). If you are interested in pitching in, please let me know!
> 
> Kevin
> 
> https://github.com/kmalakoff
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list