1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix warnings by old gcc

* Use PRIxSIZE instead of "z"
* Fix sign-compare warning
* Suppress unused-but-set-variable warning
This commit is contained in:
Nobuyoshi Nakada 2022-06-23 22:51:31 +09:00
parent 41cdf9b114
commit b180ffa622
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
3 changed files with 9 additions and 8 deletions

View file

@ -1292,7 +1292,7 @@ hexdump0(const unsigned char *p, size_t n)
for (i=0; i < n; i++){
switch (i & 15) {
case 0:
fprintf(stderr, "%02zd: %02X ", i/16, p[i]);
fprintf(stderr, "%02" PRIdSIZE ": %02X ", i/16, p[i]);
break;
case 15:
fprintf(stderr, "%02X\n", p[i]);
@ -1313,16 +1313,16 @@ div_inspect(DebugInfoValue *v)
{
switch (v->type) {
case VAL_uint:
fprintf(stderr,"%d: type:%d size:%zx v:%"PRIx64"\n",__LINE__,v->type,v->size,v->as.uint64);
fprintf(stderr,"%d: type:%d size:%" PRIxSIZE " v:%"PRIx64"\n",__LINE__,v->type,v->size,v->as.uint64);
break;
case VAL_int:
fprintf(stderr,"%d: type:%d size:%zx v:%"PRId64"\n",__LINE__,v->type,v->size,(int64_t)v->as.uint64);
fprintf(stderr,"%d: type:%d size:%" PRIxSIZE " v:%"PRId64"\n",__LINE__,v->type,v->size,(int64_t)v->as.uint64);
break;
case VAL_cstr:
fprintf(stderr,"%d: type:%d size:%zx v:'%s'\n",__LINE__,v->type,v->size,v->as.ptr);
fprintf(stderr,"%d: type:%d size:%" PRIxSIZE " v:'%s'\n",__LINE__,v->type,v->size,v->as.ptr);
break;
case VAL_data:
fprintf(stderr,"%d: type:%d size:%zx v:\n",__LINE__,v->type,v->size);
fprintf(stderr,"%d: type:%d size:%" PRIxSIZE " v:\n",__LINE__,v->type,v->size);
hexdump(v->as.ptr, 16);
break;
}

View file

@ -680,10 +680,10 @@ io_buffer_hexdump(VALUE string, size_t width, char *base, size_t size, int first
for (size_t offset = 0; offset < size; offset += width) {
memset(text, '\0', width);
if (first) {
rb_str_catf(string, "0x%08zx ", offset);
rb_str_catf(string, "0x%08" PRIxSIZE " ", offset);
first = 0;
} else {
rb_str_catf(string, "\n0x%08zx ", offset);
rb_str_catf(string, "\n0x%08" PRIxSIZE " ", offset);
}
for (size_t i = 0; i < width; i += 1) {

View file

@ -213,7 +213,7 @@ w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th)
DWORD ret;
w32_event_debug("events:%p, count:%d, timeout:%ld, th:%u\n",
events, count, timeout, th ? rb_th_serial(th) : -1);
events, count, timeout, th ? rb_th_serial(th) : UINT_MAX);
if (th && (intr = th->nt->interrupt_event)) {
if (ResetEvent(intr) && (!RUBY_VM_INTERRUPTED(th->ec) || SetEvent(intr))) {
@ -347,6 +347,7 @@ native_sleep(rb_thread_t *th, rb_hrtime_t *rel)
RUBY_DEBUG_LOG("start msec:%lu", msec);
ret = w32_wait_events(0, 0, msec, th);
RUBY_DEBUG_LOG("done ret:%lu", ret);
(void)ret;
}
rb_native_mutex_lock(&th->interrupt_lock);