Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add macro for %zu to support MVSC
  • Loading branch information
rudis committed Apr 2, 2015
1 parent 48d2be3 commit 684d8ae
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/6model/serialization.c
Expand Up @@ -1661,7 +1661,7 @@ static void check_and_dissect_input(MVMThreadContext *tc,
/* Ensure that the data is at least as long as the header is expected to be. */
if (data_len < header_size)
fail_deserialize(tc, reader,
"Serialized data shorter than header (< %zu bytes)", header_size);
"Serialized data shorter than header (< %"MVM_PRSz" bytes)", header_size);
prov_pos += header_size;

/* Get size and location of dependencies table. */
Expand Down
2 changes: 1 addition & 1 deletion src/core/exceptions.c
Expand Up @@ -681,7 +681,7 @@ void MVM_panic(MVMint32 exitCode, const char *messageFormat, ...) {

MVM_NO_RETURN
void MVM_panic_allocation_failed(size_t len) {
MVM_panic(1, "Memory allocation failed; could not allocate %zu bytes", len);
MVM_panic(1, "Memory allocation failed; could not allocate %"MVM_PRSz" bytes", len);
}

/* Throws an ad-hoc (untyped) exception. */
Expand Down
2 changes: 1 addition & 1 deletion src/core/threads.c
Expand Up @@ -201,7 +201,7 @@ void MVM_thread_cleanup_threads_list(MVMThreadContext *tc, MVMThread **head) {
this->body.next = NULL;
break;
default:
MVM_panic(MVM_exitcode_threads, "Thread in unknown stage: %zu\n", this->body.stage);
MVM_panic(MVM_exitcode_threads, "Thread in unknown stage: %"MVM_PRSz"\n", this->body.stage);
}
this = next;
}
Expand Down
8 changes: 4 additions & 4 deletions src/gc/orchestrate.c
Expand Up @@ -55,7 +55,7 @@ static MVMuint32 signal_one_thread(MVMThreadContext *tc, MVMThreadContext *to_si
GCDEBUG_LOG(tc, MVM_GC_DEBUG_ORCHESTRATE, "Thread %d run %d : thread %d already stolen (it was a spawning child)\n", to_signal->thread_id);
return 0;
default:
MVM_panic(MVM_exitcode_gcorch, "invalid status %zu in GC orchestrate\n", MVM_load(&to_signal->gc_status));
MVM_panic(MVM_exitcode_gcorch, "invalid status %"MVM_PRSz" in GC orchestrate\n", MVM_load(&to_signal->gc_status));
return 0;
}
}
Expand Down Expand Up @@ -90,7 +90,7 @@ static MVMuint32 signal_all_but(MVMThreadContext *tc, MVMThread *t, MVMThread *t
/* will be cleaned up (removed from the lists) shortly */
break;
default:
MVM_panic(MVM_exitcode_gcorch, "Corrupted MVMThread or running threads list: invalid thread stage %zu", MVM_load(&t->body.stage));
MVM_panic(MVM_exitcode_gcorch, "Corrupted MVMThread or running threads list: invalid thread stage %"MVM_PRSz"", MVM_load(&t->body.stage));
}
} while (next && (t = next));
if (tail)
Expand Down Expand Up @@ -381,7 +381,7 @@ void MVM_gc_enter_from_allocator(MVMThreadContext *tc) {
if (!MVM_trycas(&tc->instance->threads, NULL, last_starter))
MVM_panic(MVM_exitcode_gcorch, "threads list corrupted\n");
if (MVM_load(&tc->instance->gc_finish) != 0)
MVM_panic(MVM_exitcode_gcorch, "Finish votes was %zu\n", MVM_load(&tc->instance->gc_finish));
MVM_panic(MVM_exitcode_gcorch, "Finish votes was %"MVM_PRSz"\n", MVM_load(&tc->instance->gc_finish));

/* gc_ack gets an extra so the final acknowledger
* can also free the STables. */
Expand All @@ -398,7 +398,7 @@ void MVM_gc_enter_from_allocator(MVMThreadContext *tc) {
/* Signal to the rest to start */
GCDEBUG_LOG(tc, MVM_GC_DEBUG_ORCHESTRATE, "Thread %d run %d : coordinator signalling start\n");
if (MVM_decr(&tc->instance->gc_start) != 1)
MVM_panic(MVM_exitcode_gcorch, "Start votes was %zu\n", MVM_load(&tc->instance->gc_start));
MVM_panic(MVM_exitcode_gcorch, "Start votes was %"MVM_PRSz"\n", MVM_load(&tc->instance->gc_start));

/* Start collecting. */
GCDEBUG_LOG(tc, MVM_GC_DEBUG_ORCHESTRATE, "Thread %d run %d : coordinator entering run_gc\n");
Expand Down
2 changes: 1 addition & 1 deletion src/jit/compile.c
Expand Up @@ -68,7 +68,7 @@ MVMJitCode * MVM_jit_compile_graph(MVMThreadContext *tc, MVMJitGraph *jg) {
MVM_platform_set_page_mode(memory, codesize, MVM_PAGE_READ|MVM_PAGE_EXEC);


MVM_jit_log(tc, "Bytecode size: %zu\n", codesize);
MVM_jit_log(tc, "Bytecode size: %"MVM_PRSz"\n", codesize);
/* Create code segment */
code = MVM_malloc(sizeof(MVMJitCode));
code->func_ptr = (MVMJitFunc)memory;
Expand Down
3 changes: 3 additions & 0 deletions src/platform/inttypes.h
@@ -1,5 +1,8 @@
#ifdef _MSC_VER
#include <msinttypes/inttypes.h>
/* Print size_t values. */
#define MVM_PRSz "Iu"
#else
#include <inttypes.h>
#define MVM_PRSz "zu" /* C99 */
#endif

0 comments on commit 684d8ae

Please sign in to comment.