[Spice-devel] [PATCH spice] Ensure __STDC_FORMAT_MACROS is always defined first
Daniel P. Berrange
berrange at redhat.com
Wed Apr 25 07:19:16 PDT 2012
From: "Daniel P. Berrange" <berrange at redhat.com>
The client/common.h file defines __STDC_FORMAT_MACROS before
including inttypes.h so that the PRI* macros get defined in
C++. This is ignoring the possibility that other global
includes may have already pulled in inttypes.h
We need __STDC_FORMAT_MACROS to be defined before any header
files are included. Putting it in config.h satisfies this,
since config.h is always the first header
---
client/common.h | 1 -
configure.ac | 2 ++
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/client/common.h b/client/common.h
index e9a7ea8..ca3609f 100644
--- a/client/common.h
+++ b/client/common.h
@@ -26,7 +26,6 @@
#include <errno.h>
#endif
-#define __STDC_FORMAT_MACROS
#ifndef _WIN32
#include <inttypes.h>
#endif
diff --git a/configure.ac b/configure.ac
index f5b014f..4b24c7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,8 @@ AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([execinfo.h])
AC_FUNC_ALLOCA
+AC_DEFINE([__STDC_FORMAT_MACROS],[],[Force definition of format macros for C++])
+
SPICE_LT_VERSION=m4_format("%d:%d:%d", 1, 0, 2)
AC_SUBST(SPICE_LT_VERSION)
--
1.7.7.6
More information about the Spice-devel
mailing list