On Tue, May 19, 2015 at 11:08 AM, Yunlian Jiang <yunl...@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