]> granicus.if.org Git - gc/commitdiff
Prevent compiler warnings in GC_FindTopOfStack and GC_ports (Darwin)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 3 Feb 2012 15:34:47 +0000 (19:34 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 3 Feb 2012 15:34:47 +0000 (19:34 +0400)
* 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).

darwin_stop_world.c
os_dep.c

index 2255905d70f421b7ee992e2ccabe2ab5afdfc23f..cd72779b44a0bff9c8fe6ff1e9373e4a9c3734a5 100644 (file)
@@ -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
index c4058416d5cdf64199e8294071fe2d5d8386bbfe..03a0ca8dccdbebb2ff147defa9096111198115a2 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3900,6 +3900,9 @@ STATIC struct {
     (void (*)(void))catch_exception_raise_state,
     (void (*)(void))catch_exception_raise_state_identity
   },
+# ifdef THREADS
+    0, /* for 'exception' */
+# endif
   0
 };