tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: "strict" weak aliases
On Sun, Jul 24, 2011 at 11:26:13PM +1000, matthew green wrote:
>
> > Sometimes it is important that the type of an object matches the
> > type of its weak alias. See the attached patch that both adds a
> > type-safe __weak_alias() called __strict_weak_alias(), and fixes a buggy
> > __weak_alias() that __strict_weak_alias() would have caught during
> > compilation.
> >
> > Thanks to Taylor R. Campbell for the incantation that was key
> > to making this work,
> >
> > __unused static typeof(alias) *__weak_alias_##alias = &sym;
> >
> > Does this look ok to commit?
>
> could you bring this up on tech-toolchain? i think it would be useful
> for userland as well.
Ok, bringing it up. :-)
> one thing -- please change it to use __typeof__. (we should change
> to using this everywhere we use typeof today. not your problem :)
Sure. Is it __typeof__() or __typeof(), though? I'm told that
__typeof__() is in the GCC manual, however, NetBSD uses __typeof() at
least once:
sys/dirent.h:#define _DIRENT_NAMEOFF(dp) __builtin_offsetof(__typeof(*dp),
d_name)
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 344-0444 x24
Home |
Main Index |
Thread Index |
Old Index