[RFC][objc] Get rid of aliasing warning for @selector()
Zack Weinberg
zack@codesourcery.com
Wed Jun 23 07:45:00 GMT 2004
Alexander Malmberg <alexander@malmberg.org> writes:
...
> The two structs are, in practice, identical (modulo a const), but
> they're different types, so build_c_cast() warns when the selector
> reference is cast to the right type. The attached patch fixes this by
> adding a 'void *' cast before casting to 'const struct objc_selector *'.
> This confuses build_c_cast() enough to make it not warn. libobjc builds,
> 'make check-objc' doesn't show any new failures, and on a ~8000 line
> sample, the generated code is identical.
>
> Is this an acceptable way of dealing with this problem? If not, what
> would be?
The bug is in using build_c_cast in the first place. You want plain
old convert(), or possibly fold_convert().
zw
More information about the Gcc-patches
mailing list