Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-22 Thread Ian Lance Taylor
On Wed, May 20, 2015 at 3:58 PM, Yunlian Jiang wrote: > GCC bootstraps with this patch. Committed as follows. Ian include/: 2015-05-22 Yunlian Jiang * libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is not defined. libiberty/: 2015-05-22 Yunlian Jiang * configure.ac: Add

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-20 Thread Yunlian Jiang
GCC bootstraps with this patch. On Wed, May 20, 2015 at 12:54 PM, Ian Lance Taylor wrote: > This is OK if GCC bootstraps. > > Thanks. > > Ian > > On Wed, May 20, 2015 at 11:25 AM, Yunlian Jiang wrote: >> I have the following change to make libiberty compile with _GNU_SOURCE >> defined >> and re

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-20 Thread Ian Lance Taylor
This is OK if GCC bootstraps. Thanks. Ian On Wed, May 20, 2015 at 11:25 AM, Yunlian Jiang wrote: > I have the following change to make libiberty compile with _GNU_SOURCE defined > and remove the declaration of asprintf in libiberty.h if > HAVE_DECL_ASPRINTF is not > defined. > > diff --git a/in

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-20 Thread Yunlian Jiang
I have the following change to make libiberty compile with _GNU_SOURCE defined and remove the declaration of asprintf in libiberty.h if HAVE_DECL_ASPRINTF is not defined. diff --git a/include/libiberty.h b/include/libiberty.h index b33dd65..8e096a0 100644 --- a/include/libiberty.h +++ b/include/li

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-19 Thread Ian Lance Taylor
On Tue, May 19, 2015 at 11:08 AM, Yunlian Jiang 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 > th

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-19 Thread DJ Delorie
> If the other c file only includes libiberty.h and does not include the > libiberty/config.h and In general, such "other c files" should have their own config.h that does the same test and has its own HAVE_DECL_ASPRINTF. That way, the config.h matches the compiler options being used, and not th

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-19 Thread Yunlian Jiang
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 p

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-18 Thread Ian Lance Taylor
On Mon, May 18, 2015 at 4:26 PM, Yunlian Jiang wrote: > > Yes, the problem is libiberty is compiling some files > with _GNU_SOURCE defined and some not. So the configure > file does not include "#define _GNU_SOURCE". As far as I can see it should be fine to define _GNU_SOURCE when compiling all

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-18 Thread Yunlian Jiang
Yes, the problem is libiberty is compiling some files with _GNU_SOURCE defined and some not. So the configure file does not include "#define _GNU_SOURCE". I have reduced the failing compiling as below. #define _GNU_SOURCE (1) #define ATTRIBUTE_NONNULL(m) __at

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-04 Thread Ian Lance Taylor
On Mon, May 4, 2015 at 3:49 PM, Yunlian Jiang wrote: > There was a similar disscussion here > https://gcc.gnu.org/ml/gcc/2005-11/msg01190.html That was a discussion about libiberty. Your subject says you have trouble building gdb. Can you describe the exact problem that you are having? What pr

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-04 Thread Yunlian Jiang
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

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-02 Thread Ian Lance Taylor
On Fri, May 1, 2015 at 4:45 PM, Yunlian Jiang 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_ASPRINT

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-01 Thread Yunlian Jiang
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 wrote: > On Tue, Apr 28, 2015 at 2:59 PM, Yunlian Jiang wrote: >> I believe this is the same problem as >> https://gcc.gnu.org/ml

Re: [PATCH/libiberty] fix build of gdb/binutils with clang.

2015-05-01 Thread Ian Lance Taylor
On Tue, Apr 28, 2015 at 2:59 PM, Yunlian Jiang 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 b33dd

[PATCH/libiberty] fix build of gdb/binutils with clang.

2015-04-28 Thread Yunlian Jiang
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/libibert