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/libiberty] fix build of gdb/binutils with clang.


On Tue, May 19, 2015 at 11:08 AM, Yunlian Jiang <yunlian@google.com> wrote:
>
> I could do that and it make the compilation of libiberty passes.
> However, I  have some other problem when using clang to build gdb
> because of libiberty.
>
> Some c file from other component may include 'libiberty.h' which contains
> the following
>
> #if !HAVE_DECL_ASPRINTF
> /* Like sprintf but provides a pointer to malloc'd storage, which must
>    be freed by the caller.  */
>
> extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
> #endif
>
> The HAVE_DECL_ASPRINTF is defined in config.h under libiberty directory.
> If the other c file only includes libiberty.h and does not include the
> libiberty/config.h and
> at the same time, _GNU_SOURCE is defind, the same error happens.

Probably if HAVE_DECL_ASPRINTF is not defined at all, we should not
declare asprintf in libiberty.h.

Ian


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