Open
Conversation
The existing script fails to detect compiler versions properly if the
major version has more than one digit. For example, with clang version
10, the script incorrectly interprets the version number as "1". Fix
the script to parse the digits until the first dot as the major version
instead, thus preserving the correct major version number.
(head -n1 is added in case the version number is mentioned more than once
by ${CXX} --version.)
Also, print the version number and the compiler when building to make
sure the correct compiler and version number were detected.
"ptr" may already exist in the base class. A simple fix is to rename the ptr instances in unique.hpp to "ptr_". Otherwise, clang reports errors.
When building with GCC 9, this comparison causes this error:
comparison of integer expressions of different signedness: ‘jni::jsize’ {aka ‘long unsigned int’} and ‘int’
As a workaround, explicitely cast the return value of max()
to jsize (not ::jsize !).
GCC 9 complains about these reinterpret_cast expressions because of the
different return value:
error: cast between incompatible function types from ‘void (*)(JNIEnv*, jni::jobject*, jni::jobject*)’ {aka ‘void (*)(_JNIEnv*, jni::jobject*, jni::jobject*)’} to ‘jboolean (*)(JNIEnv*, jobject, jobject)’ {aka ‘unsigned char (*)(_JNIEnv*, _jobject*, _jobject*)’}
Fix by using void as return value.
|
Could someone please merge this PR after reviewing? It seems fairly simple to me, and compiling with the default compilers on major distros is really helpful to newcomers... Thanks in advance, |
G10h4ck
approved these changes
Nov 22, 2021
|
ping @jfirebaugh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, jni.hpp does not build in Ubuntu 20.04 with GCC 9 and clang 10. These commits fix the issues.