[D] Use stdc.config.c_long/c_ulong to represent C long types.

Previously, C's long/ulong types would always be mapped to 32 bit integers in D, which is wrong on D_LP64, but was not really a problem in practice since DMD used to be 32 bit only.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12861 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
David Nadlinger 2011-12-03 19:48:01 +00:00
commit e2b2f26bf6
8 changed files with 51 additions and 33 deletions

View file

@ -583,7 +583,7 @@ private void verifyCount(int expected, Klass k) {
// We deliberately call the use_count(Klass) overload also for objects which
// are instances of a subclass of Klass (due to static dispatch); things still
// have to work.
int got = use_count(k);
auto got = use_count(k);
if (expected != got)
throw new Exception("verify use_count failed. Expected: " ~ to!string(expected) ~ " Got: " ~ to!string(got));
}

View file

@ -1,5 +1,6 @@
module preproc_constants_c_runme;
import tango.stdc.config;
import preproc_constants_c.preproc_constants_c;
// Same as preproc_constants.i testcase, but bool types are int instead.
@ -10,10 +11,10 @@ void main() {
static assert(is(uint == typeof(CONST_UINT2())));
static assert(is(uint == typeof(CONST_UINT3())));
static assert(is(uint == typeof(CONST_UINT4())));
static assert(is(int == typeof(CONST_LONG1())));
static assert(is(int == typeof(CONST_LONG2())));
static assert(is(int == typeof(CONST_LONG3())));
static assert(is(int == typeof(CONST_LONG4())));
static assert(is(c_long == typeof(CONST_LONG1())));
static assert(is(c_long == typeof(CONST_LONG2())));
static assert(is(c_long == typeof(CONST_LONG3())));
static assert(is(c_long == typeof(CONST_LONG4())));
static assert(is(long == typeof(CONST_LLONG1())));
static assert(is(long == typeof(CONST_LLONG2())));
static assert(is(long == typeof(CONST_LLONG3())));
@ -38,8 +39,8 @@ void main() {
// static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(int == typeof(INT_AND_LONG())));
static assert(is(uint == typeof(INT_AND_ULONG())));
static assert(is(c_long == typeof(INT_AND_LONG())));
static assert(is(c_ulong == typeof(INT_AND_ULONG())));
static assert(is(long == typeof(INT_AND_LLONG())));
static assert(is(ulong == typeof(INT_AND_ULLONG())));
static assert(is(int == typeof(BOOL_AND_BOOL())));

View file

@ -1,5 +1,6 @@
module preproc_constants_c_runme;
import core.stdc.config;
import preproc_constants_c.preproc_constants_c;
// Same as preproc_constants.i testcase, but bool types are int instead.
@ -10,10 +11,10 @@ void main() {
static assert(is(uint == typeof(CONST_UINT2())));
static assert(is(uint == typeof(CONST_UINT3())));
static assert(is(uint == typeof(CONST_UINT4())));
static assert(is(int == typeof(CONST_LONG1())));
static assert(is(int == typeof(CONST_LONG2())));
static assert(is(int == typeof(CONST_LONG3())));
static assert(is(int == typeof(CONST_LONG4())));
static assert(is(c_long == typeof(CONST_LONG1())));
static assert(is(c_long == typeof(CONST_LONG2())));
static assert(is(c_long == typeof(CONST_LONG3())));
static assert(is(c_long == typeof(CONST_LONG4())));
static assert(is(long == typeof(CONST_LLONG1())));
static assert(is(long == typeof(CONST_LLONG2())));
static assert(is(long == typeof(CONST_LLONG3())));
@ -38,8 +39,8 @@ void main() {
// static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(int == typeof(INT_AND_LONG())));
static assert(is(uint == typeof(INT_AND_ULONG())));
static assert(is(c_long == typeof(INT_AND_LONG())));
static assert(is(c_ulong == typeof(INT_AND_ULONG())));
static assert(is(long == typeof(INT_AND_LLONG())));
static assert(is(ulong == typeof(INT_AND_ULLONG())));
static assert(is(int == typeof(BOOL_AND_BOOL())));

View file

@ -1,5 +1,6 @@
module preproc_constants_runme;
import tango.stdc.config;
import preproc_constants.preproc_constants;
void main() {
@ -9,10 +10,10 @@ void main() {
static assert(is(uint == typeof(CONST_UINT2())));
static assert(is(uint == typeof(CONST_UINT3())));
static assert(is(uint == typeof(CONST_UINT4())));
static assert(is(int == typeof(CONST_LONG1())));
static assert(is(int == typeof(CONST_LONG2())));
static assert(is(int == typeof(CONST_LONG3())));
static assert(is(int == typeof(CONST_LONG4())));
static assert(is(c_long == typeof(CONST_LONG1())));
static assert(is(c_long == typeof(CONST_LONG2())));
static assert(is(c_long == typeof(CONST_LONG3())));
static assert(is(c_long == typeof(CONST_LONG4())));
static assert(is(long == typeof(CONST_LLONG1())));
static assert(is(long == typeof(CONST_LLONG2())));
static assert(is(long == typeof(CONST_LLONG3())));
@ -37,8 +38,8 @@ void main() {
// static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(int == typeof(INT_AND_LONG())));
static assert(is(uint == typeof(INT_AND_ULONG())));
static assert(is(c_long == typeof(INT_AND_LONG())));
static assert(is(c_ulong == typeof(INT_AND_ULONG())));
static assert(is(long == typeof(INT_AND_LLONG())));
static assert(is(ulong == typeof(INT_AND_ULLONG())));
static assert(is(int == typeof(BOOL_AND_BOOL())));

View file

@ -1,5 +1,6 @@
module preproc_constants_runme;
import core.stdc.config;
import preproc_constants.preproc_constants;
void main() {
@ -9,10 +10,10 @@ void main() {
static assert(is(uint == typeof(CONST_UINT2())));
static assert(is(uint == typeof(CONST_UINT3())));
static assert(is(uint == typeof(CONST_UINT4())));
static assert(is(int == typeof(CONST_LONG1())));
static assert(is(int == typeof(CONST_LONG2())));
static assert(is(int == typeof(CONST_LONG3())));
static assert(is(int == typeof(CONST_LONG4())));
static assert(is(c_long == typeof(CONST_LONG1())));
static assert(is(c_long == typeof(CONST_LONG2())));
static assert(is(c_long == typeof(CONST_LONG3())));
static assert(is(c_long == typeof(CONST_LONG4())));
static assert(is(long == typeof(CONST_LLONG1())));
static assert(is(long == typeof(CONST_LLONG2())));
static assert(is(long == typeof(CONST_LLONG3())));
@ -37,8 +38,8 @@ void main() {
// static assert(is(int == typeof(INT_AND_CHAR())));
static assert(is(int == typeof(INT_AND_INT())));
static assert(is(uint == typeof(INT_AND_UINT())));
static assert(is(int == typeof(INT_AND_LONG())));
static assert(is(uint == typeof(INT_AND_ULONG())));
static assert(is(c_long == typeof(INT_AND_LONG())));
static assert(is(c_ulong == typeof(INT_AND_ULONG())));
static assert(is(long == typeof(INT_AND_LLONG())));
static assert(is(ulong == typeof(INT_AND_ULLONG())));
static assert(is(int == typeof(BOOL_AND_BOOL())));