summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-09 03:18:42 +0100
committerSven Gothel <[email protected]>2015-03-09 03:18:42 +0100
commit10060b091b76bee35246c5165d49ab546ebc4e37 (patch)
tree17576b74d806f0f571939660675383f98431d82a /src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
parent414a0146660cadd35d5ae270f7f819717e9c7374 (diff)
Bug 1134 - ProcAddressCMethodBindingEmitter: Use available 'ProcAddrTypedef' for type validation w/ local generated variant (robustness)
ProcAddressCMethodBindingEmitter code regarding having the public 'ProcAddrTypedef' (from input header) was simply broken, since it always used the local generated 'ProcAddrTypedef', if 'ProcAddrTypedef' was forced. Hence the public 'ProcAddrTypedef' was ignored in most cases. ProcAddressCMethodBindingEmitter's semantic changed from: needsLocalTypedef -> hasProcAddrTypedef New Code generation: - always generated the local 'ProcAddrTypedef' - if hasProcAddrTypedef, use public 'ProcAddrTypedef' for return type variable - cast local 'ProcAddrTypedef' to public 'ProcAddrTypedef', which renders the native compiler to validate the local and public types.
Diffstat (limited to 'src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java')
-rw-r--r--src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
index 180c48f..51e47e9 100644
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java
@@ -249,16 +249,13 @@ public class ProcAddressEmitter extends JavaEmitter {
final FunctionSymbol cSymbol = baseCEmitter.getBinding().getCSymbol();
// See whether we need a proc address entry for this one
- final boolean needsLocalTypedef = getProcAddressConfig().forceProcAddressGen(cSymbol) ||
- !hasFunctionPointerTypedef(cSymbol);
- final boolean callThroughProcAddress = needsLocalTypedef || callThroughProcAddress(cSymbol);
- LOG.log(Level.INFO, cSymbol.getASTLocusTag(), "genModProcAddrEmitter: needsTypedef {0}, callThrough {1}: {2}",
- needsLocalTypedef, callThroughProcAddress, cSymbol.getAliasedString());
-
- String forcedCallingConvention = null;
- if (needsLocalTypedef) {
- forcedCallingConvention = getProcAddressConfig().getLocalProcAddressCallingConvention(cSymbol);
- }
+ final boolean hasProcAddrTypedef = hasFunctionPointerTypedef(cSymbol);
+ final boolean callThroughProcAddress = hasProcAddrTypedef || callThroughProcAddress(cSymbol);
+ final String localProcCallingConvention = getProcAddressConfig().getLocalProcAddressCallingConvention(cSymbol);
+
+ LOG.log(Level.INFO, cSymbol.getASTLocusTag(), "genModProcAddrEmitter: callThrough {0}, hasTypedef {1}, localCallConv {2}: {3}",
+ callThroughProcAddress, hasProcAddrTypedef, localProcCallingConvention, cSymbol.getAliasedString());
+
// Note that we don't care much about the naming of the C argument
// variables so to keep things simple we ignore the buffer object
// property for the binding
@@ -267,7 +264,7 @@ public class ProcAddressEmitter extends JavaEmitter {
// extra final argument, which is the address (the OpenGL procedure
// address) of the function it needs to call
final ProcAddressCMethodBindingEmitter res = new ProcAddressCMethodBindingEmitter(
- baseCEmitter, callThroughProcAddress, needsLocalTypedef, forcedCallingConvention, this);
+ baseCEmitter, callThroughProcAddress, hasProcAddrTypedef, localProcCallingConvention, this);
final MessageFormat exp = baseCEmitter.getReturnValueCapacityExpression();
if (exp != null) {