[cfe-commits] r70098 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/attr-cleanup.c

Anders Carlsson andersca at mac.com
Sat Apr 25 18:35:19 PDT 2009


25 apr 2009 kl. 18.30 skrev Eli Friedman:

> On Sat, Apr 25, 2009 at 5:34 PM, Anders Carlsson <andersca at mac.com>  
> wrote:
>> +    // In some cases, the type of the function argument will be  
>> different from
>> +    // the type of the pointer. An example of this is
>> +    // void f(void* arg);
>> +    // __attribute__((cleanup(f))) void *g;
>> +    //
>> +    // To fix this we insert a bitcast here.
>
> Bitcasting isn't quite right... take the following testcase:
> void c4(_Bool a);
> void t4() {
>  __attribute((cleanup(c4))) void* g;
> }
>

Sema will catch that before it gets to codegen:

t.c:18:15: error: 'cleanup' function 'c4' parameter has type '_Bool'  
which is incompatible with type 'void **'
  __attribute((cleanup(c4))) void* g;
               ^





More information about the cfe-commits mailing list