On 5 October 2012 11:35, Richard Guenther <richard.guent...@gmail.com> wrote: > On Fri, Oct 5, 2012 at 12:07 PM, Iain Buclaw <ibuc...@ubuntu.com> wrote: >> On 5 October 2012 01:06, Joseph S. Myers <jos...@codesourcery.com> wrote: >>> On Thu, 4 Oct 2012, Iain Buclaw wrote: >>> >>>> The only patches to gcc proper are documentation-related and adding >>>> the D frontend / libphobos to configure and make files. I would have >>>> thought that these would typically only be included with the actual >>>> front-end? >>> >>> Looking back at my previous review comments, I suggested that you might >>> need to split up c-common.[ch] so that certain parts of attribute handling >>> could be shared with D, because duplicate code copied from elsewhere in >>> GCC was not an appropriate implementation approach. Have you then >>> eliminated the duplicate code in some other way that does not involve >>> splitting up those files so code can be shared? >>> >> >> Ah, no; thanks for reminding me of this. >> >> The code duplicated from c-common.[ch] are the handlers for C >> __attributes__, however gdc doesn't use all of them because some just >> don't have a fitting place eg: gnu_inline, artificial. >> >> Would the best approach be to move all handle_* functions and any >> helper functions into a new source file that can be shared between >> frontends, and define two new frontend hooks, >> LANG_HOOK_ATTRIBUTE_TABLE and LANG_HOOK_FORMAT_ATTRIBUTE_TABLE ? > > Btw, the LTO frontend also has most of the stuff duplicated ... (see > lto/lto-lang.c). > Not sure why ... > > Richard. >
Looks like LTO's frontend has the relevant attributes duplicated in order to support the attributes used for GCC builtins (const, pure, nothrow, transaction_pure, etc...). Probably only these handlers that could move to a common frontend location, and keep the rest as part of c-family. Regards, -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';