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.


The test case does not have #define _GNU_SOURCE, so it says
error: âasprintfâ undeclared (first use in this function)

On Fri, May 1, 2015 at 3:45 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Apr 28, 2015 at 2:59 PM, Yunlian Jiang <yunlian@google.com> wrote:
>> I believe this is the same problem as
>> https://gcc.gnu.org/ml/gcc-patches/2008-07/msg00292.html
>>
>> The asprinf declaration is  messed up when using clang to build gdb.
>>
>> diff --git a/include/libiberty.h b/include/libiberty.h
>> index b33dd65..a294903 100644
>> --- a/include/libiberty.h
>> +++ b/include/libiberty.h
>> @@ -625,8 +625,10 @@ extern int pwait (int, int *, int);
>>  /* Like sprintf but provides a pointer to malloc'd storage, which must
>>     be freed by the caller.  */
>>
>> +#ifndef asprintf
>>  extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
>>  #endif
>> +#endif
>>
>>  /* Like asprintf but allocates memory without fail. This works like
>>     xmalloc.  */
>
> Why is HAVE_DECL_ASPRINTF not defined?
>
> Ian


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