Mercurial > projects > ldc
comparison dmd2/statement.c @ 1578:1dee66f6ec0b
Removed a chunk of code in favour of a shorter and more portable method
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 08 Sep 2009 11:21:30 +0100 |
parents | e4f7b5d9c68a |
children | d8e558087001 |
comparison
equal
deleted
inserted
replaced
1577:e4f7b5d9c68a | 1578:1dee66f6ec0b |
---|---|
3899 | 3899 |
3900 Statements *cs = new Statements(); | 3900 Statements *cs = new Statements(); |
3901 cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp))); | 3901 cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp))); |
3902 | 3902 |
3903 #if IN_LLVM | 3903 #if IN_LLVM |
3904 // LDC: Build args (based on the code from gen/tollvm.cpp:DtoMutexType() | 3904 // LDC: Build args |
3905 Arguments* args = new Arguments; | 3905 Arguments* args = new Arguments; |
3906 StructDeclaration* dcs = new StructDeclaration(loc, id); | 3906 args->push(new Argument(STCin, t->pointerTo(), NULL, NULL)); |
3907 if (global.params.os == OSWindows) | |
3908 { | |
3909 dcs->addField(dcs->scope, new VarDeclaration(loc, Type::tint32, id, NULL)); | |
3910 } | |
3911 else if (global.params.os == OSFreeBSD) | |
3912 { | |
3913 dcs->addField(dcs->scope, new VarDeclaration(loc, Type::tsize_t, id, NULL)); | |
3914 } | |
3915 else | |
3916 { | |
3917 // pthread_fastlock | |
3918 StructDeclaration* pfl = new StructDeclaration(loc, id); | |
3919 pfl->scope->linkage = LINKc; | |
3920 pfl->addField(pfl->scope, new VarDeclaration(loc, Type::tsize_t, id, NULL)); | |
3921 pfl->addField(pfl->scope, new VarDeclaration(loc, Type::tint32, id, NULL)); | |
3922 | |
3923 // pthread_mutex | |
3924 StructDeclaration* pm = new StructDeclaration(loc, id); | |
3925 pm->scope->linkage = LINKc; | |
3926 pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL)); | |
3927 pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL)); | |
3928 pm->addField(pm->scope, new VarDeclaration(loc, Type::tvoidptr, id, NULL)); | |
3929 pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL)); | |
3930 pm->addField(pm->scope, new VarDeclaration(loc, pfl->type, id, NULL)); | |
3931 | |
3932 // D_CRITICAL_SECTION | |
3933 dcs->scope->linkage = LINKc; | |
3934 dcs->addField(dcs->scope, new VarDeclaration(loc, dcs->type->pointerTo(), id, NULL)); | |
3935 dcs->addField(dcs->scope, new VarDeclaration(loc, pm->type, id, NULL)); | |
3936 } | |
3937 args->push(new Argument(STCin, dcs->type->pointerTo(), NULL, NULL)); | |
3938 | 3907 |
3939 FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalenter); | 3908 FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalenter); |
3940 #else | 3909 #else |
3941 FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalenter); | 3910 FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalenter); |
3942 #endif | 3911 #endif |