[PATCH] libiberty: Only declare vasprintf if it was checked for

Michael Forney mforney@mforney.org
Tue Apr 23 08:18:00 GMT 2019


This matches how the the rest of the libc functions are declared and
prevents a potential conflict with the system declaration when libiberty.h
is included from a directory that did not check for vasprintf, but it is
available. It also corresponds to a similar previous change for asprintf
(r223589).

2019-04-22  Michael Forney  <mforney@mforney.org>

	* libiberty.h (vasprintf): Don't declare if HAVE_DECL_VASPRINTF
	is not defined.

---
 include/libiberty.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/libiberty.h b/include/libiberty.h
index 57476135026..e11aa97f0ba 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -649,7 +649,7 @@ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
 
 extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1;
 
-#if !HAVE_DECL_VASPRINTF
+#if defined(HAVE_DECL_VASPRINTF) && !HAVE_DECL_VASPRINTF
 /* Like vsprintf but provides a pointer to malloc'd storage, which
    must be freed by the caller.  */
 
-- 
2.20.1



More information about the Gcc-patches mailing list