summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 16:21:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 16:21:07 +0000
commitf2427a436f7161d7ceb828d1a4d291f121291485 (patch)
treead50e7647ac41b79ea6cf6b1e515e7dc21040ae6
parent262437b4570087e5743a3db71b550a1d6448401b (diff)
Define PRIdPTR etc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--configure.ac3
-rw-r--r--include/ruby/ruby.h9
-rw-r--r--win32/Makefile.sub2
3 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index d7de84287b..a0aa7c4389 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1596,6 +1596,9 @@ RUBY_DEFINT(int128_t, 16)
RUBY_DEFINT(uint128_t, 16, unsigned)
RUBY_DEFINT(intptr_t, void*)
RUBY_DEFINT(uintptr_t, void*, unsigned)
+AS_IF([test "x$rb_cv_type_intptr_t" != xno], [
+ RUBY_CHECK_PRINTF_PREFIX(intptr_t, '' ll I64 l, PTR)
+])
RUBY_DEFINT(ssize_t, size_t, [], [@%:@include <sys/types.h>]) dnl may differ from int, so not use AC_TYPE_SSIZE_T.
AS_IF([test "x$rb_cv_type_int64_t" != xno], [
RUBY_CHECK_PRINTF_PREFIX(int64_t, ll I64 l, 64)
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 54ac74e7ee..a05651ac3b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -139,6 +139,15 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
#endif
#endif
+#ifndef PRIdPTR
+#define PRIdPTR PRI_PTR_PREFIX"d"
+#define PRIiPTR PRI_PTR_PREFIX"i"
+#define PRIoPTR PRI_PTR_PREFIX"o"
+#define PRIuPTR PRI_PTR_PREFIX"u"
+#define PRIxPTR PRI_PTR_PREFIX"x"
+#define PRIXPTR PRI_PTR_PREFIX"X"
+#endif
+
#define RUBY_PRI_VALUE_MARK "\v"
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
#define PRIdVALUE PRIdPTR
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index db90ad7581..9a9e2b4724 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -762,8 +762,10 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define HAVE_SSIZE_T 1
!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
#define ssize_t __int64
+#define PRI_PTR_PREFIX "I64"
!else
#define ssize_t int
+#define PRI_PTR_PREFIX PRI_INT_PREFIX
!endif
#define PRI_LL_PREFIX "I64"
#define PRI_PIDT_PREFIX PRI_INT_PREFIX