Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
191940c8
Commit
191940c8
authored
May 11, 2016
by
j4cbo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #227 from menuet/master
Cleaner fix for VS2015
parents
fe2fd053
1e5dad61
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
22 deletions
+19
-22
support-lib/djinni_common.hpp
support-lib/djinni_common.hpp
+13
-3
support-lib/jni/djinni_support.cpp
support-lib/jni/djinni_support.cpp
+3
-7
support-lib/jni/djinni_support.hpp
support-lib/jni/djinni_support.hpp
+3
-12
No files found.
support-lib/djinni_common.hpp
View file @
191940c8
...
...
@@ -16,8 +16,18 @@
#pragma once
#ifdef _MSC_VER // weak attribute not supported by MSVC
#define DJINNI_WEAK_DEFINITION
#ifdef _MSC_VER
#define DJINNI_WEAK_DEFINITION // weak attribute not supported by MSVC
#define DJINNI_NORETURN_DEFINITION __declspec(noreturn)
#if _MSC_VER < 1900 // snprintf not implemented prior to VS2015
#define DJINNI_SNPRINTF snprintf
#define noexcept _NOEXCEPT // work-around for missing noexcept VS2015
#define constexpr // work-around for missing constexpr VS2015
#else
#define DJINNI_SNPRINTF _snprintf
#endif
#else
#define DJINNI_WEAK_DEFINITION __attribute__((weak))
#define DJINNI_WEAK_DEFINITION __attribute__((weak))
#define DJINNI_NORETURN_DEFINITION __attribute__((noreturn))
#define DJINNI_SNPRINTF snprintf
#endif
support-lib/jni/djinni_support.cpp
View file @
191940c8
...
...
@@ -113,7 +113,8 @@ void jniExceptionCheck(JNIEnv * env) {
}
}
DJINNI_WEAK_DEFINITION
__attribute__
((
noreturn
))
DJINNI_WEAK_DEFINITION
DJINNI_NORETURN_DEFINITION
void
jniThrowCppFromJavaException
(
JNIEnv
*
env
,
jthrowable
java_exception
)
{
throw
jni_exception
{
env
,
java_exception
};
}
...
...
@@ -154,12 +155,7 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha
const
char
*
file_basename
=
slash
?
slash
+
1
:
file
;
char
buf
[
256
];
#if (defined _MSC_VER) && (_MSC_VER < 1900)
// snprintf not implemented on MSVC prior to 2015
_snprintf
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
#else
snprintf
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
#endif
DJINNI_SNPRINTF
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
const
jclass
cassert
=
env
->
FindClass
(
"java/lang/Error"
);
assert
(
cassert
);
...
...
support-lib/jni/djinni_support.hpp
View file @
191940c8
...
...
@@ -24,14 +24,9 @@
#include <unordered_map>
#include "../proxy_cache_interface.hpp"
#include "../djinni_common.hpp"
#include <jni.h>
// work-around for missing noexcept and constexpr support in MSVC prior to 2015
#if (defined _MSC_VER) && (_MSC_VER < 1900)
# define noexcept _NOEXCEPT
# define constexpr
#endif
/*
* Djinni support library
*/
...
...
@@ -150,17 +145,13 @@ void jniExceptionCheck(JNIEnv * env);
* can replace it by defining your own version. The default implementation
* will throw a jni_exception containing the given jthrowable.
*/
__attribute__
((
noreturn
))
DJINNI_NORETURN_DEFINITION
void
jniThrowCppFromJavaException
(
JNIEnv
*
env
,
jthrowable
java_exception
);
/*
* Set an AssertionError in env with message message, and then throw via jniExceptionCheck.
*/
#ifdef _MSC_VER
__declspec
(
noreturn
)
#else
__attribute__
((
noreturn
))
#endif
DJINNI_NORETURN_DEFINITION
void
jniThrowAssertionError
(
JNIEnv
*
env
,
const
char
*
file
,
int
line
,
const
char
*
check
);
#define DJINNI_ASSERT_MSG(check, env, message) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment