From 542dee071b1390157232d118ed1d884b297e32b2 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sun, 29 Oct 2006 20:35:35 +0000
Subject: [PATCH] Fixed inclusion of PRI?64 macros from inttypes.h

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2314 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG |  4 +++-
 sm5/int64.h   | 27 +++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 87d3e33d5..21182eda6 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.584 2006/10/27 21:49:41 chrfranke Exp $
+$Id: CHANGELOG,v 1.585 2006/10/29 20:35:35 chrfranke Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Fixed inclusion of PRI?64 macros from inttypes.h.
+
   [CF] Windows: Added WRITE LOG to support selective self tests.
 
   [CF] Fix selective self test log revision number if '-T permissive'
diff --git a/sm5/int64.h b/sm5/int64.h
index dc44a9ee1..0ab1dd4a8 100644
--- a/sm5/int64.h
+++ b/sm5/int64.h
@@ -20,15 +20,18 @@
 #ifndef INT64_H_
 #define INT64_H_
 
-#define INT64_H_CVSID "$Id: int64.h,v 1.15 2006/10/27 20:24:27 chrfranke Exp $\n"
+#define INT64_H_CVSID "$Id: int64.h,v 1.16 2006/10/29 20:35:35 chrfranke Exp $\n"
 
-// 64 bit integer typedefs
+// 64 bit integer typedefs and format strings
 
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+// The ISO C99 standard specifies that in C++ implementations the PRI* macros
+// from <inttypes.h> should only be defined if explicitly requested
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h> // PRId64, PRIu64, PRIx64 (also includes <stdint.h>)
 #else
 #ifdef HAVE_STDINT_H
-#include <stdint.h>
+#include <stdint.h> // int64_t, uint64_t (usually included above)
 #else
 #ifdef HAVE_SYS_INTTYPES_H
 #include <sys/inttypes.h>
@@ -56,24 +59,12 @@ typedef unsigned long long uint64_t;
 #endif // HAVE_STDINT_H
 #endif // HAVE_INTTYPES_H
 
-// 64 bit integer format strings
-
-#if defined(_WIN32)
+#ifdef _WIN32
 // for MSVCRT.DLL (used by both MSVC 6.0 and MinGW)
 #define PRId64 "I64d"
 #define PRIu64 "I64u"
 #define PRIx64 "I64x"
-#endif // _WIN32 && _MSC_VER
-
-#ifdef LINUX_X86_64
-// For Linux x86_64
-#undef PRId64
-#undef PRIu64
-#undef PRIx64
-#define PRId64 "ld"
-#define PRIu64 "lu"
-#define PRIx64 "lx"
-#endif
+#endif // _WIN32
 
 // If macros not defined in inttypes.h, fix here.  Default is GCC
 // style
-- 
GitLab