From ffb589a35abf34f313312617e065b444c5f705b3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 14 Nov 2010 23:31:42 +0100 Subject: Fix size_t, uintptr_t and uint32_t, uint64_t: suppress 'unsigned' in 'toString()' ; Added type tests. For size_t and uintptr_t this actually generated invalid C code. Added type tests for those. --- src/java/com/jogamp/gluegen/cgram/HeaderParser.g | 8 ++++---- src/java/com/jogamp/gluegen/cgram/types/IntType.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/java') diff --git a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g index acb6dde..a0d2a83 100644 --- a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g +++ b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g @@ -507,14 +507,14 @@ typeSpecifier[int attributes] returns [Type t] { | "__int32" { t = new IntType("__int32", SizeThunk.INT, unsigned, cvAttrs); } | "int32_t" { t = new IntType("int32_t", SizeThunk.INT, false, cvAttrs); /* TS: always signed */ } | "wchar_t" { t = new IntType("wchar_t", SizeThunk.INT, false, cvAttrs); /* TS: always signed */ } - | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT, true, cvAttrs); /* TS: always unsigned */ } + | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT, true, cvAttrs, true); /* TS: always unsigned */ } | "__int64" { t = new IntType("__int64", SizeThunk.INT64, unsigned, cvAttrs); } | "int64_t" { t = new IntType("int64_t", SizeThunk.INT64, false, cvAttrs); /* TS: always signed */ } - | "uint64_t" { t = new IntType("uint64_t", SizeThunk.INT64, true, cvAttrs); /* TS: always unsigned */ } + | "uint64_t" { t = new IntType("uint64_t", SizeThunk.INT64, true, cvAttrs, true); /* TS: always unsigned */ } | "ptrdiff_t" { t = new IntType("ptrdiff_t", SizeThunk.POINTER, false, cvAttrs); /* TS: always signed */ } | "intptr_t" { t = new IntType("intptr_t", SizeThunk.POINTER, false, cvAttrs); /* TS: always signed */ } - | "size_t" { t = new IntType("size_t", SizeThunk.POINTER, true, cvAttrs); /* TS: always unsigned */ } - | "uintptr_t" { t = new IntType("uintptr_t", SizeThunk.POINTER, true, cvAttrs); /* TS: always unsigned */ } + | "size_t" { t = new IntType("size_t", SizeThunk.POINTER, true, cvAttrs, true); /* TS: always unsigned */ } + | "uintptr_t" { t = new IntType("uintptr_t", SizeThunk.POINTER, true, cvAttrs, true); /* TS: always unsigned */ } | t = structSpecifier[cvAttrs] ( attributeDecl )* | t = unionSpecifier [cvAttrs] ( attributeDecl )* | t = enumSpecifier [cvAttrs] diff --git a/src/java/com/jogamp/gluegen/cgram/types/IntType.java b/src/java/com/jogamp/gluegen/cgram/types/IntType.java index c72fde4..b85c7fc 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/IntType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/IntType.java @@ -48,7 +48,7 @@ public class IntType extends PrimitiveType implements Cloneable { this(name, size, unsigned, cvAttributes, false); } - private IntType(String name, SizeThunk size, boolean unsigned, int cvAttributes, boolean typedefedUnsigned) { + public IntType(String name, SizeThunk size, boolean unsigned, int cvAttributes, boolean typedefedUnsigned) { super(name, size, cvAttributes); this.unsigned = unsigned; this.typedefedUnsigned = typedefedUnsigned; -- cgit v1.2.3