Mercurial > projects > ldc
diff dmd/attrib.c @ 445:cc40db549aea
Changed the handling of variadic intrinsics a bit.
Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues.
Changed the handling of parameter attributes to a bit more generalized approach.
Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 .
Parameter attribs now properly set for intrinsic calls if necessary.
Made the tango.math.Math patch less intrusive.
Fixed/added some mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 17:59:58 +0200 |
parents | 44f08170f4ef |
children | a34078905d01 |
line wrap: on
line diff
--- a/dmd/attrib.c Fri Aug 01 01:12:33 2008 +0200 +++ b/dmd/attrib.c Fri Aug 01 17:59:58 2008 +0200 @@ -831,7 +831,7 @@ // LLVMDC #if IN_LLVM - // pragma(intrinsic, dotExpS) { funcdecl(s) } + // pragma(intrinsic, string) { funcdecl(s) } else if (ident == Id::intrinsic) { Expression* expr = (Expression *)args->data[0]; @@ -844,19 +844,6 @@ llvm_internal = LLVMintrinsic; } - // pragma(va_intrinsic, dotExpS) { funcdecl(s) } - else if (ident == Id::va_intrinsic) - { - Expression* expr = (Expression *)args->data[0]; - expr = expr->semantic(sc); - if (!args || args->dim != 1 || !parseStringExp(expr, arg1str)) - { - error("pragma va_intrinsic requires exactly 1 string literal parameter"); - fatal(); - } - llvm_internal = LLVMva_intrinsic; - } - // pragma(notypeinfo) { typedecl(s) } else if (ident == Id::no_typeinfo) { @@ -880,7 +867,7 @@ } // pragma(alloca) { funcdecl(s) } - else if (ident == Id::alloca) + else if (ident == Id::Alloca) { if (args && args->dim > 0) { @@ -891,7 +878,7 @@ } // pragma(va_start) { templdecl(s) } - else if (ident == Id::va_start) + else if (ident == Id::vastart) { if (args && args->dim > 0) { @@ -901,8 +888,30 @@ llvm_internal = LLVMva_start; } + // pragma(va_copy) { funcdecl(s) } + else if (ident == Id::vacopy) + { + if (args && args->dim > 0) + { + error("pragma va_copy takes no parameters"); + fatal(); + } + llvm_internal = LLVMva_copy; + } + + // pragma(va_end) { funcdecl(s) } + else if (ident == Id::vaend) + { + if (args && args->dim > 0) + { + error("pragma va_end takes no parameters"); + fatal(); + } + llvm_internal = LLVMva_end; + } + // pragma(va_arg) { templdecl(s) } - else if (ident == Id::va_arg) + else if (ident == Id::vaarg) { if (args && args->dim > 0) { @@ -959,13 +968,12 @@ { if (s->llvmInternal) { - error("multiple LLVMDC specific pragmas not allowed not affect the same declaration (%s at '%s')", s->toChars(), s->loc.toChars()); + error("multiple LLVMDC specific pragmas not allowed not affect the same declaration ('%s' at '%s')", s->toChars(), s->loc.toChars()); fatal(); } switch(llvm_internal) { case LLVMintrinsic: - case LLVMva_intrinsic: if (FuncDeclaration* fd = s->isFuncDeclaration()) { fd->llvmInternal = llvm_internal; @@ -973,7 +981,7 @@ } else { - error("intrinsic pragmas are only allowed to affect function declarations"); + error("the intrinsic pragma is only allowed on function declarations"); fatal(); } break; @@ -984,24 +992,37 @@ { if (td->parameters->dim != 1) { - error("the %s pragma template must have exactly one template parameter", ident->toChars()); + error("the '%s' pragma template must have exactly one template parameter", ident->toChars()); fatal(); } else if (!td->onemember) { - error("the %s pragma template must have exactly one member", ident->toChars()); + error("the '%s' pragma template must have exactly one member", ident->toChars()); fatal(); } else if (td->overnext || td->overroot) { - error("the %s pragma template must not be overloaded", ident->toChars()); + error("the '%s' pragma template must not be overloaded", ident->toChars()); fatal(); } td->llvmInternal = llvm_internal; } else { - error("the %s pragma is only allowed on template declarations", ident->toChars()); + error("the '%s' pragma is only allowed on template declarations", ident->toChars()); + fatal(); + } + break; + + case LLVMva_copy: + case LLVMva_end: + if (FuncDeclaration* fd = s->isFuncDeclaration()) + { + fd->llvmInternal = llvm_internal; + } + else + { + error("the '%s' pragma is only allowed on function declarations", ident->toChars()); fatal(); } break; @@ -1017,13 +1038,13 @@ } else { - error("the %s pragma must only be used on function declarations of type 'void* function(uint nbytes)'", ident->toChars()); + error("the '%s' pragma must only be used on function declarations of type 'void* function(uint nbytes)'", ident->toChars()); fatal(); } break; default: - warning("LLVMDC specific pragma %s not yet implemented, ignoring", ident->toChars()); + warning("the LLVMDC specific pragma '%s' is not yet implemented, ignoring", ident->toChars()); } }