Apple's GCC 42 enhancements (was Re: [CFT] Experimental gcc update).

Pedro Giffuni pfg at FreeBSD.org
Thu Jan 2 20:27:53 UTC 2014


Heloo and Happy New Year!

On 24.11.2013 07:54, David Chisnall wrote:
> On 23 Nov 2013, at 22:11, Pedro Giffuni <pfg at freebsd.org> wrote:
>
>> I have particular interest in -fwritable-strings
>> and the block support, mostly with the idea of making our gcc
>> somewhat more compatible to clang.
> I would absolutely love to see our GCC have blocks support.  It would be very nice to be able to use blocks in libc.

It took me a while and I still have to do more review, but I finally 
have a patch for blocks support in gcc

http://people.freebsd.org/~pfg/patches/gcc/gcc-blocks.patch

(this only applies against -current for now)

I have been able to build an example test from wikipedia and 
devel/libdispatch, with a small caveat: You have to #define __block or 
else you get this message:

error: '__block' undeclared (first use in this function)


The behaviour is consistent with llvm-gcc though, as explained here:

https://bugs.launchpad.net/ubuntu/+source/llvm-gcc-4.2/+bug/483679

" looking at the LLVM/Clang documentation 
(http://clang.llvm.org/doxygen/InitPreprocessor_8cpp-source.html 
<http://clang.llvm.org/doxygen/InitPreprocessor_8cpp-source.html>) shows 
that __block is not actually a keyword, but a macro that is defined to 
be __attribute__((__blocks__(byref)))."

Not sure what to do about it, I had added a #define for it in Block.h 
since you have to link with -lBlocksRuntime anyways, but not everything 
includes Block.h (surely not the libdispatch tests).

Anyways, I will be revising the patch some more and will commit it 
somewhen next week.

Enjoy,

Pedro.


More information about the freebsd-toolchain mailing list