On 08/06/2016 05:34 AM, ayush goel wrote:
> On 5 August 2016 at 4:09:00 AM, Pedro Alves ([email protected]) 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 <whatever-gnu-lib-replacement-header.h> (e.g., #include
<unistd.h>)
-> 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?
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":
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