diff options
author | Keith Seitz <keiths@redhat.com> | 2006-09-01 17:58:22 +0000 |
---|---|---|
committer | Keith Seitz <kseitz@gcc.gnu.org> | 2006-09-01 17:58:22 +0000 |
commit | a56913dd3781809746ff00a6f296acee9bfc5b9a (patch) | |
tree | e3857b048c301be120a93b7914ef2c7794daacc6 /libjava/jvmti.cc | |
parent | e6789bef7a31aac7b091379c1cd1df6cf383ac87 (diff) | |
download | gcc-a56913dd3781809746ff00a6f296acee9bfc5b9a.zip gcc-a56913dd3781809746ff00a6f296acee9bfc5b9a.tar.gz gcc-a56913dd3781809746ff00a6f296acee9bfc5b9a.tar.bz2 |
jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Encapsulate in do..while loop.
* 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
Diffstat (limited to 'libjava/jvmti.cc')
-rw-r--r-- | libjava/jvmti.cc | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index d2d8f52..37daa36 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -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) |