public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yunlian Jiang <yunlian@google.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH/libiberty] fix build of gdb/binutils with clang.
Date: Mon, 04 May 2015 22:49:00 -0000	[thread overview]
Message-ID: <CAMsPy2s2A8U-vTE8u9y+P+xmESKMSuHD=6RV798KNEQKbZdXUg@mail.gmail.com> (raw)
In-Reply-To: <CAKOQZ8z7ME_yEbW3YgMWCLyRVz+w3wjYz7LNayBBBmC1atFYHA@mail.gmail.com>

There was a similar disscussion here
https://gcc.gnu.org/ml/gcc/2005-11/msg01190.html

The problem is in the configure stage, the __GNU_SOURCE is not
defined, and it could not find
the declaration of asprintf. so it make a declaration of asprintf in
libiberty.h. And  for the file floatformat.c,
the  __GNU_SOURCE is defined, so it could find another asprintf in
/usr/include/bits/stdio2.h, it also includes
libiberty.h. So these two asprintf conflicts when __USE_FORTIFY_LEVEL is set.

On Sat, May 2, 2015 at 11:58 AM, Ian Lance Taylor <iant@google.com> wrote:
> On Fri, May 1, 2015 at 4:45 PM, Yunlian Jiang <yunlian@google.com> wrote:
>> The test case does not have #define _GNU_SOURCE, so it says
>> error: ‘asprintf’ undeclared (first use in this function)
>
> OK, then my next question is: why does the test case (I assume you
> mean the test case for whether to set HAVE_DECL_ASPRINTF) not have
> #define _GNU_SOURCE?
>
> What is the background here?
>
> Ian
>
>> 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

  reply	other threads:[~2015-05-04 22:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 22:30 Yunlian Jiang
2015-05-01 22:45 ` Ian Lance Taylor
2015-05-01 23:45   ` Yunlian Jiang
2015-05-02 18:58     ` Ian Lance Taylor
2015-05-04 22:49       ` Yunlian Jiang [this message]
2015-05-05  0:30         ` Ian Lance Taylor
2015-05-18 23:52           ` Yunlian Jiang
2015-05-19  0:15             ` Ian Lance Taylor
2015-05-19 18:15               ` Yunlian Jiang
2015-05-19 18:16                 ` DJ Delorie
2015-05-19 18:16                 ` Ian Lance Taylor
2015-05-20 18:28                   ` Yunlian Jiang
2015-05-20 20:15                     ` Ian Lance Taylor
2015-05-20 23:27                       ` Yunlian Jiang
2015-05-22 21:25                         ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMsPy2s2A8U-vTE8u9y+P+xmESKMSuHD=6RV798KNEQKbZdXUg@mail.gmail.com' \
    --to=yunlian@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).