From 7c5a98f5723b0bc0571c455f60a5b2006fa3c9cd Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 1 Aug 2012 09:50:01 +0400 Subject: Resolve GCC warning in setjmp_t.c * tools/setjmp_t.c (nested_sp): Change 'sp' local variable type from int to word (to avoid 'cast from pointer to int' compiler warning). * tools/setjmp_t.c (main): Cast pointers to unsigned long via word type; cast WORDSZ value passed to printf() to match format type specifier (to avoid compiler warnings). --- tools/setjmp_t.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c index b3bc2a29..801e6a58 100644 --- a/tools/setjmp_t.c +++ b/tools/setjmp_t.c @@ -62,8 +62,8 @@ struct { int * nested_sp(void) { - volatile int sp; - sp = (int)&sp; + volatile word sp; + sp = (word)(&sp); return (int *)sp; } @@ -79,18 +79,18 @@ int main(void) if ((word)nested_sp() < (word)(&dummy)) { printf("Stack appears to grow down, which is the default.\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", - ((unsigned long)(&dummy) + ps) & ~(ps-1)); + ((unsigned long)(word)(&dummy) + ps) & ~(ps-1)); } else { printf("Stack appears to grow up.\n"); printf("Define STACK_GROWS_UP in gc_private.h\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", - ((unsigned long)(&dummy) + ps) & ~(ps-1)); + ((unsigned long)(word)(&dummy) + ps) & ~(ps-1)); } printf("Note that this may vary between machines of ostensibly\n"); printf("the same architecture (e.g. Sun 3/50s and 3/80s).\n"); printf("On many machines the value is not fixed.\n"); printf("A good guess for ALIGNMENT on this machine is %ld.\n", - (unsigned long)(&(a.a_b))-(unsigned long)(&a)); + (unsigned long)((word)(&(a.a_b)) - (word)(&a))); printf("The following is a very dubious test of one root marking" " strategy.\n"); @@ -116,7 +116,7 @@ int main(void) if (y == 1) longjmp(b,1); printf("Some GC internal configuration stuff: \n"); printf("\tWORDSZ = %lu, ALIGNMENT = %d, GC_GRANULE_BYTES = %d\n", - WORDSZ, ALIGNMENT, GC_GRANULE_BYTES); + (unsigned long)WORDSZ, ALIGNMENT, GC_GRANULE_BYTES); printf("\tUsing one mark "); # if defined(USE_MARK_BYTES) printf("byte"); -- cgit v1.2.1