diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-06-23 22:51:31 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-06-23 22:52:45 +0900 |
commit | b180ffa62270dc32bb69167822b4c698def5c8f7 (patch) | |
tree | 209f0db209dafc9c6e0fe24573b06aa4d68694a6 | |
parent | 41cdf9b11457992f49f1252db83de4280456679e (diff) |
Fix warnings by old gcc
* Use PRIxSIZE instead of "z"
* Fix sign-compare warning
* Suppress unused-but-set-variable warning
-rw-r--r-- | addr2line.c | 10 | ||||
-rw-r--r-- | io_buffer.c | 4 | ||||
-rw-r--r-- | thread_win32.c | 3 |
3 files changed, 9 insertions, 8 deletions
diff --git a/addr2line.c b/addr2line.c index aa0226e341..fe4ad84423 100644 --- a/addr2line.c +++ b/addr2line.c @@ -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; } diff --git a/io_buffer.c b/io_buffer.c index d9a9f40bd7..7039ef71b8 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -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) { diff --git a/thread_win32.c b/thread_win32.c index ccff8bc93f..714d601340 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -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); |