[clinfo] 90/148: Put format macro inclusion/definition in own header

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit 74c9bcba11a2c363bdaa6ef8d4ac45e83e69d031
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Mon Oct 27 21:04:03 2014 +0100

    Put format macro inclusion/definition in own header
---
 src/clinfo.c    | 18 +++++-------------
 src/fmtmacros.h | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index 5e2b235..b07be20 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -2,22 +2,14 @@
  * on all available OpenCL platforms present in the system
  */
 
-/* cl_ulong is always a 64bit integer, so in a few places
-   we want to use its shadow type uint64_t, and print the
-   values using PRIu64. We'll similarly define one for
-   size_t, to make support for non-standard/older compiler
-   easier.
- */
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-
-#ifndef PRIuS
-#define PRIuS "zu" // size_t print spec
-#endif
-
 #include <time.h>
 #include <string.h>
 
+/* Load STDC format macros (PRI*), or define them
+ * for those crappy, non-standard compilers
+ */
+#include "fmtmacros.h"
+
 #include "ext.h"
 #include "error.h"
 #include "memory.h"
diff --git a/src/fmtmacros.h b/src/fmtmacros.h
new file mode 100644
index 0000000..2e18980
--- /dev/null
+++ b/src/fmtmacros.h
@@ -0,0 +1,24 @@
+/* cl_ulong is always a 64bit integer, so in a few places
+   we want to use its shadow type uint64_t, and print the
+   values using PRIu64. We'll similarly define one for
+   size_t, to make support for non-standard/older compiler
+   easier.
+ */
+
+#ifdef _MSC_VER
+#  include <stdint.h>
+#  include <stddef.h> // size_t
+#  define PRIu64 "I64u"
+#  define PRIX64 "I64x"
+#  define PRIXPTR "I64x" // TODO FIXME
+#  define PRIuS "I32u" // TODO FIXME
+#else
+# define __STDC_FORMAT_MACROS
+# include <inttypes.h>
+#endif
+
+// size_t print spec
+#ifndef PRIuS
+# define PRIuS "zu"
+#endif
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list