diff options
author | Wade Walker <[email protected]> | 2014-03-04 15:21:35 -0600 |
---|---|---|
committer | Wade Walker <[email protected]> | 2014-03-04 15:21:35 -0600 |
commit | 86c868fcb78b53f02ad2bae1770e4db61b892678 (patch) | |
tree | b1cc5d86954338f5449b39412f74115552495db5 /src/java/com/jogamp/gluegen/cgram | |
parent | 15ea21ea190a79a3740b66698103ef5b4f145e94 (diff) |
Remove warnings in emitted C code.
Fix 1: Only emit "int * _offsetHandle = NULL" if it will be used, to
avoid unused variable warning. Fix 2: Add "unsigned" to typecasts in C
function calls when needed to avoid implicit typecast warning. This
commit also adds a unit test for a method that uses an "unsigned char
**" parameter, to mimic the JOCL clCreateProgramWithBinary() function
that caused the typecast warnings.
Diffstat (limited to 'src/java/com/jogamp/gluegen/cgram')
-rw-r--r-- | src/java/com/jogamp/gluegen/cgram/types/IntType.java | 5 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/cgram/types/PointerType.java | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/types/IntType.java b/src/java/com/jogamp/gluegen/cgram/types/IntType.java index ffc5696..6eeb997 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/IntType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/IntType.java @@ -82,6 +82,11 @@ public class IntType extends PrimitiveType implements Cloneable { return unsigned; } + /** Indicates whether this type is an unsigned primitive type, as opposed to a typedef type that's unsigned. */ + public boolean isPrimitiveUnsigned() { + return unsigned && !typedefedUnsigned; + } + @Override public String toString() { return getCVAttributesString() + ((isUnsigned() & (!typedefedUnsigned)) ? "unsigned " : "") + getName(); diff --git a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java index 4922d28..f4811c7 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java @@ -120,6 +120,13 @@ public class PointerType extends Type implements Cloneable { return targetType; } + public Type getLastTargetType() { + if(targetType.isPointer()) + return ((PointerType)targetType).getLastTargetType(); + else + return targetType; + } + @Override public boolean isFunctionPointer() { return targetType.isFunction(); |