On Tue, 2011-12-13 at 12:17 -0700, Tom Tromey wrote:
Jakub pointed out this cute typeof trick on the gcc thread about
decl_as_string. This patch changes the plugin to use it.
The end result is similar to using dlsym, but has the benefit of being
type-safe.
If you'd prefer I can reword the patch to continue to use dlsym,
and
just change the declaration of the local decl_as_string to use typeof.
That would also be type-safe.
Nice; thanks. I saw the "typeof" trick, and was thinking of reworking
the dlsym usage to use it to get the typesafety, but was not familiar
with "weak". The "weak" trick seems much simpler and thus clearer
than
dlsym.
This uses a GCC extension, but I figured that was ok for a GCC
plugin.
That seems OK to me too.
This passed all tests on x86-64 F15.
Committed and pushed as 9a6143a02e6f92718ec8ac89ba037f314ae97518
Thanks!
Dave