summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-12 15:03:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-12 15:03:51 +0000
commitcea3919ae61ae16e04a5ee5c5394970c3960a0af (patch)
tree41c74b4c9bc624cc96691bf759a7d177f3345171
parent150b4efa5510d77fdde7b9692b3c391fbde6ac19 (diff)
* configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
specifier if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--class.c2
-rw-r--r--configure.in14
-rw-r--r--ext/dl/cfunc.c16
-rw-r--r--include/ruby/ruby.h8
-rw-r--r--marshal.c2
-rw-r--r--thread.c2
-rw-r--r--thread_win32.c2
-rw-r--r--version.h4
-rw-r--r--vm_dump.c2
-rw-r--r--vm_exec.h2
11 files changed, 41 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 67ddf78..933ecf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Oct 13 00:03:46 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CHECK_PRINTF_PREFIX): check for printf format
+ specifier if possible.
+
Tue Oct 12 23:58:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):
diff --git a/class.c b/class.c
index 1d4695b..76d16d1 100644
--- a/class.c
+++ b/class.c
@@ -1223,7 +1223,7 @@ singleton_class_of(VALUE obj)
SPECIAL_SINGLETON(Qnil, rb_cNilClass);
SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
- rb_bug("unknown immediate %ld", obj);
+ rb_bug("unknown immediate %p", (void *)obj);
}
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
diff --git a/configure.in b/configure.in
index 2e0662a..859e857 100644
--- a/configure.in
+++ b/configure.in
@@ -1063,9 +1063,23 @@ RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [
#include <stdio.h>
])
+AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
+AC_CACHE_CHECK([printf prefix for $1], rb_cv_pri_prefix_[$1],
+ RUBY_WERROR_FLAG(AC_TRY_COMPILE(
+ [@%:@include <stdio.h>],
+ [printf("%]$2[d", sizeof(long));],
+ [rb_cv_pri_prefix_[$1]=[$2]],
+ [rb_cv_pri_prefix_[$1]=[NONE]])))
+if test "$rb_cv_pri_prefix_[$1]" != NONE; then
+ AC_DEFINE_UNQUOTED([PRI_]AS_TR_CPP(m4_bpatsubst([$1],[_t$]))[_PREFIX], "$rb_cv_pri_prefix_[$1]")
+fi
+])
+
AC_TYPE_SIZE_T
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>])
+RUBY_CHECK_PRINTF_PREFIX(size_t, z)
+RUBY_CHECK_PRINTF_PREFIX(ptrdiff_t, t)
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index f5ad3dd..33ac784 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -566,13 +566,15 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
}
#endif
else{
- rb_raise(rb_eDLError,
-#ifndef LONG_LONG_VALUE
- "unsupported call type: %lx",
-#else
- "unsupported call type: %llx",
-#endif
- cfunc->calltype);
+ const char *name = rb_id2name(cfunc->calltype);
+ if( name ){
+ rb_raise(rb_eDLError, "unsupported call type: %s",
+ name);
+ }
+ else{
+ rb_raise(rb_eDLError, "unsupported call type: %"PRIxVALUE,
+ cfunc->calltype);
+ }
}
rb_dl_set_last_error(self, INT2NUM(errno));
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 028f4e9..6dabba6 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -83,7 +83,7 @@ extern "C" {
# endif
#endif
-#if defined HAVE_UINTPTR_T && 0
+#if defined HAVE_UINTPTR_T
typedef uintptr_t VALUE;
typedef uintptr_t ID;
# define SIGNED_VALUE intptr_t
@@ -142,7 +142,8 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
# endif
#endif
-#if defined PRIdPTR
+#if defined PRI_PTRDIFF_PREFIX
+#elif defined PRIdPTR
# define PRI_PTRDIFF_PREFIX "t"
#elif SIZEOF_PTRDIFF_T == SIZEOF_INT
# define PRI_PTRDIFF_PREFIX
@@ -158,7 +159,8 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
#define PRIxPTRDIFF PRI_PTRDIFF_PREFIX"x"
#define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X"
-#if defined PRIdPTR
+#if defined PRI_SIZE_PREFIX
+#elif defined PRIdPTR
# define PRI_SIZE_PREFIX "z"
#elif SIZEOF_SIZE_T == SIZEOF_INT
# define PRI_SIZE_PREFIX
diff --git a/marshal.c b/marshal.c
index d2ffbd4..0df199a 100644
--- a/marshal.c
+++ b/marshal.c
@@ -419,7 +419,7 @@ w_symbol(ID id, struct dump_arg *arg)
else {
sym = rb_id2str(id);
if (!sym) {
- rb_raise(rb_eTypeError, "can't dump anonymous ID %ld", id);
+ rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, id);
}
encidx = rb_enc_get_index(sym);
if (encidx == rb_usascii_encindex() ||
diff --git a/thread.c b/thread.c
index 294df1a..c28ea9c 100644
--- a/thread.c
+++ b/thread.c
@@ -1274,7 +1274,7 @@ rb_threadptr_execute_interrupts_rec(rb_thread_t *th, int sched_depth)
if (th->thrown_errinfo) {
VALUE err = th->thrown_errinfo;
th->thrown_errinfo = 0;
- thread_debug("rb_thread_execute_interrupts: %ld\n", err);
+ thread_debug("rb_thread_execute_interrupts: %"PRIdVALUE"\n", err);
if (err == eKillSignal || err == eTerminateSignal) {
th->errinfo = INT2FIX(TAG_FATAL);
diff --git a/thread_win32.c b/thread_win32.c
index 9e64ea4..1b15bae 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -497,7 +497,7 @@ native_thread_create(rb_thread_t *th)
if (THREAD_DEBUG) {
Sleep(0);
- thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %d\n",
+ thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %"PRIdSIZE"\n",
th, th->thread_id,
th->native_thread_data.interrupt_event, stack_size);
}
diff --git a/version.h b/version.h
index f771b2f..d39060c 100644
--- a/version.h
+++ b/version.h
@@ -1,11 +1,11 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_RELEASE_DATE "2010-10-12"
+#define RUBY_RELEASE_DATE "2010-10-13"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 12
+#define RUBY_RELEASE_DAY 13
#include "ruby/version.h"
diff --git a/vm_dump.c b/vm_dump.c
index 98bd972..5a76cae 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -194,7 +194,7 @@ rb_vmdebug_env_dump_raw(rb_env_t *env, VALUE *lfp, VALUE *dfp)
while (env) {
fprintf(stderr, "--\n");
for (i = 0; i < env->env_size; i++) {
- fprintf(stderr, "%04d: %08lx (%p)", -env->local_size + i, env->env[i],
+ fprintf(stderr, "%04d: %08"PRIxVALUE" (%p)", -env->local_size + i, env->env[i],
(void *)&env->env[i]);
if (&env->env[i] == lfp)
fprintf(stderr, " <- lfp");
diff --git a/vm_exec.h b/vm_exec.h
index 7696d71..7208c3d 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -136,7 +136,7 @@ error !
{
#define END_INSNS_DISPATCH() \
- rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
+ rb_bug("unknown insn: %"PRIdVALUE, GET_CURRENT_INSN()); \
} /* end of while loop */ \
#define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)