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
1fabe4ea
Commit
1fabe4ea
authored
Nov 25, 2014
by
Fredrik Orderud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add work-arounds for C++ features and GCC attributes not supported by Microsoft Visual C++.
parent
556e802e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
support-lib/jni/djinni_support.cpp
support-lib/jni/djinni_support.cpp
+10
-1
support-lib/jni/djinni_support.hpp
support-lib/jni/djinni_support.hpp
+11
-1
No files found.
support-lib/jni/djinni_support.cpp
View file @
1fabe4ea
...
...
@@ -124,7 +124,12 @@ 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
jclass
cassert
=
env
->
FindClass
(
"java/lang/AssertionError"
);
assert
(
cassert
);
...
...
@@ -388,7 +393,11 @@ std::string jniUTF8FromString(JNIEnv * env, const jstring jstr) {
return
out
;
}
__attribute__
((
weak
))
#ifdef _MSC_VER
// weak attribute not supported by MSVC
#else
__attribute__
((
weak
))
#endif
void
jniSetPendingFromCurrent
(
JNIEnv
*
env
,
const
char
*
/*ctx*/
)
noexcept
{
try
{
throw
;
...
...
support-lib/jni/djinni_support.hpp
View file @
1fabe4ea
...
...
@@ -25,6 +25,12 @@
#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
*/
...
...
@@ -57,7 +63,11 @@ void jniExceptionCheck(JNIEnv * env);
/*
* Set an AssertionError in env with message message, and then throw jni_exception_pending.
*/
__attribute__
((
noreturn
))
#ifdef _MSC_VER
__declspec
(
noreturn
)
#else
__attribute__
((
noreturn
))
#endif
void
jniThrowAssertionError
(
JNIEnv
*
env
,
const
char
*
file
,
int
line
,
const
char
*
check
);
#define DJINNI_ASSERT(check, env) \
...
...
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