* 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
This commit is contained in:
nobu 2010-10-12 15:03:51 +00:00
parent 150b4efa55
commit cea3919ae6
11 changed files with 41 additions and 18 deletions

View File

@ -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> 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): * win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):

View File

@ -1223,7 +1223,7 @@ singleton_class_of(VALUE obj)
SPECIAL_SINGLETON(Qnil, rb_cNilClass); SPECIAL_SINGLETON(Qnil, rb_cNilClass);
SPECIAL_SINGLETON(Qfalse, rb_cFalseClass); SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
SPECIAL_SINGLETON(Qtrue, rb_cTrueClass); 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) && if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&

View File

@ -1063,9 +1063,23 @@ RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [
#include <stdio.h> #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 AC_TYPE_SIZE_T
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>]) RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.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_BLKSIZE
AC_STRUCT_ST_BLOCKS AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV AC_STRUCT_ST_RDEV

View File

@ -566,13 +566,15 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
} }
#endif #endif
else{ else{
rb_raise(rb_eDLError, const char *name = rb_id2name(cfunc->calltype);
#ifndef LONG_LONG_VALUE if( name ){
"unsupported call type: %lx", rb_raise(rb_eDLError, "unsupported call type: %s",
#else name);
"unsupported call type: %llx", }
#endif else{
cfunc->calltype); rb_raise(rb_eDLError, "unsupported call type: %"PRIxVALUE,
cfunc->calltype);
}
} }
rb_dl_set_last_error(self, INT2NUM(errno)); rb_dl_set_last_error(self, INT2NUM(errno));

View File

@ -83,7 +83,7 @@ extern "C" {
# endif # endif
#endif #endif
#if defined HAVE_UINTPTR_T && 0 #if defined HAVE_UINTPTR_T
typedef uintptr_t VALUE; typedef uintptr_t VALUE;
typedef uintptr_t ID; typedef uintptr_t ID;
# define SIGNED_VALUE intptr_t # define SIGNED_VALUE intptr_t
@ -142,7 +142,8 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
# endif # endif
#endif #endif
#if defined PRIdPTR #if defined PRI_PTRDIFF_PREFIX
#elif defined PRIdPTR
# define PRI_PTRDIFF_PREFIX "t" # define PRI_PTRDIFF_PREFIX "t"
#elif SIZEOF_PTRDIFF_T == SIZEOF_INT #elif SIZEOF_PTRDIFF_T == SIZEOF_INT
# define PRI_PTRDIFF_PREFIX # 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"
#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" # define PRI_SIZE_PREFIX "z"
#elif SIZEOF_SIZE_T == SIZEOF_INT #elif SIZEOF_SIZE_T == SIZEOF_INT
# define PRI_SIZE_PREFIX # define PRI_SIZE_PREFIX

View File

@ -419,7 +419,7 @@ w_symbol(ID id, struct dump_arg *arg)
else { else {
sym = rb_id2str(id); sym = rb_id2str(id);
if (!sym) { 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); encidx = rb_enc_get_index(sym);
if (encidx == rb_usascii_encindex() || if (encidx == rb_usascii_encindex() ||

View File

@ -1274,7 +1274,7 @@ rb_threadptr_execute_interrupts_rec(rb_thread_t *th, int sched_depth)
if (th->thrown_errinfo) { if (th->thrown_errinfo) {
VALUE err = th->thrown_errinfo; VALUE err = th->thrown_errinfo;
th->thrown_errinfo = 0; 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) { if (err == eKillSignal || err == eTerminateSignal) {
th->errinfo = INT2FIX(TAG_FATAL); th->errinfo = INT2FIX(TAG_FATAL);

View File

@ -497,7 +497,7 @@ native_thread_create(rb_thread_t *th)
if (THREAD_DEBUG) { if (THREAD_DEBUG) {
Sleep(0); 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, th->thread_id,
th->native_thread_data.interrupt_event, stack_size); th->native_thread_data.interrupt_event, stack_size);
} }

View File

@ -1,11 +1,11 @@
#define RUBY_VERSION "1.9.3" #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_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk" #define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2010 #define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 10 #define RUBY_RELEASE_MONTH 10
#define RUBY_RELEASE_DAY 12 #define RUBY_RELEASE_DAY 13
#include "ruby/version.h" #include "ruby/version.h"

View File

@ -194,7 +194,7 @@ rb_vmdebug_env_dump_raw(rb_env_t *env, VALUE *lfp, VALUE *dfp)
while (env) { while (env) {
fprintf(stderr, "--\n"); fprintf(stderr, "--\n");
for (i = 0; i < env->env_size; i++) { 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]); (void *)&env->env[i]);
if (&env->env[i] == lfp) if (&env->env[i] == lfp)
fprintf(stderr, " <- lfp"); fprintf(stderr, " <- lfp");

View File

@ -136,7 +136,7 @@ error !
{ {
#define END_INSNS_DISPATCH() \ #define END_INSNS_DISPATCH() \
rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \ rb_bug("unknown insn: %"PRIdVALUE, GET_CURRENT_INSN()); \
} /* end of while loop */ \ } /* end of while loop */ \
#define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__) #define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)