This is an automated email from the ASF dual-hosted git repository. arodoni pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 10a400f10c66f0897f62c990a03013c1069f6110 Author: Philip Zeyliger <phi...@cloudera.com> AuthorDate: Wed Feb 27 10:40:41 2019 -0800 IMPALA-8250: Remove unused THROW_IF_ERROR_WITH_LOGGING, THROW_IF_EXC, and RETURN_IF_EXC. These macros have no references, so removing them. Found while investigating JNI warnings in IMPALA-8250. The following one-liner does a hap-hazard job of finding similar issues. There are relatively few left, and none of them seemed problematic. (for x in $(git grep '#define' be/src | grep -v be/src/kudu | grep -v be/src/gutil | grep -v be/src/thirdparty | grep -v be/src/transport/config.h | awk '{ print $2 }' | sed -e 's,(.*,,' | sort | uniq); do echo -n "$x "; git grep -e $x | wc -l; done) | awk '$2 == 1 { print }' Note that some of the macros were broken, because they called other JNI functions before calling ExceptionClear(). Change-Id: Ic63b498e0e4da57c7ec15cf1ad8070a6afdb3d96 Reviewed-on: http://gerrit.cloudera.org:8080/12658 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> --- be/src/util/jni-util.h | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/be/src/util/jni-util.h b/be/src/util/jni-util.h index 4b18f20..423548f 100644 --- a/be/src/util/jni-util.h +++ b/be/src/util/jni-util.h @@ -27,17 +27,6 @@ #include "gen-cpp/Frontend_types.h" #include "gutil/macros.h" -#define THROW_IF_ERROR_WITH_LOGGING(stmt, env, adaptor) \ - do { \ - const Status& _status = (stmt); \ - if (!_status.ok()) { \ - (adaptor)->WriteErrorLog(); \ - (adaptor)->WriteFileErrors(); \ - (env)->ThrowNew((adaptor)->impala_exc_cl(), _status.GetDetail().c_str()); \ - return; \ - } \ - } while (false) - #define THROW_IF_ERROR(stmt, env, impala_exc_cl) \ do { \ const Status& _status = (stmt); \ @@ -56,36 +45,6 @@ } \ } while (false) -#define THROW_IF_EXC(env, exc_class) \ - do { \ - jthrowable exc = (env)->ExceptionOccurred(); \ - if (exc != nullptr) { \ - DCHECK((throwable_to_string_id_) != nullptr); \ - jstring stack = (jstring) env->CallStaticObjectMethod(JniUtil::jni_util_class(), \ - (JniUtil::throwable_to_stack_trace_id()), exc); \ - jboolean is_copy; \ - const char* c_stack = \ - reinterpret_cast<const char*>((env)->GetStringUTFChars(stack, &is_copy)); \ - (env)->ExceptionClear(); \ - (env)->ThrowNew((exc_class), c_stack); \ - return; \ - } \ - } while (false) - -#define RETURN_IF_EXC(env) \ - do { \ - jthrowable exc = (env)->ExceptionOccurred(); \ - if (exc != nullptr) { \ - jstring stack = (jstring) env->CallStaticObjectMethod(JniUtil::jni_util_class(), \ - (JniUtil::throwable_to_stack_trace_id()), exc); \ - jboolean is_copy; \ - const char* c_stack = \ - reinterpret_cast<const char*>((env)->GetStringUTFChars(stack, &is_copy)); \ - VLOG(1) << string(c_stack); \ - return; \ - } \ - } while (false) - // If there's an exception in 'env', log the backtrace at FATAL level and abort the // process. This will generate a core dump if core dumps are enabled, so this should // generally only be called for internal errors where the coredump is useful for