[PATCH:libICE] Fix stdio.h include for asprintf.

Cyril Brulebois kibi at debian.org
Sun Dec 19 09:43:49 PST 2010


asprintf is a GNU extension and one needs to define _GNU_SOURCE before
including stdio.h. Otherwise, the build breaks this way with
CFLAGS="-Wall -Werror":
|   CC     process.lo
| cc1: warnings being treated as errors
| process.c: In function ‘ProcessError’:
| process.c:672: error: implicit declaration of function ‘asprintf’
| process.c:672: error: nested extern declaration of ‘asprintf’
| make[2]: *** [process.lo] Error 1

Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
 src/process.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/process.c b/src/process.c
index 58c6894..bdeeb7f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -29,6 +29,12 @@ Author: Ralph Mor, X Consortium
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+#ifdef HAVE_ASPRINTF
+#define _GNU_SOURCE
+#include <stdio.h>
+#endif
+
 #include <X11/ICE/ICElib.h>
 #include "ICElibint.h"
 
-- 
1.7.2.3



More information about the xorg-devel mailing list