This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH build/doc] Replacing libiberty with gnulib


On 9 August 2016 at 2:20:59 PM, Pedro Alves (palves@redhat.com) wrote:
> On 08/06/2016 05:34 AM, ayush goel wrote:
> > On 5 August 2016 at 4:09:00 AM, Pedro Alves (palves@redhat.com) wrote:
> >> On 08/02/2016 12:38 AM, Manuel López-Ibáñez wrote:
> >>>
> >>> If there is something wrong or missing, ideally we would like to know
> >>> so that Ayush can work on fixing it before the Summer of Code is over
> >>> in less than two weeks.
> >>
> >> I couldn't see anywhere gnulib's config.h file is included.
> >>
> >> gnulib's replacement headers and (and .c files) depend on
> >> that being included.
> >>
> >> Did I simply miss it?
> >>
> >
> > gnulib’s config.h is created on compile time. After building the
> > library it is present inside gnulib build folder.
>
> Sure, but that was not the question. The question is how are
> the gcc files including that new config.h file.
>
> E.g., how come you're not getting this:
>
> gcc/foo.c
> -> #include "config.h" (pick up gcc's config.h not the new gnulib one)
> -> #include (e.g., #include )
> -> trip on #error in gnulib replacement header:
> #ifndef _GL_INLINE_HEADER_BEGIN
> #error "Please include config.h first."
> #endif
>
> As explained here:
>
> https://gcc.gnu.org/ml/gcc/2016-06/msg00144.html
>
> and here in more detail:
>
> https://sourceware.org/ml/gdb-patches/2012-04/msg00426.html
>
> the scheme of configuring gnulib in a separate directory as borrowed from gdb
> requires including two config.h headers -- the gnulib client's, and gnulib's.
>
> Did you do something different that avoids needing that somehow?

I wasn’t aware of this. Thanks for pointing this out.
It’s strange however, I didn’t see anything failing while
building/testing my system.
>
> In gdb, .c files don't include "config.h" directly. Instead all .c files
> include a "defs.h" file first thing, and that in turn (after another indirection)
> is what includes both gdb's "config.h" and gnulib's "config.h”:

Can gcc also adopt a similar approach? Include gnulib’s config.h in a
single header file instead of including it in every function that uses
it.
Which header file would be the most suitable for this purpose(probably
which is generically included by almost all the gcc functions)?
>
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/common/common-defs.h;h=2c9411704531b510d176a4a22a718ae8313294e7;hb=HEAD#l23
>
> Thanks,
> Pedro Alves
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]