diff options
author | Ian Lynagh <igloo@earth.li> | 2012-04-26 16:52:44 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-04-26 16:52:44 +0100 |
commit | 1dbe6d59b621ab9bd836241d633b3a8d99812cb3 (patch) | |
tree | 6482c2019a3a85f93c9b38c0e985d77f24388692 /rts | |
parent | 3e314cc2060734ade9b82d4da418c119b3a05b4c (diff) | |
download | haskell-1dbe6d59b621ab9bd836241d633b3a8d99812cb3.tar.gz |
Fix warnings on Win64
Mostly this meant getting pointer<->int conversions to use the right
sizes. lnat is now size_t, rather than unsigned long, as that seems a
better match for how it's used.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Capability.c | 4 | ||||
-rw-r--r-- | rts/Disassembler.c | 18 | ||||
-rw-r--r-- | rts/Linker.c | 32 | ||||
-rw-r--r-- | rts/Printer.c | 24 | ||||
-rw-r--r-- | rts/ProfHeap.c | 2 | ||||
-rw-r--r-- | rts/RtsFlags.c | 2 | ||||
-rw-r--r-- | rts/Stats.c | 19 | ||||
-rw-r--r-- | rts/Stats.h | 2 | ||||
-rw-r--r-- | rts/Task.c | 4 | ||||
-rw-r--r-- | rts/Ticky.c | 26 | ||||
-rw-r--r-- | rts/Trace.c | 26 | ||||
-rw-r--r-- | rts/hooks/MallocFail.c | 2 | ||||
-rw-r--r-- | rts/hooks/OutOfHeap.c | 2 | ||||
-rw-r--r-- | rts/hooks/StackOverflow.c | 2 | ||||
-rw-r--r-- | rts/sm/Sanity.c | 18 | ||||
-rw-r--r-- | rts/sm/Scav.c | 4 | ||||
-rw-r--r-- | rts/win32/IOManager.c | 2 | ||||
-rw-r--r-- | rts/win32/OSMem.c | 4 |
18 files changed, 105 insertions, 88 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index 7b1a110b2f..b3b7629e54 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -419,7 +419,7 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task) ASSERT(task->cap == cap); debugTrace(DEBUG_sched, "passing capability %d to %s %p", cap->no, task->incall->tso ? "bound task" : "worker", - (void *)task->id); + (void *)(size_t)task->id); ACQUIRE_LOCK(&task->lock); if (task->wakeup == rtsFalse) { task->wakeup = rtsTrue; @@ -887,7 +887,7 @@ shutdownCapability (Capability *cap USED_IF_THREADS, for (t = cap->spare_workers; t != NULL; t = t->next) { if (!osThreadIsAlive(t->id)) { debugTrace(DEBUG_sched, - "worker thread %p has died unexpectedly", (void *)t->id); + "worker thread %p has died unexpectedly", (void *)(size_t)t->id); cap->n_spare_workers--; if (!prev) { cap->spare_workers = t->next; diff --git a/rts/Disassembler.c b/rts/Disassembler.c index d043e1d012..4bb53c64ed 100644 --- a/rts/Disassembler.c +++ b/rts/Disassembler.c @@ -75,12 +75,12 @@ disInstr ( StgBCO *bco, int pc ) instrs[pc], (signed int)instrs[pc+1]); pc += 2; break; case bci_CCALL: - debugBelch("CCALL marshaller at 0x%lx\n", + debugBelch("CCALL marshaller at 0x%" FMT_HexSizeT "\n", literals[instrs[pc]] ); pc += 1; break; case bci_STKCHECK: { StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1; - debugBelch("STKCHECK %lu\n", (lnat)stk_words_reqd ); + debugBelch("STKCHECK %" FMT_SizeT "\n", (lnat)stk_words_reqd ); break; } case bci_PUSH_L: @@ -130,7 +130,7 @@ disInstr ( StgBCO *bco, int pc ) case bci_PUSH_UBX: debugBelch("PUSH_UBX "); for (i = 0; i < instrs[pc+1]; i++) - debugBelch("0x%lx ", literals[i + instrs[pc]] ); + debugBelch("0x%" FMT_HexSizeT " ", literals[i + instrs[pc]] ); debugBelch("\n"); pc += 2; break; case bci_PUSH_APPLY_N: @@ -199,29 +199,29 @@ disInstr ( StgBCO *bco, int pc ) case bci_TESTLT_I: { unsigned int discr = BCO_NEXT; int failto = BCO_GET_LARGE_ARG; - debugBelch("TESTLT_I %ld, fail to %d\n", literals[discr], failto); + debugBelch("TESTLT_I %" FMT_Int ", fail to %d\n", literals[discr], failto); break; } case bci_TESTEQ_I: - debugBelch("TESTEQ_I %ld, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_I %" FMT_Int ", fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTLT_F: - debugBelch("TESTLT_F %ld, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTLT_F %" FMT_Int ", fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTEQ_F: - debugBelch("TESTEQ_F %ld, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_F %" FMT_Int ", fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTLT_D: - debugBelch("TESTLT_D %ld, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTLT_D %" FMT_Int ", fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTEQ_D: - debugBelch("TESTEQ_D %ld, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_D %" FMT_Int ", fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; diff --git a/rts/Linker.c b/rts/Linker.c index c983403611..6085f9ce14 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -2428,6 +2428,7 @@ addProddableBlock ( ObjectCode* oc, void* start, int size ) oc->proddables = pb; } +#if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) static void checkProddableBlock (ObjectCode *oc, void *addr ) { @@ -2444,6 +2445,7 @@ checkProddableBlock (ObjectCode *oc, void *addr ) } barf("checkProddableBlock: invalid fixup in runtime linker"); } +#endif /* ----------------------------------------------------------------------------- * Section management. @@ -2459,8 +2461,8 @@ addSection ( ObjectCode* oc, SectionKind kind, s->next = oc->sections; oc->sections = s; - IF_DEBUG(linker, debugBelch("addSection: %p-%p (size %ld), kind %d\n", - start, ((char*)end)-1, (long)end - (long)start + 1, kind )); + IF_DEBUG(linker, debugBelch("addSection: %p-%p (size %" FMT_Int "), kind %d\n", + start, ((char*)end)-1, (StgInt)end - (StgInt)start + 1, kind )); } @@ -2473,6 +2475,7 @@ addSection ( ObjectCode* oc, SectionKind kind, */ #if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(arm_HOST_ARCH) +#if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) /* ocAllocateSymbolExtras @@ -2551,6 +2554,7 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) return 1; } +#endif #endif // defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(arm_HOST_ARCH) #if defined(arm_HOST_ARCH) @@ -2567,6 +2571,7 @@ ocFlushInstructionCache( ObjectCode *oc ) #endif #if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) +#if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) static SymbolExtra* makeSymbolExtra( ObjectCode* oc, unsigned long symbolNumber, @@ -2604,6 +2609,7 @@ static SymbolExtra* makeSymbolExtra( ObjectCode* oc, return extra; } +#endif #endif // defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) #ifdef arm_HOST_ARCH @@ -2887,6 +2893,7 @@ printName ( UChar* name, UChar* strtab ) } +#if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) static void copyName ( UChar* name, UChar* strtab, UChar* dst, int dstSize ) { @@ -2905,6 +2912,7 @@ copyName ( UChar* name, UChar* strtab, UChar* dst, int dstSize ) dst[i] = 0; } } +#endif static UChar * @@ -2960,6 +2968,7 @@ cstring_from_section_name (UChar* name, UChar* strtab) } } +#if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) /* Just compares the short names (first 8 chars) */ static COFF_section * findPEi386SectionCalled ( ObjectCode* oc, UChar* name ) @@ -2988,7 +2997,7 @@ findPEi386SectionCalled ( ObjectCode* oc, UChar* name ) return NULL; } - +#endif static void zapTrailingAtSign ( UChar* sym ) @@ -3099,9 +3108,9 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, i=1); if (i == 0) return 1; - debugBelch( "sectab offset = %d\n", ((UChar*)sectab) - ((UChar*)hdr) ); - debugBelch( "symtab offset = %d\n", ((UChar*)symtab) - ((UChar*)hdr) ); - debugBelch( "strtab offset = %d\n", ((UChar*)strtab) - ((UChar*)hdr) ); + debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) ); + debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) ); + debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) ); debugBelch("\n" ); debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) ); @@ -3451,8 +3460,13 @@ ocGetNames_PEi386 ( ObjectCode* oc ) static int -ocResolve_PEi386 ( ObjectCode* oc ) +ocResolve_PEi386 ( ObjectCode* oc +#if !defined(i386_HOST_ARCH) + STG_UNUSED +#endif + ) { +#if defined(i386_HOST_ARCH) COFF_header* hdr; COFF_section* sectab; COFF_symbol* symtab; @@ -3535,7 +3549,6 @@ ocResolve_PEi386 ( ObjectCode* oc ) j = 0; } - for (; j < noRelocs; j++) { COFF_symbol* sym; COFF_reloc* reltab_j @@ -3627,6 +3640,9 @@ ocResolve_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, debugBelch("completed %" PATH_FMT, oc->fileName)); return 1; +#else + barf("ocResolve_PEi386: Not supported on this arch"); +#endif } #endif /* defined(OBJFORMAT_PEi386) */ diff --git a/rts/Printer.c b/rts/Printer.c index 688ed7b664..a7ce367833 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -147,7 +147,7 @@ printClosure( StgClosure *obj ) case FUN_1_0: case FUN_0_1: case FUN_1_1: case FUN_0_2: case FUN_2_0: case FUN_STATIC: - debugBelch("FUN/%d(",itbl_to_fun_itbl(info)->f.arity); + debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity); printPtr((StgPtr)obj->header.info); #ifdef PROFILING debugBelch(", %s", obj->header.prof.ccs->cc->label); @@ -199,7 +199,7 @@ printClosure( StgClosure *obj ) { StgPAP* pap = (StgPAP*)obj; StgWord i; - debugBelch("PAP/%d(",pap->arity); + debugBelch("PAP/%d(",(int)pap->arity); printPtr((StgPtr)pap->fun); for (i = 0; i < pap->n_args; ++i) { debugBelch(", "); @@ -299,21 +299,21 @@ printClosure( StgClosure *obj ) StgWord i; debugBelch("ARR_WORDS(\""); for (i=0; i<arr_words_words((StgArrWords *)obj); i++) - debugBelch("%lu", (lnat)((StgArrWords *)obj)->payload[i]); + debugBelch("%" FMT_SizeT, (lnat)((StgArrWords *)obj)->payload[i]); debugBelch("\")\n"); break; } case MUT_ARR_PTRS_CLEAN: - debugBelch("MUT_ARR_PTRS_CLEAN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); + debugBelch("MUT_ARR_PTRS_CLEAN(size=%" FMT_SizeT ")\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); break; case MUT_ARR_PTRS_DIRTY: - debugBelch("MUT_ARR_PTRS_DIRTY(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); + debugBelch("MUT_ARR_PTRS_DIRTY(size=%" FMT_SizeT ")\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); break; case MUT_ARR_PTRS_FROZEN: - debugBelch("MUT_ARR_PTRS_FROZEN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); + debugBelch("MUT_ARR_PTRS_FROZEN(size=%" FMT_SizeT ")\n", (lnat)((StgMutArrPtrs *)obj)->ptrs); break; case MVAR_CLEAN: @@ -366,7 +366,7 @@ printClosure( StgClosure *obj ) default: //barf("printClosure %d",get_itbl(obj)->type); debugBelch("*** printClosure: unknown type %d ****\n", - get_itbl(obj)->type ); + (int)get_itbl(obj)->type ); barf("printClosure %d",get_itbl(obj)->type); return; } @@ -426,7 +426,7 @@ printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, nat size ) printPtr((P_)payload[i]); debugBelch("\n"); } else { - debugBelch("Word# %lu\n", (lnat)payload[i]); + debugBelch("Word# %" FMT_SizeT "\n", (lnat)payload[i]); } } } @@ -442,12 +442,12 @@ printLargeBitmap( StgPtr spBottom, StgPtr payload, StgLargeBitmap* large_bitmap, StgWord bitmap = large_bitmap->bitmap[bmp]; j = 0; for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) { - debugBelch(" stk[%lu] (%p) = ", (lnat)(spBottom-(payload+i)), payload+i); + debugBelch(" stk[%" FMT_SizeT "] (%p) = ", (lnat)(spBottom-(payload+i)), payload+i); if ((bitmap & 1) == 0) { printPtr((P_)payload[i]); debugBelch("\n"); } else { - debugBelch("Word# %lu\n", (lnat)payload[i]); + debugBelch("Word# %" FMT_SizeT "\n", (lnat)payload[i]); } } } @@ -532,7 +532,7 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) ret_fun = (StgRetFun *)sp; fun_info = get_fun_itbl(ret_fun->fun); - debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, fun_info->f.fun_type); + debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, (int)fun_info->f.fun_type); switch (fun_info->f.fun_type) { case ARG_GEN: printSmallBitmap(spBottom, sp+2, @@ -554,7 +554,7 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) } default: - debugBelch("unknown object %d\n", info->type); + debugBelch("unknown object %d\n", (int)info->type); barf("printStackChunk"); } } diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index bd2f140e24..c7048a5cf6 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -821,7 +821,7 @@ dumpCensus( Census *census ) } #endif - fprintf(hp_file, "\t%lu\n", (unsigned long)count * sizeof(W_)); + fprintf(hp_file, "\t%" FMT_SizeT "\n", (lnat)count * sizeof(W_)); } printSample(rtsFalse, census->time); diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 320a1b2350..4e156e63d0 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1542,7 +1542,7 @@ decodeSize(const char *flag, nat offset, StgWord64 min, StgWord64 max) if (m < 0 || val < min || val > max) { // printf doesn't like 64-bit format specs on Windows // apparently, so fall back to unsigned long. - errorBelch("error in RTS option %s: size outside allowed range (%lu - %lu)", flag, (lnat)min, (lnat)max); + errorBelch("error in RTS option %s: size outside allowed range (%" FMT_SizeT " - %" FMT_SizeT ")", flag, (lnat)min, (lnat)max); stg_exit(EXIT_FAILURE); } diff --git a/rts/Stats.c b/rts/Stats.c index cebb75343f..3b709bc9e8 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -383,10 +383,10 @@ stat_endGC (Capability *cap, gc_thread *gct, if (RtsFlags.GcFlags.giveStats == VERBOSE_GC_STATS) { nat faults = getPageFaults(); - statsPrintf("%9ld %9ld %9ld", + statsPrintf("%9" FMT_SizeT " %9" FMT_SizeT " %9" FMT_SizeT, alloc*sizeof(W_), copied*sizeof(W_), live*sizeof(W_)); - statsPrintf(" %5.2f %5.2f %7.2f %7.2f %4ld %4ld (Gen: %2d)\n", + statsPrintf(" %5.2f %5.2f %7.2f %7.2f %4" FMT_SizeT " %4" FMT_SizeT " (Gen: %2d)\n", TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed), TimeToSecondsDbl(cpu), @@ -627,7 +627,7 @@ stat_exit(int alloc) if (tot_elapsed == 0.0) tot_elapsed = 1; if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) { - statsPrintf("%9ld %9.9s %9.9s", (lnat)alloc*sizeof(W_), "", ""); + statsPrintf("%9" FMT_SizeT " %9.9s %9.9s", (lnat)alloc*sizeof(W_), "", ""); statsPrintf(" %5.2f %5.2f\n\n", 0.0, 0.0); } @@ -666,14 +666,14 @@ stat_exit(int alloc) if ( residency_samples > 0 ) { showStgWord64(max_residency*sizeof(W_), temp, rtsTrue/*commas*/); - statsPrintf("%16s bytes maximum residency (%ld sample(s))\n", + statsPrintf("%16s bytes maximum residency (%" FMT_SizeT " sample(s))\n", temp, residency_samples); } showStgWord64(max_slop*sizeof(W_), temp, rtsTrue/*commas*/); statsPrintf("%16s bytes maximum slop\n", temp); - statsPrintf("%16ld MB total memory in use (%ld MB lost due to fragmentation)\n\n", + statsPrintf("%16" FMT_SizeT " MB total memory in use (%" FMT_SizeT " MB lost due to fragmentation)\n\n", peak_mblocks_allocated * MBLOCK_SIZE_W / (1024 * 1024 / sizeof(W_)), (peak_mblocks_allocated * BLOCKS_PER_MBLOCK * BLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_))); @@ -721,7 +721,7 @@ stat_exit(int alloc) sparks.fizzled += capabilities[i].spark_stats.fizzled; } - statsPrintf(" SPARKS: %ld (%ld converted, %ld overflowed, %ld dud, %ld GC'd, %ld fizzled)\n\n", + statsPrintf(" SPARKS: %" FMT_Word " (%" FMT_Word " converted, %" FMT_Word " overflowed, %" FMT_Word " dud, %" FMT_Word " GC'd, %" FMT_Word " fizzled)\n\n", sparks.created + sparks.dud + sparks.overflowed, sparks.converted, sparks.overflowed, sparks.dud, sparks.gcd, sparks.fizzled); @@ -896,17 +896,18 @@ statDescribeGens(void) gen_blocks += gcThreadLiveBlocks(i,g); } - debugBelch("%5d %7ld %9d", g, (lnat)gen->max_blocks, mut); + debugBelch("%5d %7" FMT_SizeT " %9d", g, (lnat)gen->max_blocks, mut); gen_slop = gen_blocks * BLOCK_SIZE_W - gen_live; - debugBelch("%8ld %8d %8ld %8ld\n", gen_blocks, lge, + debugBelch("%8" FMT_SizeT " %8d %8" FMT_SizeT " %8" FMT_SizeT "\n", gen_blocks, lge, gen_live*sizeof(W_), gen_slop*sizeof(W_)); tot_live += gen_live; tot_slop += gen_slop; } debugBelch("----------------------------------------------------------\n"); - debugBelch("%41s%8ld %8ld\n","",tot_live*sizeof(W_),tot_slop*sizeof(W_)); + debugBelch("%41s%8" FMT_SizeT " %8" FMT_SizeT "\n", + "",tot_live*sizeof(W_),tot_slop*sizeof(W_)); debugBelch("----------------------------------------------------------\n"); debugBelch("\n"); } diff --git a/rts/Stats.h b/rts/Stats.h index baabd26553..f576e1f91f 100644 --- a/rts/Stats.h +++ b/rts/Stats.h @@ -64,7 +64,7 @@ Time stat_getElapsedTime(void); /* Only exported for Papi.c */ void statsPrintf( char *s, ... ) - GNUC3_ATTRIBUTE(format (printf, 1, 2)); + GNUC3_ATTRIBUTE(format (gnu_printf, 1, 2)); #include "EndPrivate.h" diff --git a/rts/Task.c b/rts/Task.c index f4a37bf6ff..125000b914 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -320,7 +320,7 @@ discardTasksExcept (Task *keep) for (task = all_tasks; task != NULL; task=next) { next = task->all_next; if (task != keep) { - debugTrace(DEBUG_sched, "discarding task %ld", (long)TASK_ID(task)); + debugTrace(DEBUG_sched, "discarding task %" FMT_SizeT "", (size_t)TASK_ID(task)); freeTask(task); } } @@ -393,7 +393,7 @@ workerTaskStop (Task *task) static void *taskId(Task *task) { #ifdef THREADED_RTS - return (void *)task->id; + return (void *)(size_t)task->id; #else return (void *)task; #endif diff --git a/rts/Ticky.c b/rts/Ticky.c index 140a705eae..af33805d69 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -217,7 +217,7 @@ PrintTickyInfo(void) fprintf(tf,"%7ld (%5.1f%%) normal indirections\n", tot_ind_enters, PC(INTAVG(tot_ind_enters,tot_enters))); - fprintf(tf,"%7ld (%5.1f%%) permanent indirections\n", + fprintf(tf,"%7" FMT_Int " (%5.1f%%) permanent indirections\n", ENT_PERM_IND_ctr, PC(INTAVG(ENT_PERM_IND_ctr,tot_enters))); @@ -228,13 +228,13 @@ PrintTickyInfo(void) tot_tail_calls, tot_known_calls, PC(INTAVG(tot_known_calls,tot_tail_calls))); - fprintf(tf, "\nSLOW APPLICATIONS: %ld evaluated, %ld unevaluated\n", + fprintf(tf, "\nSLOW APPLICATIONS: %" FMT_Int " evaluated, %" FMT_Int " unevaluated\n", SLOW_CALL_ctr, SLOW_CALL_UNEVALD_ctr); fprintf(tf, "\n"); fprintf(tf, " Too few args Correct args Too many args\n"); - fprintf(tf, " FUN %8ld %8ld %8ld\n", + fprintf(tf, " FUN %8" FMT_Int " %8" FMT_Int " %8" FMT_Int "\n", SLOW_CALL_FUN_TOO_FEW_ctr, SLOW_CALL_FUN_CORRECT_ctr, SLOW_CALL_FUN_TOO_MANY_ctr); - fprintf(tf, " PAP %8ld %8ld %8ld\n", + fprintf(tf, " PAP %8" FMT_Int " %8" FMT_Int " %8" FMT_Int "\n", SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr); fprintf(tf, "\n"); @@ -261,27 +261,27 @@ PrintTickyInfo(void) fprintf(tf, "\n"); */ - fprintf(tf,"\nUPDATE FRAMES: %ld (%ld omitted from thunks)", + fprintf(tf,"\nUPDATE FRAMES: %" FMT_Int " (%" FMT_Int " omitted from thunks)", UPDF_PUSHED_ctr, UPDF_OMITTED_ctr); - fprintf(tf,"\nCATCH FRAMES: %ld", CATCHF_PUSHED_ctr); + fprintf(tf,"\nCATCH FRAMES: %" FMT_Int "", CATCHF_PUSHED_ctr); if (UPDF_RCC_PUSHED_ctr != 0) - fprintf(tf,"%7ld restore cost centre frames (%ld omitted)\n", + fprintf(tf,"%7" FMT_Int " restore cost centre frames (%" FMT_Int " omitted)\n", UPDF_RCC_PUSHED_ctr, UPDF_RCC_OMITTED_ctr); fprintf(tf,"\nUPDATES: %ld\n", tot_updates); - fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t [%ld in place, %ld allocated new space]\n", + fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", con_updates, PC(INTAVG(con_updates,tot_updates)), UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr); - fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t [%ld in place, %ld allocated new space]\n", + fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", pap_updates, PC(INTAVG(pap_updates,tot_updates)), UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr); - fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n", + fprintf(tf,"%7" FMT_Int " (%5.1f%%) updates by squeezing\n", UPD_SQUEEZED_ctr, PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates))); @@ -317,10 +317,10 @@ PrintTickyInfo(void) */ #define PR_CTR(ctr) \ - do { fprintf(tf,"%7ld " #ctr "\n", ctr); } while(0) + do { fprintf(tf,"%7" FMT_Int " " #ctr "\n", ctr); } while(0) /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */ #define COND_PR_CTR(ctr,b,msg) \ - if (b) { fprintf(tf,"%7ld " #ctr "\n", ctr); } else { fprintf(tf,"%7ld " msg "\n", ctr); } + if (b) { fprintf(tf,"%7" FMT_Int " " #ctr "\n", ctr); } else { fprintf(tf,"%7" FMT_Int " " msg "\n", ctr); } #define PR_HST(hst,i) \ do { fprintf(tf,"%7ld " #hst "_" #i "\n", hst[i]); } while(0) @@ -582,7 +582,7 @@ printRegisteredCounterInfo (FILE *tf) /* Function name at the end so it doesn't mess up the tabulation */ for (p = ticky_entry_ctrs; p != NULL; p = p->link) { - fprintf(tf, "%11ld%11ld %6lu%6lu %-11s%-30s", + fprintf(tf, "%11" FMT_Int "%11" FMT_Int " %6lu%6lu %-11s%-30s", p->entry_count, p->allocs, (unsigned long)p->arity, diff --git a/rts/Trace.c b/rts/Trace.c index e5a4beba61..9fa8eb177b 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -203,37 +203,37 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag, tracePreface(); switch (tag) { case EVENT_CREATE_THREAD: // (cap, thread) - debugBelch("cap %d: created thread %lu\n", + debugBelch("cap %d: created thread %" FMT_SizeT "\n", cap->no, (lnat)tso->id); break; case EVENT_RUN_THREAD: // (cap, thread) - debugBelch("cap %d: running thread %lu (%s)\n", + debugBelch("cap %d: running thread %" FMT_SizeT " (%s)\n", cap->no, (lnat)tso->id, what_next_strs[tso->what_next]); break; case EVENT_THREAD_RUNNABLE: // (cap, thread) - debugBelch("cap %d: thread %lu appended to run queue\n", + debugBelch("cap %d: thread %" FMT_SizeT " appended to run queue\n", cap->no, (lnat)tso->id); break; case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap) - debugBelch("cap %d: thread %lu migrating to cap %d\n", + debugBelch("cap %d: thread %" FMT_SizeT " migrating to cap %d\n", cap->no, (lnat)tso->id, (int)info1); break; case EVENT_THREAD_WAKEUP: // (cap, thread, info1_cap) - debugBelch("cap %d: waking up thread %lu on cap %d\n", + debugBelch("cap %d: waking up thread %" FMT_SizeT " on cap %d\n", cap->no, (lnat)tso->id, (int)info1); break; case EVENT_STOP_THREAD: // (cap, thread, status) if (info1 == 6 + BlockedOnBlackHole) { - debugBelch("cap %d: thread %lu stopped (blocked on black hole owned by thread %lu)\n", + debugBelch("cap %d: thread %" FMT_SizeT " stopped (blocked on black hole owned by thread %lu)\n", cap->no, (lnat)tso->id, (long)info2); } else { - debugBelch("cap %d: thread %lu stopped (%s)\n", + debugBelch("cap %d: thread %" FMT_SizeT " stopped (%s)\n", cap->no, (lnat)tso->id, thread_stop_reasons[info1]); } break; default: - debugBelch("cap %d: thread %lu: event %d\n\n", + debugBelch("cap %d: thread %" FMT_SizeT ": event %d\n\n", cap->no, (lnat)tso->id, tag); break; } @@ -423,17 +423,17 @@ void traceCapsetEvent (EventTypeNum tag, tracePreface(); switch (tag) { case EVENT_CAPSET_CREATE: // (capset, capset_type) - debugBelch("created capset %lu of type %d\n", (lnat)capset, (int)info); + debugBelch("created capset %" FMT_SizeT " of type %d\n", (lnat)capset, (int)info); break; case EVENT_CAPSET_DELETE: // (capset) - debugBelch("deleted capset %lu\n", (lnat)capset); + debugBelch("deleted capset %" FMT_SizeT "\n", (lnat)capset); break; case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno) - debugBelch("assigned cap %lu to capset %lu\n", + debugBelch("assigned cap %" FMT_SizeT " to capset %" FMT_SizeT "\n", (lnat)info, (lnat)capset); break; case EVENT_CAPSET_REMOVE_CAP: // (capset, capno) - debugBelch("removed cap %lu from capset %lu\n", + debugBelch("removed cap %" FMT_SizeT " from capset %" FMT_SizeT "\n", (lnat)info, (lnat)capset); break; } @@ -670,7 +670,7 @@ void traceThreadLabel_(Capability *cap, if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { ACQUIRE_LOCK(&trace_utx); tracePreface(); - debugBelch("cap %d: thread %lu has label %s\n", + debugBelch("cap %d: thread %" FMT_SizeT " has label %s\n", cap->no, (lnat)tso->id, label); RELEASE_LOCK(&trace_utx); } else diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 41c0d2a855..e298c2ee77 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -12,6 +12,6 @@ void MallocFailHook (lnat request_size /* in bytes */, char *msg) { - fprintf(stderr, "malloc: failed on request for %lu bytes; message: %s\n", request_size, msg); + fprintf(stderr, "malloc: failed on request for %" FMT_SizeT " bytes; message: %s\n", request_size, msg); } diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c index 30c492dd16..5ed5ed9b96 100644 --- a/rts/hooks/OutOfHeap.c +++ b/rts/hooks/OutOfHeap.c @@ -15,7 +15,7 @@ OutOfHeapHook (lnat request_size, lnat heap_size) /* both sizes in bytes */ (void)request_size; /* keep gcc -Wall happy */ if (heap_size > 0) { - errorBelch("Heap exhausted;\nCurrent maximum heap size is %lu bytes (%lu MB);\nuse `+RTS -M<size>' to increase it.", + errorBelch("Heap exhausted;\nCurrent maximum heap size is %" FMT_SizeT " bytes (%" FMT_SizeT " MB);\nuse `+RTS -M<size>' to increase it.", heap_size, heap_size / (1024*1024)); } else { errorBelch("out of memory"); diff --git a/rts/hooks/StackOverflow.c b/rts/hooks/StackOverflow.c index 4313702a84..fe8a059b7f 100644 --- a/rts/hooks/StackOverflow.c +++ b/rts/hooks/StackOverflow.c @@ -12,6 +12,6 @@ void StackOverflowHook (lnat stack_size) /* in bytes */ { - fprintf(stderr, "Stack space overflow: current size %ld bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size); + fprintf(stderr, "Stack space overflow: current size %" FMT_SizeT " bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size); } diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 78ecc96e0a..9a22dcb328 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -835,7 +835,7 @@ void findSlop(bdescr *bd) for (; bd != NULL; bd = bd->link) { slop = (bd->blocks * BLOCK_SIZE_W) - (bd->free - bd->start); if (slop > (1024/sizeof(W_))) { - debugBelch("block at %p (bdescr %p) has %ldKB slop\n", + debugBelch("block at %p (bdescr %p) has %" FMT_SizeT "KB slop\n", bd->start, bd, slop / (1024/sizeof(W_))); } } @@ -918,23 +918,23 @@ memInventory (rtsBool show) debugBelch("Memory inventory:\n"); } for (g = 0; g < RtsFlags.GcFlags.generations; g++) { - debugBelch(" gen %d blocks : %5lu blocks (%lu MB)\n", g, + debugBelch(" gen %d blocks : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", g, gen_blocks[g], MB(gen_blocks[g])); } - debugBelch(" nursery : %5lu blocks (%lu MB)\n", + debugBelch(" nursery : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", nursery_blocks, MB(nursery_blocks)); - debugBelch(" retainer : %5lu blocks (%lu MB)\n", + debugBelch(" retainer : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", retainer_blocks, MB(retainer_blocks)); - debugBelch(" arena blocks : %5lu blocks (%lu MB)\n", + debugBelch(" arena blocks : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", arena_blocks, MB(arena_blocks)); - debugBelch(" exec : %5lu blocks (%lu MB)\n", + debugBelch(" exec : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", exec_blocks, MB(exec_blocks)); - debugBelch(" free : %5lu blocks (%lu MB)\n", + debugBelch(" free : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", free_blocks, MB(free_blocks)); - debugBelch(" total : %5lu blocks (%lu MB)\n", + debugBelch(" total : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", live_blocks + free_blocks, MB(live_blocks+free_blocks)); if (leak) { - debugBelch("\n in system : %5lu blocks (%lu MB)\n", + debugBelch("\n in system : %5" FMT_SizeT " blocks (%" FMT_SizeT " MB)\n", mblocks_allocated * BLOCKS_PER_MBLOCK, mblocks_allocated); } } diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index d77734fd05..881d4270c9 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -322,8 +322,8 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap) // // If the SRT entry hasn't got bit 0 set, the SRT entry points to a // closure that's fixed at link-time, and no extra magic is required. - if ( (unsigned long)(*srt) & 0x1 ) { - evacuate( (StgClosure**) ((unsigned long) (*srt) & ~0x1)); + if ( (lnat)(*srt) & 0x1 ) { + evacuate( (StgClosure**) ((lnat) (*srt) & ~0x1)); } else { evacuate(p); } diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c index c9a759fffb..13bdb6ff51 100644 --- a/rts/win32/IOManager.c +++ b/rts/win32/IOManager.c @@ -143,7 +143,7 @@ IOWorkerProc(PVOID param) * i.e., for all others, an error is raised. */ HANDLE h = (HANDLE)GetStdHandle(STD_INPUT_HANDLE); - if ( _get_osfhandle(work->workData.ioData.fd) == (long)h ) { + if ( _get_osfhandle(work->workData.ioData.fd) == (intptr_t)h ) { if (rts_waitConsoleHandlerCompletion()) { /* If the Scheduler has set work->abandonOp, the Haskell thread has * been thrown an exception (=> the worker must abandon this request.) diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index ad897e531b..e0f38d36a0 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -124,7 +124,7 @@ findFreeBlocks(nat n) { /* TODO: Don't just take first block, find smallest sufficient block */ for( ; it!=0 && it->size<required_size; prev=it, it=it->next ) {} if(it!=0) { - if( (((unsigned long)it->base) & MBLOCK_MASK) == 0) { /* MBlock aligned */ + if( (((lnat)it->base) & MBLOCK_MASK) == 0) { /* MBlock aligned */ ret = (void*)it->base; if(it->size==required_size) { prev->next=it->next; @@ -137,7 +137,7 @@ findFreeBlocks(nat n) { char* need_base; block_rec* next; int new_size; - need_base = (char*)(((unsigned long)it->base) & ((unsigned long)~MBLOCK_MASK)) + MBLOCK_SIZE; + need_base = (char*)(((lnat)it->base) & ((lnat)~MBLOCK_MASK)) + MBLOCK_SIZE; next = (block_rec*)stgMallocBytes( sizeof(block_rec) , "getMBlocks: findFreeBlocks: splitting"); |