8035640: JNU_CHECK_EXCEPTION should support c++ JNI syntax
authorpchelko
Tue, 25 Feb 2014 11:51:25 +0400
changeset 23013 1cf3dddf9ff7
parent 23012 b952c2b46e0d
child 23014 af8145529dd4
8035640: JNU_CHECK_EXCEPTION should support c++ JNI syntax Reviewed-by: anthony, alanb
jdk/src/share/native/common/jni_util.h
--- a/jdk/src/share/native/common/jni_util.h	Mon Feb 24 22:43:45 2014 -0800
+++ b/jdk/src/share/native/common/jni_util.h	Tue Feb 25 11:51:25 2014 +0400
@@ -297,6 +297,21 @@
         }                                       \
     } while (0)                                 \
 
+#ifdef __cplusplus
+#define JNU_CHECK_EXCEPTION(env)                \
+    do {                                        \
+        if ((env)->ExceptionCheck()) {          \
+            return;                             \
+        }                                       \
+    } while (0)                                 \
+
+#define JNU_CHECK_EXCEPTION_RETURN(env, y)      \
+    do {                                        \
+        if ((env)->ExceptionCheck()) {          \
+            return (y);                         \
+        }                                       \
+    } while (0)
+#else
 #define JNU_CHECK_EXCEPTION(env)                \
     do {                                        \
         if ((*env)->ExceptionCheck(env)) {      \
@@ -310,7 +325,7 @@
             return (y);                         \
         }                                       \
     } while (0)
-
+#endif /* __cplusplus */
 /************************************************************************
  * Debugging utilities
  */