[cfe-commits] r68583 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGCall.cpp lib/CodeGen/CodeGenTypes.h test/CodeGen/blocks.c

fjahanian fjahanian at apple.com
Wed Apr 8 07:59:10 PDT 2009


On Apr 8, 2009, at 5:02 AM, steve naroff wrote:

>
> On Apr 7, 2009, at 11:01 PM, Eli Friedman wrote:
>
>> On Tue, Apr 7, 2009 at 7:56 PM, Anders Carlsson <andersca at mac.com>  
>> wrote:
>>> Author: andersca
>>> Date: Tue Apr  7 21:55:55 2009
>>> New Revision: 68583
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=68583&view=rev
>>> Log:
>>> Don't assume that a block always has a FunctionProtoType. Fixes  
>>> rdar://6768379.
>>
>> Maybe we should make "int (^a0)()" and "int (^a0)(void)" equivalent?
>
> I agree with you. IIRC this is what I originally implemented (in  
> clang). I forget what motivated us to support K&R style as a  
> "convenience" (see excerpt below). Fariborz?

In gcc,  initially we followed the rules for function pointers for  
lack of a detailed specification.
As usage of blocks start getting traction, we tightened the rules as  
outlined below.

- Fariborz




>
> snaroff
>
> Here is an excerpt from the Blocks spec:
>
> Block Variable Declarations
>
> A variable with Block type is declared using function pointer style  
> notation substituting ^ for *. The following are valid Block  
> variable declarations:
>     void (^blockReturningVoidWithVoidArgument)(void);
>     int (^blockReturningIntWithIntAndCharArguments)(int, char);
>     void (^arrayOfTenBlocksReturningVoidWithIntArgument[10])(int);
>
> Variadic ... arguments are supported. [variadic.c]  A Block that  
> takes no arguments must specify void in the argument list  
> [voidarg.c].  An empty parameter list does not represent, as K&R  
> provide, an unspecified argument list.  Note: both gcc and clang  
> support K&R style as a convenience.
>
>
>>
>> There's no compatibility reason to keep around functions without
>> prototypes...
>>
>> -Eli
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090408/1f685c6b/attachment.html>


More information about the cfe-commits mailing list