jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Encapsulate in do..while loop.
authorKeith Seitz <keiths@redhat.com>
Fri, 1 Sep 2006 17:58:22 +0000 (17:58 +0000)
committerKeith Seitz <kseitz@gcc.gnu.org>
Fri, 1 Sep 2006 17:58:22 +0000 (17:58 +0000)
        * jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Encapsulate in do..while loop.
        (THREAD_CHECK_VALID): Likewise.
        (THREAD_CHECK_IS_ALIVE): Likewise.
        (NULL_CHECK): Likewise.
        (ILLEGAL_ARGUMENT): Likewise.

From-SVN: r116636

libjava/ChangeLog
libjava/jvmti.cc

index b880c56ec07e38741482506d02fdcdebd403bbdd..b19398e24196b7eef3c47765d1b1606a8080a578 100644 (file)
@@ -1,3 +1,11 @@
+2006-09-01  Keith Seitz  <keiths@redhat.com>
+
+       * jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Encapsulate in do..while loop.
+       (THREAD_CHECK_VALID): Likewise.
+       (THREAD_CHECK_IS_ALIVE): Likewise.
+       (NULL_CHECK): Likewise.
+       (ILLEGAL_ARGUMENT): Likewise.
+
 2006-09-01  Keith Seitz  <keiths@redhat.com>
 
        * include/jvm.h (_Jv_JVMTI_Init): Declare.
index d2d8f52f5b5c87a7d5265613c843522c44419a78..37daa36dd4548f31cb113e2a453bb97f9a30e0c2 100644 (file)
@@ -56,25 +56,49 @@ static java::lang::Object *_envListLock = NULL;
 
 // Some commonly-used checks
 
-#define THREAD_DEFAULT_TO_CURRENT(jthread)                             \
-  if (jthread == NULL) jthread = java::lang::Thread::currentThread ();
+#define THREAD_DEFAULT_TO_CURRENT(jthread)             \
+  do                                                   \
+    {                                                  \
+      if (jthread == NULL)                             \
+       jthread = java::lang::Thread::currentThread (); \
+    }                                                  \
+  while (0)
 
 #define THREAD_CHECK_VALID(jthread)                                    \
-  if (!java::lang::Thread::class$.isAssignableFrom (&(jthread->class$))) \
-    return JVMTI_ERROR_INVALID_THREAD;
-
-#define THREAD_CHECK_IS_ALIVE(thread)                          \
-  if (!thread->isAlive ()) return JVMTI_ERROR_THREAD_NOT_ALIVE;
+  do                                                                   \
+    {                                                                  \
+      if (!java::lang::Thread::class$.isAssignableFrom (&(jthread->class$))) \
+       return JVMTI_ERROR_INVALID_THREAD;                              \
+    }                                                                  \
+  while (0)
+
+#define THREAD_CHECK_IS_ALIVE(thread)       \
+  do                                        \
+    {                                       \
+      if (!thread->isAlive ())              \
+       return JVMTI_ERROR_THREAD_NOT_ALIVE; \
+    }                                       \
+  while (0)
 
 // FIXME: if current phase is not set in Phases,
 // return JVMTI_ERROR_WRONG_PHASE
 #define REQUIRE_PHASE(Env, Phases)
 
-#define NULL_CHECK(Ptr)                                        \
-  if (Ptr == NULL) return JVMTI_ERROR_NULL_POINTER;
-
-#define ILLEGAL_ARGUMENT(Cond)                         \
-  if ((Cond)) return JVMTI_ERROR_ILLEGAL_ARGUMENT
+#define NULL_CHECK(Ptr)                                \
+  do                                           \
+    {                                          \
+      if (Ptr == NULL)                         \
+       return JVMTI_ERROR_NULL_POINTER;        \
+    }                                          \
+  while (0)
+
+#define ILLEGAL_ARGUMENT(Cond)                 \
+  do                                           \
+    {                                          \
+      if ((Cond))                              \
+       return JVMTI_ERROR_ILLEGAL_ARGUMENT;    \
+    }                                          \
+  while (0)
 
 static jvmtiError JNICALL
 _Jv_JVMTI_SuspendThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread)