[cfe-dev] Block_copy and friends

Niko Matsakis niko at alum.mit.edu
Wed Nov 25 04:04:48 PST 2009


Hello,

I am using clang on linux to compile some code I wrote which uses  
blocks.  Whenever I invoke the Block_copy() function, however, I get  
warnings because (presumably) there is no prototype and so a default  
return type of int is assumed:

> llvm/Release/bin/clang -fblocks -O3 -c -o bin/interval.o Intervals/ 
> interval.c
> Intervals/interval.c:446:37: warning: incompatible integer to  
> pointer conversion passing 'int',
>       expected 'void *'
>                         interval_task_t startTask = task(Block_copy 
> (blk), TASK_COPIED_BLOCK_TAG);
>                                                           
> ^~~~~~~~~~~~~~~
> 1 diagnostic generated.


On the Mac, I #include <Block.h> to make such warnings go away (or use  
Objective-C and fire a copy message).  However, that header file  
doesn't seem to be included in the clang sources anywhere.  How can I  
make this work?

I apologize if this is the wrong list for this question, but it seemed  
the most appropriate from what I saw on the web page.  I looked around  
on google for references to Block_copy(), but didn't find much.

The code in question is publicly available at <http://github.com/nikomatsakiseth/eth-intervals-c 
 >, if needed.

Thanks!


Niko



More information about the cfe-dev mailing list