On Wed, 14 Jan 2015, Prathamesh Kulkarni wrote:

> On 14 January 2015 at 16:13, Kugan <kugan.vivekanandara...@linaro.org> wrote:
> > On 14/01/15 21:24, Prathamesh Kulkarni wrote:
> >> On 14 January 2015 at 14:37, Richard Biener <rguent...@suse.de> wrote:
> >>> On Wed, 14 Jan 2015, Prathamesh Kulkarni wrote:
> >>>
> >>>> Hi,
> >>>> I am having an issue with placing includes of expr.h in gcc-plugin.h.
> >>>> rtl.h is required to be included before expr.h, so I put it in 
> >>>> gcc-plugin.h.
> >>>> However the front-ends then fail to build because rtl.h is not allowed
> >>>> in front-ends,
> >>>> and the front-ends include gcc-plugin.h (via plugin.h).
> >>>>
> >>>> For instance ada/gcc-interface/misc.c failed to build with following 
> >>>> error:
> >>>> In file included from ../../gcc/gcc/gcc-plugin.h:64:0,
> >>>>                  from ../../gcc/gcc/plugin.h:23,
> >>>>                  from ../../gcc/gcc/ada/gcc-interface/misc.c:53:
> >>>> ../../gcc/gcc/rtl.h:20:9: error: attempt to use poisoned "GCC_RTL_H"
> >>>>
> >>>> However rtl.h is required to be included before expr.h, so we cannot skip
> >>>> including rtl.h in gcc-plugin.h. How do we get around this ?
> >>>> As a temporary hack, could we #undef IN_GCC_FRONTEND in gcc-plugin.h ?
> >>>> java/builtins.c does this to include expr.h.
> >>>
> >>> Err - obviously nothing in GCC itself should include gcc-plugin.h,
> >>> only plugins should.  Do we tell plugins that they should include
> >>> plugin.h?!  Why is the include in there?
> >>>
> >>> I'd simply remove it....
> >> That doesn't work.
> >> For instance removing plugin.h include from c/c-decl.h resulted in
> >> following build errors:
> >> ../../gcc/gcc/c/c-decl.c: In function \u2018void finish_decl(tree,
> >> location_t, tree, tree, tree)\u2019:
> >> ../../gcc/gcc/c/c-decl.c:4990:27: error:
> >> \u2018PLUGIN_FINISH_DECL\u2019 was not declared in this scope
> >> ../../gcc/gcc/c/c-decl.c:4990:51: error:
> >> \u2018invoke_plugin_callbacks\u2019 was not declared in this scope
> >> ../../gcc/gcc/c/c-decl.c: In function \u2018void finish_function()\u2019:
> >> ../../gcc/gcc/c/c-decl.c:9009:29: error:
> >> \u2018PLUGIN_PRE_GENERICIZE\u2019 was not declared in this scope
> >> ../../gcc/gcc/c/c-decl.c:9009:58: error:
> >> \u2018invoke_plugin_callbacks\u2019 was not declared in this scope
> >> make[3]: *** [c/c-decl.o] Error 1
> >> make[2]: *** [all-stage1-gcc] Error 2
> >> make[1]: *** [stage1-bubble] Error 2
> >> make: *** [all] Error 2
> >>
> >> Why do the front-ends require to include plugin.h ?
> >
> >
> > C/C++ Front-end seems to have callbacks to process declarations. Please
> > look at https://gcc.gnu.org/ml/gcc-patches/2010-04/msg00780.html which
> > added callback PLUGIN_FINISH_DECL.
> Thanks for pointing it out!

I meant to remove the gcc-plugin.h include from plugin.h.

Richard.

> Regards,
> Prathamesh
> >
> > Thanks,
> > Kugan
> >
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg)

Reply via email to