[llvm-commits] [compiler-rt] r82605 - /compiler-rt/trunk/BlocksRuntime/runtime.c
Chris Lattner
clattner at apple.com
Wed Sep 23 09:47:11 PDT 2009
On Sep 23, 2009, at 8:18 AM, Shantonu Sen wrote:
> compiler-rt builds with -pedantic, and on Linux with gcc 4.3.3 the
> original code got:
> #include <stdio.h>
> #include <stdint.h>
>
> int main(int argc, char *argv[]) {
> printf("%p\n", main);
> return 0;
> }
>
> ssen at ssen:~$ cc -o main main.c -Wall -Os -std=c99 -pedantic
> main.c: In function ‘main’:
> main.c:4: warning: format ‘%p’ expects type ‘void *’, but argument 2
> has type ‘int (*)(int, char **)’
>
> If I added a (void *) cast I got:
> ssen at ssen:~$ cc -o main main.c -Wall -Os -std=c99 -pedantic
> main.c: In function ‘main’:
> main.c:4: warning: ISO C forbids conversion of function pointer to
> object pointer type
>
> I guess you could really bludgeon this code to death with (void *)
> (uintptr_t), but this seems kind of absurd, so I stopped short of
> that... Maybe that's what we want, since it is logically an address...
We use (void*)(intptr_t) elsewhere, that's what I'd go for. :-/
-Chris
More information about the llvm-commits
mailing list