public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH/libiberty] fix build of gcc-4_2-branch on glibc 2.8
@ 2008-07-26  3:16 Magnus Granberg
  0 siblings, 0 replies; only message in thread
From: Magnus Granberg @ 2008-07-26  3:16 UTC (permalink / raw)
  To: gcc-help

>
> Pixel <pixel@mandriva.com> writes:
>
> > solution below: do not rely in HAVE_DECL_ASPRINTF when __GNU_LIBRARY__ is set
> >
> > (another solution would be to ensure HAVE_DECL_ASPRINTF is detected with _GNU_SOURCE set)
>
> I think a slightly more reliable solution would be
>
> #ifndef asprintf
> extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
> #endif
>
> with an appropriate comment.
>
> Ian
>   

--- include/libiberty.h.old   2008-07-24 06:15:25.000000000 +0200
+++ include/libiberty.h       2008-07-24 06:16:34.000000000 +0200
@@ -553,16 +553,19 @@
 #if !HAVE_DECL_ASPRINTF
 /* Like sprintf but provides a pointer to malloc'd storage, which must
    be freed by the caller.  */
-
+#ifndef asprintf 
+/* Added ifndef to fix that code break on "previous declaration of 'asprintf_chk' was here" 
+   when using glibc 2.8 see http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00292.html */
+ 
 extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
 #endif
+#endif

 #if !HAVE_DECL_VASPRINTF

We have test that code on two system and gcc binutils gdb compiles fine.
/zorry


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-25 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-26  3:16 [PATCH/libiberty] fix build of gcc-4_2-branch on glibc 2.8 Magnus Granberg

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).