[cfe-dev] Block_copy and friends
Fariborz Jahanian
fjahanian at apple.com
Wed Nov 25 08:42:08 PST 2009
You can eliminate the warning on Linux by including the declarations
yourself:
void *_Block_copy(const void *aBlock);
void _Block_release(const void *aBlock);
But you need the block's runtime library on linux which I don't think
it is available yet.
- Fariborz
On Nov 25, 2009, at 4:04 AM, Niko Matsakis wrote:
> 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
> _______________________________________________
> 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