[cfe-dev] Blocks and nil termination compiler warnings

Kevin Malakoff xmann.intl at gmail.com
Thu Aug 2 03:58:14 PDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120802/393379bf/attachment.html>


More information about the cfe-dev mailing list