aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-09 03:43:55 +0100
committerSven Gothel <[email protected]>2015-03-09 03:43:55 +0100
commit90e53d0c01f2fe62ff8c5bcc41741ec3c9c47e59 (patch)
treed24540588bcfe64ce6410fa1da9d68e6c8e6f30f /src/java
parent10060b091b76bee35246c5165d49ab546ebc4e37 (diff)
Bug 1134 - Fix CMethodBindingEmitter return type '_res' qualifiers (part 2)
Commit 414a0146660cadd35d5ae270f7f819717e9c7374 removed the const/volatile of the local return variable. This change also casts the function calling result to the same - hence removing a possible c-compiler warning of dropping qualifier const.
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java8
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java7
2 files changed, 13 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index 16adbe9..1987668 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -459,6 +459,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
writer.print(" ");
// Note we respect const/volatile in the function return type.
// However, we cannot have it 'const' for our local variable.
+ // See cast in emitBodyCallCFunction(..)!
writer.print(binding.getCSymbol().getReturnType().getCName(false));
writer.println(" _res;");
if (javaReturnType.isNIOByteBufferArray() ||
@@ -978,7 +979,12 @@ public class CMethodBindingEmitter extends FunctionEmitter {
final Type cReturnType = binding.getCReturnType();
if (!cReturnType.isVoid()) {
- writer.print("_res = ");
+ // Note we respect const/volatile in the function return type.
+ // However, we cannot have it 'const' for our local variable.
+ // See return type in emitBodyVariableDeclarations(..)!
+ writer.print("_res = (");
+ writer.print(cReturnType.getCName(false));
+ writer.print(") ");
}
if ( isCStructFunctionPointer && binding.hasContainingType() ) {
// Call through function pointer
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
index 4707e57..57a50cc 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
@@ -198,7 +198,12 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter {
final Type cReturnType = binding.getCReturnType();
if (!cReturnType.isVoid()) {
- writer.print("_res = ");
+ // Note we respect const/volatile in the function return type.
+ // However, we cannot have it 'const' for our local variable.
+ // See return type in CMethodBindingEmitter.emitBodyVariableDeclarations(..)!
+ writer.print("_res = (");
+ writer.print(cReturnType.getCName(false));
+ writer.print(") ");
}
final MethodBinding mBinding = getBinding();
if (mBinding.hasContainingType()) {