On Wed, May 20, 2015 at 3:58 PM, Yunlian Jiang <yunl...@google.com> wrote:
> GCC bootstraps with this patch.

Committed as follows.

Ian


include/:

2015-05-22  Yunlian Jiang  <yunl...@google.com>

* libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is
not defined.

libiberty/:

2015-05-22  Yunlian Jiang  <yunl...@google.com>

* configure.ac: Add AC_GNU_SOURCE.
* Makefile.in (COMPILE.c): Add -D_GNU_SOURCE.
* configure, config.in: Rebuild.
* floatformat.c (_GNU_SOURCE): Don't define if already defined.
Index: include/libiberty.h
===================================================================
--- include/libiberty.h (revision 223578)
+++ include/libiberty.h (working copy)
@@ -621,7 +621,7 @@ extern int pexecute (const char *, char
 
 extern int pwait (int, int *, int);
 
-#if !HAVE_DECL_ASPRINTF
+#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF
 /* Like sprintf but provides a pointer to malloc'd storage, which must
    be freed by the caller.  */
 
Index: libiberty/Makefile.in
===================================================================
--- libiberty/Makefile.in       (revision 223578)
+++ libiberty/Makefile.in       (working copy)
@@ -113,7 +113,8 @@ installcheck: installcheck-subdir
 
 INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 
-COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) 
@ac_libiberty_warn_cflags@
+COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) \
+               $(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE
 
 # Just to make sure we don't use a built-in rule with VPATH
 .c.$(objext):
Index: libiberty/configure.ac
===================================================================
--- libiberty/configure.ac      (revision 223578)
+++ libiberty/configure.ac      (working copy)
@@ -155,6 +155,7 @@ AC_MSG_NOTICE([target_header_dir = $targ
 
 GCC_NO_EXECUTABLES
 AC_PROG_CC
+AC_GNU_SOURCE
 AC_SYS_LARGEFILE
 AC_PROG_CPP_WERROR
 
Index: libiberty/floatformat.c
===================================================================
--- libiberty/floatformat.c     (revision 223578)
+++ libiberty/floatformat.c     (working copy)
@@ -19,7 +19,9 @@ along with this program; if not, write t
 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 
USA.  */
 
 /* This is needed to pick up the NAN macro on some systems.  */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"

Reply via email to