summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-02-03 19:34:47 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-02-03 19:34:47 +0400
commit5742f863a8db6d2dd118c21c6d8cfb11d0beb821 (patch)
treea91cba55a641333c7e06b7f9ba0c99a4115cd637 /darwin_stop_world.c
parentd012f92cbe38cb4151aca5a66ef4f49b9b48a349 (diff)
downloadbdwgc-5742f863a8db6d2dd118c21c6d8cfb11d0beb821.tar.gz
Prevent compiler warnings in GC_FindTopOfStack and GC_ports (Darwin)
* darwin_stop_world.c (GC_FindTopOfStack): Initialize "frame" local variable from "stack_start" unless done via PPC lwz/ld instruction (to prevent "uninitialized variable use" compiler warning; add assertion for "stack_start" value; add 'U' suffix to int constant to prevent comparison of signed and unsigned value. * os_dep.c (GC_ports): Explicitly initialize "reply" field to zero if THREADS (to suppress compiler warning on Darwin).
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 2255905d..cd72779b 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -53,15 +53,18 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start)
{
StackFrame *frame;
- if (stack_start == 0) {
# ifdef POWERPC
-# if CPP_WORDSZ == 32
- __asm__ __volatile__ ("lwz %0,0(r1)" : "=r" (frame));
-# else
- __asm__ __volatile__ ("ld %0,0(r1)" : "=r" (frame));
-# endif
-# endif
- } else {
+ if (stack_start == 0) {
+# if CPP_WORDSZ == 32
+ __asm__ __volatile__ ("lwz %0,0(r1)" : "=r" (frame));
+# else
+ __asm__ __volatile__ ("ld %0,0(r1)" : "=r" (frame));
+# endif
+ } else
+# else
+ GC_ASSERT(stack_start != 0); /* not implemented */
+# endif /* !POWERPC */
+ /* else */ {
frame = (StackFrame *)stack_start;
}
@@ -76,7 +79,7 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start)
/* we do these next two checks after going to the next frame
because the LR for the first stack frame in the loop
is not set up on purpose, so we shouldn't check it. */
- if ((frame->savedLR & ~0x3) == 0 || (frame->savedLR & ~0x3) == ~0x3)
+ if ((frame->savedLR & ~0x3) == 0 || (frame->savedLR & ~0x3) == ~0x3U)
break; /* if the next LR is bogus, stop */
}
# ifdef DEBUG_THREADS