From 40cd91b7fe050b67de74d318fddbd743574c480d Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Mon, 31 Aug 2015 18:36:17 -0700 Subject: [PATCH] Fixed compile warning in rocksdbjava MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Fixed the following compile warning in rocksdbjava: java/rocksjni/comparatorjnicallback.cc:20:14: warning: unused variable ‘rs’ [-Wunused-variable] const jint rs = env->GetJavaVM(&m_jvm); ^ java/rocksjni/comparatorjnicallback.cc: In member function ‘JNIEnv* rocksdb::BaseComparatorJniCallback::getJniEnv() const’: java/rocksjni/comparatorjnicallback.cc:45:8: warning: unused variable ‘rs’ [-Wunused-variable] jint rs = m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); ^ java/rocksjni/loggerjnicallback.cc: In constructor ‘rocksdb::LoggerJniCallback::LoggerJniCallback(JNIEnv*, jobject)’: java/rocksjni/loggerjnicallback.cc:19:14: warning: unused variable ‘rs’ [-Wunused-variable] const jint rs = env->GetJavaVM(&m_jvm); ^ java/rocksjni/loggerjnicallback.cc: In member function ‘JNIEnv* rocksdb::LoggerJniCallback::getJniEnv() const’: java/rocksjni/loggerjnicallback.cc:33:8: warning: unused variable ‘rs’ [-Wunused-variable] jint rs = m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); ^ Test Plan: make rocksdbjava -j32 Reviewers: sdong, anthony, IslamAbdelRahman, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D45891 --- java/rocksjni/comparatorjnicallback.cc | 5 +++-- java/rocksjni/loggerjnicallback.cc | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/java/rocksjni/comparatorjnicallback.cc b/java/rocksjni/comparatorjnicallback.cc index fcae16c7c..a85b45085 100644 --- a/java/rocksjni/comparatorjnicallback.cc +++ b/java/rocksjni/comparatorjnicallback.cc @@ -17,7 +17,7 @@ BaseComparatorJniCallback::BaseComparatorJniCallback( mtx_findShortestSeparator(new port::Mutex(copt->use_adaptive_mutex)) { // Note: Comparator methods may be accessed by multiple threads, // so we ref the jvm not the env - const jint rs = env->GetJavaVM(&m_jvm); + const jint rs __attribute__((unused)) = env->GetJavaVM(&m_jvm); assert(rs == JNI_OK); // Note: we want to access the Java Comparator instance @@ -42,7 +42,8 @@ BaseComparatorJniCallback::BaseComparatorJniCallback( */ JNIEnv* BaseComparatorJniCallback::getJniEnv() const { JNIEnv *env; - jint rs = m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); + jint rs __attribute__((unused)) = + m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); assert(rs == JNI_OK); return env; } diff --git a/java/rocksjni/loggerjnicallback.cc b/java/rocksjni/loggerjnicallback.cc index 094049aad..46bef2868 100644 --- a/java/rocksjni/loggerjnicallback.cc +++ b/java/rocksjni/loggerjnicallback.cc @@ -30,7 +30,8 @@ LoggerJniCallback::LoggerJniCallback( */ JNIEnv* LoggerJniCallback::getJniEnv() const { JNIEnv *env; - jint rs = m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); + jint rs __attribute__((unused)) = + m_jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); assert(rs == JNI_OK); return env; }