comparison src/share/vm/prims/jniCheck.cpp @ 17937:78bbf4d43a14

8037816: Fix for 8036122 breaks build with Xcode5/clang 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas 8043164: Format warning in traceStream.hpp Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings Reviewed-by: kvn, coleenp, iveresov, twisti
author drchase
date Thu, 22 May 2014 15:52:41 -0400
parents 55fb97c4c58d
children 52b4284cb496 ce8f6bb717c9
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
98 #define JNI_ENTRY_CHECKED(result_type, header) \ 98 #define JNI_ENTRY_CHECKED(result_type, header) \
99 extern "C" { \ 99 extern "C" { \
100 result_type JNICALL header { \ 100 result_type JNICALL header { \
101 JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\ 101 JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
102 if (thr == NULL || !thr->is_Java_thread()) { \ 102 if (thr == NULL || !thr->is_Java_thread()) { \
103 tty->print_cr(fatal_using_jnienv_in_nonjava); \ 103 tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \
104 os::abort(true); \ 104 os::abort(true); \
105 } \ 105 } \
106 JNIEnv* xenv = thr->jni_environment(); \ 106 JNIEnv* xenv = thr->jni_environment(); \
107 if (env != xenv) { \ 107 if (env != xenv) { \
108 NativeReportJNIFatalError(thr, warn_wrong_jnienv); \ 108 NativeReportJNIFatalError(thr, warn_wrong_jnienv); \
182 182
183 static inline void 183 static inline void
184 functionEnter(JavaThread* thr) 184 functionEnter(JavaThread* thr)
185 { 185 {
186 if (thr->in_critical()) { 186 if (thr->in_critical()) {
187 tty->print_cr(warn_other_function_in_critical); 187 tty->print_cr("%s", warn_other_function_in_critical);
188 } 188 }
189 if (thr->has_pending_exception()) { 189 if (thr->has_pending_exception()) {
190 NativeReportJNIWarning(thr, "JNI call made with exception pending"); 190 NativeReportJNIWarning(thr, "JNI call made with exception pending");
191 } 191 }
192 } 192 }
193 193
194 static inline void 194 static inline void
195 functionEnterExceptionAllowed(JavaThread* thr) 195 functionEnterExceptionAllowed(JavaThread* thr)
196 { 196 {
197 if (thr->in_critical()) { 197 if (thr->in_critical()) {
198 tty->print_cr(warn_other_function_in_critical); 198 tty->print_cr("%s", warn_other_function_in_critical);
199 } 199 }
200 } 200 }
201 201
202 static inline void 202 static inline void
203 functionExit(JNIEnv *env) 203 functionExit(JNIEnv *env)