Commit bca8b4b6 authored by Andrew Twyman's avatar Andrew Twyman Committed by GitHub

Merge pull request #309 from msjarrett/cppfixes-201704

C++ fixes for compiler issues
parents 554a3b2b c73950ed
The following is a partial list of individuals or corporations
who have identified their contributions to the djinni project.
The complete list of contributors can be identified through
Git history.
- Google Inc.
...@@ -156,11 +156,11 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha ...@@ -156,11 +156,11 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha
#define DJINNI_ASSERT_MSG(check, env, message) \ #define DJINNI_ASSERT_MSG(check, env, message) \
do { \ do { \
djinni::jniExceptionCheck(env); \ ::djinni::jniExceptionCheck(env); \
const bool check__res = bool(check); \ const bool check__res = bool(check); \
djinni::jniExceptionCheck(env); \ ::djinni::jniExceptionCheck(env); \
if (!check__res) { \ if (!check__res) { \
djinni::jniThrowAssertionError(env, __FILE__, __LINE__, message); \ ::djinni::jniThrowAssertionError(env, __FILE__, __LINE__, message); \
} \ } \
} while(false) } while(false)
#define DJINNI_ASSERT(check, env) DJINNI_ASSERT_MSG(check, env, #check) #define DJINNI_ASSERT(check, env) DJINNI_ASSERT_MSG(check, env, #check)
...@@ -340,7 +340,11 @@ template <class T> ...@@ -340,7 +340,11 @@ template <class T>
static const std::shared_ptr<T> & objectFromHandleAddress(jlong handle) { static const std::shared_ptr<T> & objectFromHandleAddress(jlong handle) {
assert(handle); assert(handle);
assert(handle > 4096); assert(handle > 4096);
const auto & ret = reinterpret_cast<const CppProxyHandle<T> *>(handle)->get(); // Below line segfaults gcc-4.8. Using a temporary variable hides the bug.
//const auto & ret = reinterpret_cast<const CppProxyHandle<T> *>(handle)->get();
const CppProxyHandle<T> *proxy_handle =
reinterpret_cast<const CppProxyHandle<T> *>(handle);
const auto & ret = proxy_handle->get();
assert(ret); assert(ret);
return ret; return ret;
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#pragma once #pragma once
#include <memory>
#include <functional> #include <functional>
#include <typeindex> #include <typeindex>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment