From 964f91b5a120dee768c06d0d9e3a7104633c8ae7 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Mon, 16 Jun 2008 16:01:19 +0200 Subject: [PATCH] [svn r291] Fixed a bunch of the old Phobos tests to work with Tango. Branch statements now emit a new block after it. Fixed the _adSort runtime function had a bad signature. Added a missing dot prefix on compiler generated string tables for string switch. Fixed, PTRSIZE seems like it was wrong on 64bit, now it definitely gets set properly. --- dmd/mtype.c | 4 +++- gen/statements.cpp | 15 +++++++++++---- tango/lib/compiler/llvmdc/memory.d | 11 +++++------ tango/lib/compiler/llvmdc/qsort2.d | 4 ++-- test/a.d | 2 ++ test/aa3.d | 3 +++ test/aa6.d | 2 ++ test/alloca1.d | 2 ++ test/b.d | 2 ++ test/bitops.d | 3 +++ test/bug10.d | 3 ++- test/bug12.d | 2 +- test/bug20.d | 1 + test/bug21.d | 1 + test/bug22.d | 1 + test/bug23.d | 2 ++ test/bug24.d | 1 + test/bug25.d | 1 + test/bug29.d | 1 + test/bug32.d | 1 + test/bug50.d | 1 + test/bug55.d | 1 + test/bug60.d | 2 ++ test/bug61.d | 1 + test/bug62.d | 1 + test/bug63.d | 1 + test/bug77.d | 2 +- test/bug80.d | 1 + test/bug9.d | 2 ++ test/calls1.d | 2 +- test/classes.d | 2 ++ test/classes11.d | 1 + test/classes2.d | 2 ++ test/classes4.d | 2 ++ test/classes5.d | 1 + test/classes6.d | 1 + test/classinfo1.d | 2 ++ test/cond.d | 2 ++ test/dgs.d | 3 +++ test/dotproduct.d | 2 ++ test/e.d | 2 ++ test/floatcmp.d | 1 + test/foreach1.d | 12 ++++++------ test/foreach2.d | 2 +- test/foreach3.d | 2 +- test/foreach4.d | 2 +- test/foreach5.d | 2 +- test/funcptr.d | 2 ++ test/funcs.d | 2 ++ test/g.d | 2 ++ test/globals1.d | 1 + test/innerclass1.d | 1 + test/mainargs1.d | 2 +- test/moduleinfo1.d | 3 --- test/moduleinfo2.d | 8 +++++--- test/multiarr4.d | 1 + test/nested5.d | 1 + test/nested6.d | 1 + test/nested7.d | 1 + test/nested8.d | 1 + test/nested9.d | 1 + test/pt.d | 3 +++ test/ptrarith.d | 2 ++ test/scope1.d | 2 +- test/scope2.d | 2 +- test/scope3.d | 2 +- test/sieve.d | 2 ++ test/sqrts.d | 2 +- test/static_ctor.d | 2 ++ test/staticarrays.d | 2 ++ test/strings1.d | 2 +- test/switch2.d | 1 + test/switch3.d | 1 + test/typeinfo.d | 1 + test/typeinfo7.d | 2 +- test/typeinfo8.d | 2 +- test/unrolled.d | 2 ++ test/v2d.d | 2 ++ test/vararg1.d | 2 +- test/vararg3.d | 2 +- test/vararg4.d | 2 +- test/vararg5.d | 2 +- test/virtcall.d | 2 ++ 83 files changed, 141 insertions(+), 45 deletions(-) diff --git a/dmd/mtype.c b/dmd/mtype.c index ecce663b..698d019b 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -223,16 +223,18 @@ void Type::init() tvoidptr = tvoid->pointerTo(); - // set size_t / ptrdiff_t types + // set size_t / ptrdiff_t types and pointer size if (global.params.is64bit) { Tsize_t = Tuns64; Tptrdiff_t = Tint64; + PTRSIZE = 8; } else { Tsize_t = Tuns32; Tptrdiff_t = Tint32; + PTRSIZE = 4; } // set real size and padding diff --git a/gen/statements.cpp b/gen/statements.cpp index 753fd059..4ba89ede 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -440,19 +440,26 @@ void BreakStatement::toIR(IRState* p) targetLoopStatement = tmp->statement; // find the right break block and jump there + bool found = false; IRState::LoopScopeVec::reverse_iterator it; for(it = p->loopbbs.rbegin(); it != p->loopbbs.rend(); ++it) { if(it->s == targetLoopStatement) { llvm::BranchInst::Create(it->end, p->scopebb()); - return; + found = true; + break; } } - assert(0); + assert(found); } else { emit_finallyblocks(p, enclosingtryfinally, p->loopbbs.back().enclosingtryfinally); llvm::BranchInst::Create(p->loopbbs.back().end, p->scopebb()); } + + // the break terminated this basicblock, start a new one + llvm::BasicBlock* oldend = gIR->scopeend(); + llvm::BasicBlock* bb = llvm::BasicBlock::Create("afterbreak", p->topfunc(), oldend); + p->scope() = IRScope(bb,oldend); } ////////////////////////////////////////////////////////////////////////////// @@ -724,7 +731,7 @@ void SwitchStatement::toIR(IRState* p) const LLType* elemTy = DtoType(condition->type); const llvm::ArrayType* arrTy = llvm::ArrayType::get(elemTy, inits.size()); LLConstant* arrInit = llvm::ConstantArray::get(arrTy, inits); - llvm::GlobalVariable* arr = new llvm::GlobalVariable(arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, "string_switch_table_data", gIR->module); + llvm::GlobalVariable* arr = new llvm::GlobalVariable(arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, ".string_switch_table_data", gIR->module); const LLType* elemPtrTy = getPtrToType(elemTy); LLConstant* arrPtr = llvm::ConstantExpr::getBitCast(arr, elemPtrTy); @@ -739,7 +746,7 @@ void SwitchStatement::toIR(IRState* p) sinits.push_back(arrPtr); LLConstant* sInit = llvm::ConstantStruct::get(sTy, sinits); - switchTable = new llvm::GlobalVariable(sTy, true, llvm::GlobalValue::InternalLinkage, sInit, "string_switch_table", gIR->module); + switchTable = new llvm::GlobalVariable(sTy, true, llvm::GlobalValue::InternalLinkage, sInit, ".string_switch_table", gIR->module); } // body block diff --git a/tango/lib/compiler/llvmdc/memory.d b/tango/lib/compiler/llvmdc/memory.d index 6af1646f..07b85ee2 100644 --- a/tango/lib/compiler/llvmdc/memory.d +++ b/tango/lib/compiler/llvmdc/memory.d @@ -47,7 +47,6 @@ private { void* llvm_frameaddress(uint level=0); } - extern(C) int printf(char*, ...); } } @@ -98,7 +97,11 @@ extern (C) void* rt_stackBottom() */ extern (C) void* rt_stackTop() { - version( D_InlineAsm_X86 ) + version(LLVMDC) + { + return llvm_frameaddress(); + } + else version( D_InlineAsm_X86 ) { asm { @@ -107,10 +110,6 @@ extern (C) void* rt_stackTop() ret; } } - else version(LLVMDC) - { - return llvm_frameaddress(); - } else { static assert( false, "Architecture not supported." ); diff --git a/tango/lib/compiler/llvmdc/qsort2.d b/tango/lib/compiler/llvmdc/qsort2.d index 4d6579e4..d33fded4 100644 --- a/tango/lib/compiler/llvmdc/qsort2.d +++ b/tango/lib/compiler/llvmdc/qsort2.d @@ -30,14 +30,14 @@ extern (C) int cmp(void* p1, void* p2) return tiglobal.compare(p1, p2); } -extern (C) long _adSort(Array a, TypeInfo ti) +extern (C) Array _adSort(Array a, TypeInfo ti) { synchronized { tiglobal = ti; tango.stdc.stdlib.qsort(a.ptr, a.length, cast(size_t)ti.tsize(), &cmp); } - return *cast(long*)(&a); + return a; } diff --git a/test/a.d b/test/a.d index f7cc6e33..82d00715 100644 --- a/test/a.d +++ b/test/a.d @@ -1,5 +1,7 @@ module a; +extern(C) int printf(char*, ...); + int i = 42; void main() diff --git a/test/aa3.d b/test/aa3.d index 7e354e27..e31967a4 100644 --- a/test/aa3.d +++ b/test/aa3.d @@ -1,5 +1,8 @@ module aa3; +extern(C) int printf(char*, ...); +alias char[] string; + void main() { int[string] aa; diff --git a/test/aa6.d b/test/aa6.d index da6afc18..be5d1b25 100644 --- a/test/aa6.d +++ b/test/aa6.d @@ -1,5 +1,7 @@ module aa6; +extern(C) int printf(char*, ...); + void main() { int[int] aa; diff --git a/test/alloca1.d b/test/alloca1.d index 6eeb348c..4223bfb8 100644 --- a/test/alloca1.d +++ b/test/alloca1.d @@ -3,6 +3,8 @@ module alloca1; pragma(LLVM_internal, "alloca") void* alloca(uint); +extern(C) int printf(char*, ...); + void main() { int n = 16; diff --git a/test/b.d b/test/b.d index 564b861d..5975c4b4 100644 --- a/test/b.d +++ b/test/b.d @@ -1,5 +1,7 @@ module b; +extern(C) int printf(char*, ...); + struct S { int i; diff --git a/test/bitops.d b/test/bitops.d index 8f706733..4911c55d 100644 --- a/test/bitops.d +++ b/test/bitops.d @@ -1,3 +1,6 @@ + +extern(C) int printf(char*, ...); + void main() { printf("Bitwise operations test\n"); diff --git a/test/bug10.d b/test/bug10.d index 6c333d68..0d77f929 100644 --- a/test/bug10.d +++ b/test/bug10.d @@ -1,5 +1,6 @@ module bug10; -import std.stdio; +extern(C) int printf(char*, ...); + class C { char[] msg; diff --git a/test/bug12.d b/test/bug12.d index 052333d5..0da910ea 100644 --- a/test/bug12.d +++ b/test/bug12.d @@ -2,5 +2,5 @@ module bug12; void main() { - const string name="y"; + const char[] name="y"; } diff --git a/test/bug20.d b/test/bug20.d index fef83ec2..ca3235b7 100644 --- a/test/bug20.d +++ b/test/bug20.d @@ -1,4 +1,5 @@ module bug20; +extern(C) int printf(char*, ...); void func(void delegate() dg) { diff --git a/test/bug21.d b/test/bug21.d index 4f26916d..e4a226e2 100644 --- a/test/bug21.d +++ b/test/bug21.d @@ -1,4 +1,5 @@ module bug21; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug22.d b/test/bug22.d index def342ba..13edb826 100644 --- a/test/bug22.d +++ b/test/bug22.d @@ -1,4 +1,5 @@ module bug22; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug23.d b/test/bug23.d index 5989cc8b..ff98e2ad 100644 --- a/test/bug23.d +++ b/test/bug23.d @@ -1,4 +1,6 @@ module bug23; +extern(C) int printf(char*, ...); + void main() { int i; diff --git a/test/bug24.d b/test/bug24.d index 707ffd28..c987454c 100644 --- a/test/bug24.d +++ b/test/bug24.d @@ -1,4 +1,5 @@ module bug24; +extern(C) int printf(char*, ...); struct S { diff --git a/test/bug25.d b/test/bug25.d index d9667235..b5a90185 100644 --- a/test/bug25.d +++ b/test/bug25.d @@ -1,4 +1,5 @@ module bug25; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug29.d b/test/bug29.d index 5cfa7e72..2c6ee007 100644 --- a/test/bug29.d +++ b/test/bug29.d @@ -1,4 +1,5 @@ module bug29; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug32.d b/test/bug32.d index a6100c83..10bcb566 100644 --- a/test/bug32.d +++ b/test/bug32.d @@ -1,4 +1,5 @@ module bug32; +extern(C) int printf(char*, ...); struct S { diff --git a/test/bug50.d b/test/bug50.d index 5aca4ada..67902aac 100644 --- a/test/bug50.d +++ b/test/bug50.d @@ -1,4 +1,5 @@ module bug50; +extern(C) int printf(char*, ...); pragma(LLVM_internal, "notypeinfo") struct S diff --git a/test/bug55.d b/test/bug55.d index 40cede5e..72f6df71 100644 --- a/test/bug55.d +++ b/test/bug55.d @@ -1,4 +1,5 @@ module bug55; +extern(C) int printf(char*, ...); int atoi(char[] s) { int i, fac=1; diff --git a/test/bug60.d b/test/bug60.d index d1436ea4..b487136b 100644 --- a/test/bug60.d +++ b/test/bug60.d @@ -1,4 +1,6 @@ module bug60; +extern(C) int printf(char*, ...); + void func(T...)(T t) { foreach(v;t) { diff --git a/test/bug61.d b/test/bug61.d index e98c236a..6b367d8f 100644 --- a/test/bug61.d +++ b/test/bug61.d @@ -1,4 +1,5 @@ module bug61; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug62.d b/test/bug62.d index 5c4c90c6..8d71f2bc 100644 --- a/test/bug62.d +++ b/test/bug62.d @@ -1,4 +1,5 @@ module bug62; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug63.d b/test/bug63.d index 583b8e49..33a32e01 100644 --- a/test/bug63.d +++ b/test/bug63.d @@ -1,4 +1,5 @@ module bug63; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug77.d b/test/bug77.d index bf88f800..a9a6db57 100644 --- a/test/bug77.d +++ b/test/bug77.d @@ -1,5 +1,5 @@ module bug77; -import std.c.string; +import tango.stdc.string; void main() { size_t len; diff --git a/test/bug80.d b/test/bug80.d index 4c9bbd61..4317d381 100644 --- a/test/bug80.d +++ b/test/bug80.d @@ -1,4 +1,5 @@ module bug80; +extern(C) int printf(char*, ...); void main() { diff --git a/test/bug9.d b/test/bug9.d index 71155e3a..0833d2f5 100644 --- a/test/bug9.d +++ b/test/bug9.d @@ -1,4 +1,6 @@ module bug9; +extern(C) int printf(char*, ...); + struct rgb { ubyte[3] values; diff --git a/test/calls1.d b/test/calls1.d index 004b7d2d..14ec9b67 100644 --- a/test/calls1.d +++ b/test/calls1.d @@ -1,5 +1,5 @@ module calls1; -import std.stdarg; +import tango.core.Vararg; void main() { {int a = byVal1(3);} diff --git a/test/classes.d b/test/classes.d index a4e7bb5c..5acdd4c4 100644 --- a/test/classes.d +++ b/test/classes.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + class C { int i; diff --git a/test/classes11.d b/test/classes11.d index 91d5733a..b31347d5 100644 --- a/test/classes11.d +++ b/test/classes11.d @@ -1,4 +1,5 @@ module classes11; +extern(C) int printf(char*, ...); void main() { diff --git a/test/classes2.d b/test/classes2.d index 1417f344..65039c4a 100644 --- a/test/classes2.d +++ b/test/classes2.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + class A { int i; diff --git a/test/classes4.d b/test/classes4.d index 1eb76daf..dcbd54e8 100644 --- a/test/classes4.d +++ b/test/classes4.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + class A { int i = 42; diff --git a/test/classes5.d b/test/classes5.d index ce333048..0b06bbf9 100644 --- a/test/classes5.d +++ b/test/classes5.d @@ -1,4 +1,5 @@ module classes5; +extern(C) int printf(char*, ...); struct S { diff --git a/test/classes6.d b/test/classes6.d index 32cf5757..b224c49e 100644 --- a/test/classes6.d +++ b/test/classes6.d @@ -1,4 +1,5 @@ module classes6; +extern(C) int printf(char*, ...); class C { diff --git a/test/classinfo1.d b/test/classinfo1.d index 285dd65f..a5dd90ef 100644 --- a/test/classinfo1.d +++ b/test/classinfo1.d @@ -1,5 +1,7 @@ module classinfo1; +extern(C) int printf(char*, ...); + class NoPtrs { } diff --git a/test/cond.d b/test/cond.d index 0034def4..2f14a737 100644 --- a/test/cond.d +++ b/test/cond.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + version=AndAnd; version=OrOr; diff --git a/test/dgs.d b/test/dgs.d index e58dbd29..76917f89 100644 --- a/test/dgs.d +++ b/test/dgs.d @@ -1,3 +1,6 @@ + +extern(C) int printf(char*, ...); + struct S { int i; diff --git a/test/dotproduct.d b/test/dotproduct.d index 4f4a3d95..ad171290 100644 --- a/test/dotproduct.d +++ b/test/dotproduct.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + struct vec3 { float x,y,z; diff --git a/test/e.d b/test/e.d index 31c571b9..075f0ba0 100644 --- a/test/e.d +++ b/test/e.d @@ -1,5 +1,7 @@ module e; +extern(C) int printf(char*, ...); + struct C { float x=0,y=0; diff --git a/test/floatcmp.d b/test/floatcmp.d index 24523dae..306bdb35 100644 --- a/test/floatcmp.d +++ b/test/floatcmp.d @@ -1,4 +1,5 @@ module floatcmp; +extern(C) int printf(char*, ...); void eq() { diff --git a/test/foreach1.d b/test/foreach1.d index 72df208c..7349c907 100644 --- a/test/foreach1.d +++ b/test/foreach1.d @@ -1,17 +1,17 @@ module foreach1; -import std.stdio; +extern(C) int printf(char*, ...); void main() { static arr = [1,2,3,4,5]; - writef("forward"); + printf("forward"); foreach(v;arr) { - writef(' ',v); + printf(" %d",v); } - writef("\nreverse"); + printf("\nreverse"); foreach_reverse(v;arr) { - writef(' ',v); + printf(" %d",v); } - writef("\n"); + printf("\n"); } diff --git a/test/foreach2.d b/test/foreach2.d index c5d95342..ee008e9c 100644 --- a/test/foreach2.d +++ b/test/foreach2.d @@ -1,5 +1,5 @@ module foreach2; - +extern(C) int printf(char*, ...); void main() { static arr = [1.0, 2.0, 4.0, 8.0, 16.0]; diff --git a/test/foreach3.d b/test/foreach3.d index 5cf460d9..8f2fd1f8 100644 --- a/test/foreach3.d +++ b/test/foreach3.d @@ -1,5 +1,5 @@ module foreach3; - +extern(C) int printf(char*, ...); void main() { static str = ['h','e','l','l','o']; diff --git a/test/foreach4.d b/test/foreach4.d index 9f91f13f..d5f6105f 100644 --- a/test/foreach4.d +++ b/test/foreach4.d @@ -1,5 +1,5 @@ module foreach4; - +extern(C) int printf(char*, ...); void main() { int[] arr = new int[4]; diff --git a/test/foreach5.d b/test/foreach5.d index 4509cde1..fb4ddf75 100644 --- a/test/foreach5.d +++ b/test/foreach5.d @@ -1,5 +1,5 @@ module foreach5; - +extern(C) int printf(char*, ...); void main() { int[3] arr = [1,2,3]; diff --git a/test/funcptr.d b/test/funcptr.d index cd291a46..7006ded0 100644 --- a/test/funcptr.d +++ b/test/funcptr.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + int return_six() { return 6; diff --git a/test/funcs.d b/test/funcs.d index 5606342c..faf000c9 100644 --- a/test/funcs.d +++ b/test/funcs.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + void main() { printf("Testing functions\n"); diff --git a/test/g.d b/test/g.d index f7e1ff74..47932a90 100644 --- a/test/g.d +++ b/test/g.d @@ -1,5 +1,7 @@ module g; +extern(C) int printf(char*, ...); + void func(char[] str) { printf("%.*s\n", str.length, str.ptr); diff --git a/test/globals1.d b/test/globals1.d index 2732c753..35e9c7ab 100644 --- a/test/globals1.d +++ b/test/globals1.d @@ -1,4 +1,5 @@ module globals1; +extern(C) int printf(char*, ...); char[] gstr = "hello world"; diff --git a/test/innerclass1.d b/test/innerclass1.d index 6e72d245..0633753c 100644 --- a/test/innerclass1.d +++ b/test/innerclass1.d @@ -1,4 +1,5 @@ module innerclass1; +extern(C) int printf(char*, ...); class Outer { diff --git a/test/mainargs1.d b/test/mainargs1.d index 23522f53..5f9f56db 100644 --- a/test/mainargs1.d +++ b/test/mainargs1.d @@ -2,7 +2,7 @@ module mainargs1; extern(C) int printf(char*,...); -void main(string[] args) +void main(char[][] args) { foreach(v; args) { diff --git a/test/moduleinfo1.d b/test/moduleinfo1.d index 04ba4555..f807f133 100644 --- a/test/moduleinfo1.d +++ b/test/moduleinfo1.d @@ -1,8 +1,5 @@ module moduleinfo1; -// has static this -import std.outofmemory; - static this() { } diff --git a/test/moduleinfo2.d b/test/moduleinfo2.d index 5b3f58c2..831478a5 100644 --- a/test/moduleinfo2.d +++ b/test/moduleinfo2.d @@ -1,12 +1,14 @@ module moduleinfo2; -import std.stdio; + +extern(C) int printf(char*, ...); + void main() { ModuleInfo[] mi = ModuleInfo.modules(); - writefln("listing ",mi.length," modules"); + printf("listing %u modules:\n"); foreach(m; mi) { - writefln(" ",m.name); + printf(" %s\n", m.name.length, m.name.ptr); } assert(mi.length > 50); } diff --git a/test/multiarr4.d b/test/multiarr4.d index ba17ca86..e6e39094 100644 --- a/test/multiarr4.d +++ b/test/multiarr4.d @@ -1,4 +1,5 @@ module multiarr4; +extern(C) int printf(char*, ...); void main() { diff --git a/test/nested5.d b/test/nested5.d index 6fc08eb0..47881999 100644 --- a/test/nested5.d +++ b/test/nested5.d @@ -1,4 +1,5 @@ module nested5; +extern(C) int printf(char*, ...); void main() { diff --git a/test/nested6.d b/test/nested6.d index 5881a406..59c800c2 100644 --- a/test/nested6.d +++ b/test/nested6.d @@ -1,4 +1,5 @@ module nested6; +extern(C) int printf(char*, ...); void main() { diff --git a/test/nested7.d b/test/nested7.d index 8e65fd7b..2b8ca728 100644 --- a/test/nested7.d +++ b/test/nested7.d @@ -1,4 +1,5 @@ module nested7; +extern(C) int printf(char*, ...); void main() { diff --git a/test/nested8.d b/test/nested8.d index 16dde7ce..681c093b 100644 --- a/test/nested8.d +++ b/test/nested8.d @@ -1,4 +1,5 @@ module nested8; +extern(C) int printf(char*, ...); void main() { diff --git a/test/nested9.d b/test/nested9.d index 69506eac..e0a21ff8 100644 --- a/test/nested9.d +++ b/test/nested9.d @@ -1,4 +1,5 @@ module nested9; +extern(C) int printf(char*, ...); void main() { diff --git a/test/pt.d b/test/pt.d index e9669f05..e202252e 100644 --- a/test/pt.d +++ b/test/pt.d @@ -1,3 +1,6 @@ + +extern(C) int printf(char*, ...); + int main() { char[16] s = void; diff --git a/test/ptrarith.d b/test/ptrarith.d index db75be5e..85bbfeb6 100644 --- a/test/ptrarith.d +++ b/test/ptrarith.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + void main() { printf("Pointer arithmetic test\n"); diff --git a/test/scope1.d b/test/scope1.d index c74670ed..236126ff 100644 --- a/test/scope1.d +++ b/test/scope1.d @@ -1,5 +1,5 @@ module scope1; - +extern(C) int printf(char*, ...); void main() { printf("1\n"); diff --git a/test/scope2.d b/test/scope2.d index 7db93aa7..a1e49395 100644 --- a/test/scope2.d +++ b/test/scope2.d @@ -1,5 +1,5 @@ module scope2; - +extern(C) int printf(char*, ...); void main() { scope(exit) printf("exit\n"); diff --git a/test/scope3.d b/test/scope3.d index 6810c1cf..e054fed7 100644 --- a/test/scope3.d +++ b/test/scope3.d @@ -1,5 +1,5 @@ module scope3; - +extern(C) int printf(char*, ...); void main() { int i; diff --git a/test/sieve.d b/test/sieve.d index 73f3ca81..fdb0743d 100644 --- a/test/sieve.d +++ b/test/sieve.d @@ -1,5 +1,7 @@ /* Eratosthenes Sieve prime number calculation. */ +extern(C) int printf(char*, ...); + bool flags[8191]; int main() diff --git a/test/sqrts.d b/test/sqrts.d index 488a3a38..920c85ce 100644 --- a/test/sqrts.d +++ b/test/sqrts.d @@ -1,6 +1,6 @@ module sqrts; -import std.c.math; +import tango.stdc.math; double sqrt(double d) { diff --git a/test/static_ctor.d b/test/static_ctor.d index dc6d855b..7a2af363 100644 --- a/test/static_ctor.d +++ b/test/static_ctor.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + static this() { printf("static this\n"); diff --git a/test/staticarrays.d b/test/staticarrays.d index 31a20939..5de4decd 100644 --- a/test/staticarrays.d +++ b/test/staticarrays.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + void numbers() { bool[8] bools; diff --git a/test/strings1.d b/test/strings1.d index 17e77765..1c1e721e 100644 --- a/test/strings1.d +++ b/test/strings1.d @@ -1,5 +1,5 @@ module strings1; - +extern(C) int printf(char*, ...); void f(char[11] buffer) { printf("%.*s\n", buffer.length, buffer.ptr); diff --git a/test/switch2.d b/test/switch2.d index 59e8b4e5..b11d18a9 100644 --- a/test/switch2.d +++ b/test/switch2.d @@ -1,4 +1,5 @@ module switch2; +extern(C) int printf(char*, ...); void main() { diff --git a/test/switch3.d b/test/switch3.d index d91c5b59..0a745f27 100644 --- a/test/switch3.d +++ b/test/switch3.d @@ -1,4 +1,5 @@ module switch3; +extern(C) int printf(char*, ...); void main() { diff --git a/test/typeinfo.d b/test/typeinfo.d index 8912a74f..30755f48 100644 --- a/test/typeinfo.d +++ b/test/typeinfo.d @@ -1,4 +1,5 @@ module typeinfo; +extern(C) int printf(char*, ...); void main() { diff --git a/test/typeinfo7.d b/test/typeinfo7.d index b0d8d919..12cd3574 100644 --- a/test/typeinfo7.d +++ b/test/typeinfo7.d @@ -1,5 +1,5 @@ module typeinfo7; - +extern(C) int printf(char*, ...); int func(long) { return 0; diff --git a/test/typeinfo8.d b/test/typeinfo8.d index d38af27f..eebe4c88 100644 --- a/test/typeinfo8.d +++ b/test/typeinfo8.d @@ -1,5 +1,5 @@ module typeinfo8; - +extern(C) int printf(char*, ...); struct S { void func() diff --git a/test/unrolled.d b/test/unrolled.d index 17e0df56..84122e6f 100644 --- a/test/unrolled.d +++ b/test/unrolled.d @@ -1,5 +1,7 @@ module unrolled; +extern(C) int printf(char*, ...); + void test(T...)(T t) { foreach (value; t) { printf("%d\n", value); diff --git a/test/v2d.d b/test/v2d.d index cf78fd1a..366a11f3 100644 --- a/test/v2d.d +++ b/test/v2d.d @@ -1,3 +1,5 @@ +extern(C) int printf(char*, ...); + struct V2D(T) { T x,y; diff --git a/test/vararg1.d b/test/vararg1.d index 5ae8837c..c5477285 100644 --- a/test/vararg1.d +++ b/test/vararg1.d @@ -1,6 +1,6 @@ module vararg1; -import std.c.stdarg; +import tango.stdc.stdarg; extern(C) int add(int n, ...) { diff --git a/test/vararg3.d b/test/vararg3.d index 84306d35..72d65a76 100644 --- a/test/vararg3.d +++ b/test/vararg3.d @@ -1,6 +1,6 @@ module vararg3; -import std.stdarg; +import tango.core.Vararg; void func(...) { diff --git a/test/vararg4.d b/test/vararg4.d index 910bc998..6c3210c2 100644 --- a/test/vararg4.d +++ b/test/vararg4.d @@ -1,5 +1,5 @@ module vararg4; -import std.stdarg; +import tango.core.Vararg; void vafunc(...) { diff --git a/test/vararg5.d b/test/vararg5.d index 0f377e81..9f74e34b 100644 --- a/test/vararg5.d +++ b/test/vararg5.d @@ -1,5 +1,5 @@ module vararg5; -import std.stdarg; +import tango.core.Vararg; void func(...) { char[] str = va_arg!(char[])(_argptr); diff --git a/test/virtcall.d b/test/virtcall.d index 01741512..7ccdeb91 100644 --- a/test/virtcall.d +++ b/test/virtcall.d @@ -1,5 +1,7 @@ module virtcall; +extern(C) int printf(char*, ...); + class C { override char[] toString()