Permalink
Browse files

* 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
  • Loading branch information...
1 parent 150b4ef commit cea3919ae61ae16e04a5ee5c5394970c3960a0af @nobu nobu committed Oct 12, 2010
Showing with 41 additions and 18 deletions.
  1. +5 −0 ChangeLog
  2. +1 −1 class.c
  3. +14 −0 configure.in
  4. +9 −7 ext/dl/cfunc.c
  5. +5 −3 include/ruby/ruby.h
  6. +1 −1 marshal.c
  7. +1 −1 thread.c
  8. +1 −1 thread_win32.c
  9. +2 −2 version.h
  10. +1 −1 vm_dump.c
  11. +1 −1 vm_exec.h
View
@@ -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):
View
@@ -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) &&
View
@@ -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
View
@@ -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));
View
@@ -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
View
@@ -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() ||
View
@@ -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);
View
@@ -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);
}
View
@@ -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"
View
@@ -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");
View
@@ -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__)

0 comments on commit cea3919

Please sign in to comment.