mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
This commit is contained in:
parent
58ef63417f
commit
2616261fd2
33 changed files with 224 additions and 219 deletions
|
@ -170,7 +170,7 @@ namespace ldc {
|
||||||
CodeGenerator::CodeGenerator(llvm::LLVMContext &context, bool singleObj)
|
CodeGenerator::CodeGenerator(llvm::LLVMContext &context, bool singleObj)
|
||||||
: context_(context), moduleCount_(0), singleObj_(singleObj), ir_(nullptr) {
|
: context_(context), moduleCount_(0), singleObj_(singleObj), ir_(nullptr) {
|
||||||
if (!ClassDeclaration::object) {
|
if (!ClassDeclaration::object) {
|
||||||
error(Loc(), "declaration for class Object not found; druntime not "
|
error(Loc(), "declaration for class `Object` not found; druntime not "
|
||||||
"configured properly");
|
"configured properly");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,11 +534,9 @@ void parseCommandLine(int argc, char **argv, Strings &sourceFiles,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noDefaultLib) {
|
if (noDefaultLib) {
|
||||||
deprecation(
|
deprecation(Loc(), "-nodefaultlib is deprecated, as -defaultlib/-debuglib "
|
||||||
Loc(),
|
"now override the existing list instead of appending to "
|
||||||
"-nodefaultlib is deprecated, as "
|
"it. Please use the latter instead.");
|
||||||
"-defaultlib/-debuglib now override the existing list instead of "
|
|
||||||
"appending to it. Please use the latter instead.");
|
|
||||||
} else {
|
} else {
|
||||||
// Parse comma-separated default library list.
|
// Parse comma-separated default library list.
|
||||||
std::stringstream libNames(linkDebugLib ? debugLib : defaultLib);
|
std::stringstream libNames(linkDebugLib ? debugLib : defaultLib);
|
||||||
|
|
|
@ -269,7 +269,7 @@ bool setupMsvcEnvironmentImpl() {
|
||||||
|
|
||||||
const int exitCode = executeAndWait(commandLine.c_str());
|
const int exitCode = executeAndWait(commandLine.c_str());
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
error(Loc(), "`%s` failed with status: %d", commandLine.c_str(), exitCode);
|
error(Loc(), "'%s' failed with status: %d", commandLine.c_str(), exitCode);
|
||||||
llvm::sys::fs::remove(tmpFilePath);
|
llvm::sys::fs::remove(tmpFilePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ DValue *DtoCastArray(Loc &loc, DValue *u, Type *to) {
|
||||||
Type *totype = to->toBasetype();
|
Type *totype = to->toBasetype();
|
||||||
Type *fromtype = u->type->toBasetype();
|
Type *fromtype = u->type->toBasetype();
|
||||||
if (fromtype->ty != Tarray && fromtype->ty != Tsarray) {
|
if (fromtype->ty != Tarray && fromtype->ty != Tsarray) {
|
||||||
error(loc, "can't cast %s to %s", u->type->toChars(), to->toChars());
|
error(loc, "can't cast `%s` to `%s`", u->type->toChars(), to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1297,7 +1297,7 @@ DValue *DtoCastArray(Loc &loc, DValue *u, Type *to) {
|
||||||
totype->nextOf()->size() !=
|
totype->nextOf()->size() !=
|
||||||
0) {
|
0) {
|
||||||
error(loc,
|
error(loc,
|
||||||
"invalid cast from '%s' to '%s', the element sizes don't line up",
|
"invalid cast from `%s` to `%s`, the element sizes don't line up",
|
||||||
fromtype->toChars(), totype->toChars());
|
fromtype->toChars(), totype->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ struct AsmProcessor {
|
||||||
}
|
}
|
||||||
} while (i != j);
|
} while (i != j);
|
||||||
|
|
||||||
stmt->error("unknown opcode '%s'", opcode);
|
stmt->error("unknown opcode `%s`", opcode);
|
||||||
|
|
||||||
return Op_Invalid;
|
return Op_Invalid;
|
||||||
}
|
}
|
||||||
|
@ -2237,7 +2237,7 @@ struct AsmProcessor {
|
||||||
if (token->value == TOKcomma) {
|
if (token->value == TOKcomma) {
|
||||||
nextToken();
|
nextToken();
|
||||||
} else if (token->value != TOKeof) {
|
} else if (token->value != TOKeof) {
|
||||||
stmt->error("end of instruction expected, not '%s'", token->toChars());
|
stmt->error("end of instruction expected, not `%s`", token->toChars());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2339,7 +2339,7 @@ struct AsmProcessor {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Arg_Pointer:
|
case Arg_Pointer:
|
||||||
stmt->error("unsupported pointer reference to '%s' in naked asm",
|
stmt->error("unsupported pointer reference to `%s` in naked asm",
|
||||||
e->toChars());
|
e->toChars());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2369,7 +2369,7 @@ struct AsmProcessor {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stmt->error("unsupported memory reference to '%s' in naked asm",
|
stmt->error("unsupported memory reference to `%s` in naked asm",
|
||||||
e->toChars());
|
e->toChars());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2593,7 +2593,7 @@ struct AsmProcessor {
|
||||||
if (operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST) {
|
if (operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST) {
|
||||||
nOperands = 1;
|
nOperands = 1;
|
||||||
} else {
|
} else {
|
||||||
stmt->error("instruction allows only ST as second argument");
|
stmt->error("instruction allows only `ST` as second argument");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3298,7 +3298,7 @@ struct AsmProcessor {
|
||||||
e = e->semantic(sc);
|
e = e->semantic(sc);
|
||||||
return e->ctfeInterpret();
|
return e->ctfeInterpret();
|
||||||
}
|
}
|
||||||
stmt->error("expected integer operand(s) for '%s'", Token::toChars(op));
|
stmt->error("expected integer operand(s) for `%s`", Token::toChars(op));
|
||||||
return newIntExp(0);
|
return newIntExp(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3598,7 +3598,7 @@ struct AsmProcessor {
|
||||||
if (token->value == TOKrbracket) {
|
if (token->value == TOKrbracket) {
|
||||||
nextToken();
|
nextToken();
|
||||||
} else {
|
} else {
|
||||||
stmt->error("missing ']'");
|
stmt->error("missing `]`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3654,7 +3654,7 @@ struct AsmProcessor {
|
||||||
stmt->error("multiple specifications of operand size");
|
stmt->error("multiple specifications of operand size");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stmt->error("unknown operand size '%s'", token->toChars());
|
stmt->error("unknown operand size `%s`", token->toChars());
|
||||||
}
|
}
|
||||||
nextToken();
|
nextToken();
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -3666,11 +3666,11 @@ struct AsmProcessor {
|
||||||
case TOKidentifier:
|
case TOKidentifier:
|
||||||
if (token->ident == ident_seg) {
|
if (token->ident == ident_seg) {
|
||||||
nextToken();
|
nextToken();
|
||||||
stmt->error("'seg' not supported");
|
stmt->error("`seg` not supported");
|
||||||
e = parseAsmExp();
|
e = parseAsmExp();
|
||||||
} else if (token->ident == Id::offset || token->ident == Id::offsetof) {
|
} else if (token->ident == Id::offset || token->ident == Id::offsetof) {
|
||||||
if (token->ident == Id::offset && !global.params.useDeprecated) {
|
if (token->ident == Id::offset && !global.params.useDeprecated) {
|
||||||
stmt->error("offset deprecated, use offsetof");
|
stmt->error("offset deprecated, use `offsetof`");
|
||||||
}
|
}
|
||||||
nextToken();
|
nextToken();
|
||||||
e = parseAsmExp();
|
e = parseAsmExp();
|
||||||
|
@ -3779,7 +3779,7 @@ struct AsmProcessor {
|
||||||
if (token->value == TOKrparen) {
|
if (token->value == TOKrparen) {
|
||||||
nextToken();
|
nextToken();
|
||||||
} else {
|
} else {
|
||||||
stmt->error("expected ')'");
|
stmt->error("expected `)`");
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
default:
|
default:
|
||||||
|
@ -3795,7 +3795,7 @@ struct AsmProcessor {
|
||||||
} else if (i >= Reg_CS && i <= Reg_GS) {
|
} else if (i >= Reg_CS && i <= Reg_GS) {
|
||||||
operand->segmentPrefix = static_cast<Reg>(i);
|
operand->segmentPrefix = static_cast<Reg>(i);
|
||||||
} else {
|
} else {
|
||||||
stmt->error("'%s' is not a segment register", ident->toChars());
|
stmt->error("`%s` is not a segment register", ident->toChars());
|
||||||
}
|
}
|
||||||
return parseAsmExp();
|
return parseAsmExp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,7 +563,7 @@ LLConstant *DtoDefineClassInfo(ClassDeclaration *cd) {
|
||||||
ClassDeclaration *cinfo = Type::typeinfoclass;
|
ClassDeclaration *cinfo = Type::typeinfoclass;
|
||||||
|
|
||||||
if (cinfo->fields.dim != 12) {
|
if (cinfo->fields.dim != 12) {
|
||||||
error(Loc(), "Unexpected number of fields in object.ClassInfo; "
|
error(Loc(), "Unexpected number of fields in `object.ClassInfo`; "
|
||||||
"druntime version does not match compiler (see -v)");
|
"druntime version does not match compiler (see -v)");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,6 +497,7 @@ DValue *DtoCastComplex(Loc &loc, DValue *val, Type *_to) {
|
||||||
auto re = new DImValue(extractty, repart);
|
auto re = new DImValue(extractty, repart);
|
||||||
return DtoCastFloat(loc, re, to);
|
return DtoCastFloat(loc, re, to);
|
||||||
}
|
}
|
||||||
error(loc, "Don't know how to cast %s to %s", vty->toChars(), to->toChars());
|
error(loc, "Don't know how to cast `%s` to `%s`", vty->toChars(),
|
||||||
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ llvm::FunctionType *DtoFunctionType(FuncDeclaration *fdecl) {
|
||||||
if (fdecl->selector) {
|
if (fdecl->selector) {
|
||||||
hasSel = true;
|
hasSel = true;
|
||||||
} else if (fdecl->parent->isClassDeclaration()) {
|
} else if (fdecl->parent->isClassDeclaration()) {
|
||||||
fdecl->error("Objective-C @selector is missing");
|
fdecl->error("Objective-C `@selector` is missing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void DtoResolveFunction(FuncDeclaration *fdecl) {
|
||||||
TypeFunction *tf = static_cast<TypeFunction *>(fdecl->type);
|
TypeFunction *tf = static_cast<TypeFunction *>(fdecl->type);
|
||||||
if (tf->varargs != 1 ||
|
if (tf->varargs != 1 ||
|
||||||
(fdecl->parameters && fdecl->parameters->dim != 0)) {
|
(fdecl->parameters && fdecl->parameters->dim != 0)) {
|
||||||
tempdecl->error("invalid __asm declaration, must be a D style "
|
tempdecl->error("invalid `__asm` declaration, must be a D style "
|
||||||
"variadic with no explicit parameters");
|
"variadic with no explicit parameters");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
|
||||||
} else if (func->getFunctionType() != functype) {
|
} else if (func->getFunctionType() != functype) {
|
||||||
error(fdecl->loc,
|
error(fdecl->loc,
|
||||||
"Function type does not match previously declared "
|
"Function type does not match previously declared "
|
||||||
"function with the same mangled name: %s",
|
"function with the same mangled name: `%s`",
|
||||||
mangleExact(fdecl));
|
mangleExact(fdecl));
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
|
||||||
// Detect multiple main functions, which is disallowed. DMD checks this
|
// Detect multiple main functions, which is disallowed. DMD checks this
|
||||||
// in the glue code, so we need to do it here as well.
|
// in the glue code, so we need to do it here as well.
|
||||||
if (gIR->mainFunc) {
|
if (gIR->mainFunc) {
|
||||||
error(fdecl->loc, "only one main function allowed");
|
error(fdecl->loc, "only one `main` function allowed");
|
||||||
}
|
}
|
||||||
gIR->mainFunc = func;
|
gIR->mainFunc = func;
|
||||||
}
|
}
|
||||||
|
@ -812,7 +812,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
|
||||||
// the codegen expect irFunc to be set for defined functions.
|
// the codegen expect irFunc to be set for defined functions.
|
||||||
error(fd->loc,
|
error(fd->loc,
|
||||||
"Internal Compiler Error: function not fully analyzed; "
|
"Internal Compiler Error: function not fully analyzed; "
|
||||||
"previous unreported errors compiling %s?",
|
"previous unreported errors compiling `%s`?",
|
||||||
fd->toPrettyChars());
|
fd->toPrettyChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -885,7 +885,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
|
||||||
if (fd->semanticRun != PASSsemantic3done) {
|
if (fd->semanticRun != PASSsemantic3done) {
|
||||||
error(fd->loc,
|
error(fd->loc,
|
||||||
"Internal Compiler Error: function not fully analyzed; "
|
"Internal Compiler Error: function not fully analyzed; "
|
||||||
"previous unreported errors compiling %s?",
|
"previous unreported errors compiling `%s`?",
|
||||||
fd->toPrettyChars());
|
fd->toPrettyChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ DValue *DtoInlineIRExpr(Loc &loc, FuncDeclaration *fdecl,
|
||||||
// assert(ty);
|
// assert(ty);
|
||||||
if (!ty) {
|
if (!ty) {
|
||||||
error(tinst->loc, "All parameters of a template defined with pragma "
|
error(tinst->loc, "All parameters of a template defined with pragma "
|
||||||
"LDC_inline_ir, except for the first one, should be "
|
"`LDC_inline_ir`, except for the first one, should "
|
||||||
"types");
|
"be types");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
stream << *DtoType(ty);
|
stream << *DtoType(ty);
|
||||||
|
@ -117,12 +117,12 @@ DValue *DtoInlineIRExpr(Loc &loc, FuncDeclaration *fdecl,
|
||||||
|
|
||||||
std::string errstr = err.getMessage();
|
std::string errstr = err.getMessage();
|
||||||
if (!errstr.empty()) {
|
if (!errstr.empty()) {
|
||||||
error(
|
error(tinst->loc,
|
||||||
tinst->loc,
|
"can't parse inline LLVM IR:\n`%s`\n%s\n%s\nThe input string "
|
||||||
"can't parse inline LLVM IR:\n%s\n%s\n%s\nThe input string was: \n%s",
|
"was:\n`%s`",
|
||||||
err.getLineContents().str().c_str(),
|
err.getLineContents().str().c_str(),
|
||||||
(std::string(err.getColumnNo(), ' ') + '^').c_str(), errstr.c_str(),
|
(std::string(err.getColumnNo(), ' ') + '^').c_str(), errstr.c_str(),
|
||||||
stream.str().c_str());
|
stream.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
m->setDataLayout(gIR->module.getDataLayout());
|
m->setDataLayout(gIR->module.getDataLayout());
|
||||||
|
|
|
@ -296,7 +296,7 @@ void DtoGoto(Loc &loc, LabelDsymbol *target) {
|
||||||
|
|
||||||
LabelStatement *lblstmt = target->statement;
|
LabelStatement *lblstmt = target->statement;
|
||||||
if (!lblstmt) {
|
if (!lblstmt) {
|
||||||
error(loc, "the label %s does not exist", target->ident->toChars());
|
error(loc, "the label `%s` does not exist", target->ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ DValue *DtoNullValue(Type *type, Loc loc) {
|
||||||
LLValue *ptr = getNullPtr(DtoPtrToType(basetype->nextOf()));
|
LLValue *ptr = getNullPtr(DtoPtrToType(basetype->nextOf()));
|
||||||
return new DSliceValue(type, len, ptr);
|
return new DSliceValue(type, len, ptr);
|
||||||
}
|
}
|
||||||
error(loc, "null not known for type '%s'", type->toChars());
|
error(loc, "`null` not known for type `%s`", type->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ DValue *DtoCastInt(Loc &loc, DValue *val, Type *_to) {
|
||||||
IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n';
|
IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n';
|
||||||
rval = gIR->ir->CreateIntToPtr(rval, tolltype);
|
rval = gIR->ir->CreateIntToPtr(rval, tolltype);
|
||||||
} else {
|
} else {
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
_to->toChars());
|
_to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ DValue *DtoCastPtr(Loc &loc, DValue *val, Type *to) {
|
||||||
} else if (totype->isintegral()) {
|
} else if (totype->isintegral()) {
|
||||||
rval = new llvm::PtrToIntInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
rval = new llvm::PtrToIntInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
||||||
} else {
|
} else {
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) {
|
||||||
} else if (fromsz > tosz) {
|
} else if (fromsz > tosz) {
|
||||||
rval = new llvm::FPTruncInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
rval = new llvm::FPTruncInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
||||||
} else {
|
} else {
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) {
|
||||||
rval = new llvm::FPToSIInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
rval = new llvm::FPToSIInst(DtoRVal(val), tolltype, "", gIR->scopebb());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ DValue *DtoCastDelegate(Loc &loc, DValue *val, Type *to) {
|
||||||
return new DImValue(to,
|
return new DImValue(to,
|
||||||
DtoDelegateEquals(TOKnotequal, DtoRVal(val), nullptr));
|
DtoDelegateEquals(TOKnotequal, DtoRVal(val), nullptr));
|
||||||
}
|
}
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ DValue *DtoCastVector(Loc &loc, DValue *val, Type *to) {
|
||||||
if (totype->ty == Tvector && to->size() == val->type->size()) {
|
if (totype->ty == Tvector && to->size() == val->type->size()) {
|
||||||
return new DImValue(to, DtoBitCast(DtoRVal(val), tolltype));
|
return new DImValue(to, DtoBitCast(DtoRVal(val), tolltype));
|
||||||
}
|
}
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ DValue *DtoCastStruct(Loc &loc, DValue *val, Type *to) {
|
||||||
return new DLValue(to, result);
|
return new DLValue(to, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
error(loc, "Internal Compiler Error: Invalid struct cast from '%s' to '%s'",
|
error(loc, "Internal Compiler Error: Invalid struct cast from `%s` to `%s`",
|
||||||
val->type->toChars(), to->toChars());
|
val->type->toChars(), to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ DValue *DtoCast(Loc &loc, DValue *val, Type *to) {
|
||||||
}
|
}
|
||||||
// fall-through
|
// fall-through
|
||||||
default:
|
default:
|
||||||
error(loc, "invalid cast from '%s' to '%s'", val->type->toChars(),
|
error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(),
|
||||||
to->toChars());
|
to->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1243,8 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti,
|
||||||
|
|
||||||
char prefix = T->isreal() ? 'f' : T->isintegral() ? 'i' : 0;
|
char prefix = T->isreal() ? 'f' : T->isintegral() ? 'i' : 0;
|
||||||
if (!prefix) {
|
if (!prefix) {
|
||||||
ti->error("has invalid template parameter for intrinsic: %s", T->toChars());
|
ti->error("has invalid template parameter for intrinsic: `%s`",
|
||||||
|
T->toChars());
|
||||||
fatal(); // or LLVM asserts
|
fatal(); // or LLVM asserts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1269,13 +1270,13 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti,
|
||||||
} else {
|
} else {
|
||||||
if (pos && (name[pos - 1] == 'i' || name[pos - 1] == 'f')) {
|
if (pos && (name[pos - 1] == 'i' || name[pos - 1] == 'f')) {
|
||||||
// Wrong type character.
|
// Wrong type character.
|
||||||
ti->error(
|
ti->error("has invalid parameter type for intrinsic `%s`: `%s` is not "
|
||||||
"has invalid parameter type for intrinsic %s: %s is not a%s type",
|
"a%s type",
|
||||||
name.c_str(), T->toChars(),
|
name.c_str(), T->toChars(),
|
||||||
(name[pos - 1] == 'i' ? "n integral" : " floating-point"));
|
(name[pos - 1] == 'i' ? "n integral" : " floating-point"));
|
||||||
} else {
|
} else {
|
||||||
// Just plain wrong. (Error in declaration, not instantiation)
|
// Just plain wrong. (Error in declaration, not instantiation)
|
||||||
td->error("has an invalid intrinsic name: %s", name.c_str());
|
td->error("has an invalid intrinsic name: `%s`", name.c_str());
|
||||||
}
|
}
|
||||||
fatal(); // or LLVM asserts
|
fatal(); // or LLVM asserts
|
||||||
}
|
}
|
||||||
|
@ -1393,7 +1394,7 @@ void callPostblit(Loc &loc, Expression *exp, LLValue *val) {
|
||||||
FuncDeclaration *fd = sd->postblit;
|
FuncDeclaration *fd = sd->postblit;
|
||||||
if (fd->storage_class & STCdisable) {
|
if (fd->storage_class & STCdisable) {
|
||||||
fd->toParent()->error(
|
fd->toParent()->error(
|
||||||
loc, "is not copyable because it is annotated with @disable");
|
loc, "is not copyable because it is annotated with `@disable`");
|
||||||
}
|
}
|
||||||
DtoResolveFunction(fd);
|
DtoResolveFunction(fd);
|
||||||
Expressions args;
|
Expressions args;
|
||||||
|
@ -1518,7 +1519,7 @@ DValue *DtoSymbolAddress(Loc &loc, Type *type, Declaration *decl) {
|
||||||
|
|
||||||
// this is an error! must be accessed with DotVarExp
|
// this is an error! must be accessed with DotVarExp
|
||||||
if (vd->needThis()) {
|
if (vd->needThis()) {
|
||||||
error(loc, "need 'this' to access member %s", vd->toChars());
|
error(loc, "need `this` to access member `%s`", vd->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1648,7 +1649,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) {
|
||||||
// TODO: This check really does not belong here, should be moved to
|
// TODO: This check really does not belong here, should be moved to
|
||||||
// semantic analysis in the frontend.
|
// semantic analysis in the frontend.
|
||||||
if (decl->needThis()) {
|
if (decl->needThis()) {
|
||||||
error(loc, "need 'this' to access %s", decl->toChars());
|
error(loc, "need `this` to access `%s`", decl->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1660,7 +1661,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) {
|
||||||
// AssocArrayLiteralExp::toElem, which requires on error
|
// AssocArrayLiteralExp::toElem, which requires on error
|
||||||
// gagging to check for constantness of the initializer.
|
// gagging to check for constantness of the initializer.
|
||||||
error(loc,
|
error(loc,
|
||||||
"cannot use address of non-global variable '%s' as constant "
|
"cannot use address of non-global variable `%s` as constant "
|
||||||
"initializer",
|
"initializer",
|
||||||
vd->toChars());
|
vd->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
|
@ -1730,7 +1731,7 @@ llvm::GlobalVariable *getOrCreateGlobal(const Loc &loc, llvm::Module &module,
|
||||||
if (existing->getType()->getElementType() != type) {
|
if (existing->getType()->getElementType() != type) {
|
||||||
error(loc,
|
error(loc,
|
||||||
"Global variable type does not match previous declaration with "
|
"Global variable type does not match previous declaration with "
|
||||||
"same mangled name: %s",
|
"same mangled name: `%s`",
|
||||||
name.str().c_str());
|
name.str().c_str());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ llvm::Constant *buildLocalClasses(Module *m, size_t &count) {
|
||||||
|
|
||||||
llvm::GlobalVariable *genModuleInfo(Module *m) {
|
llvm::GlobalVariable *genModuleInfo(Module *m) {
|
||||||
if (!Module::moduleinfo) {
|
if (!Module::moduleinfo) {
|
||||||
m->error("object.d is missing the ModuleInfo struct");
|
m->error("object.d is missing the `ModuleInfo` struct");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ llvm::GlobalVariable *genModuleInfo(Module *m) {
|
||||||
// should consist only of the _flags/_index fields (the latter of which is
|
// should consist only of the _flags/_index fields (the latter of which is
|
||||||
// unused).
|
// unused).
|
||||||
if (Module::moduleinfo->structsize != 4 + 4) {
|
if (Module::moduleinfo->structsize != 4 + 4) {
|
||||||
m->error("Unexpected size of struct object.ModuleInfo; "
|
m->error("Unexpected size of struct `object.ModuleInfo`; "
|
||||||
"druntime version does not match compiler (see -v)");
|
"druntime version does not match compiler (see -v)");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,8 @@ void Module::checkAndAddOutputFile(File *file) {
|
||||||
if (i != files.end()) {
|
if (i != files.end()) {
|
||||||
Module *previousMod = i->second;
|
Module *previousMod = i->second;
|
||||||
::error(Loc(),
|
::error(Loc(),
|
||||||
"Output file '%s' for module '%s' collides with previous "
|
"Output file '%s' for module `%s` collides with previous "
|
||||||
"module '%s'. See the -oq option",
|
"module `%s`. See the -oq option",
|
||||||
key.c_str(), toPrettyChars(), previousMod->toPrettyChars());
|
key.c_str(), toPrettyChars(), previousMod->toPrettyChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ void loadInstrProfileData(IRState *irs) {
|
||||||
#if LDC_LLVM_VER >= 309
|
#if LDC_LLVM_VER >= 309
|
||||||
if (auto E = readerOrErr.takeError()) {
|
if (auto E = readerOrErr.takeError()) {
|
||||||
handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
|
handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
|
||||||
irs->dmodule->error("Could not read profile file %s: %s",
|
irs->dmodule->error("Could not read profile file '%s': %s",
|
||||||
global.params.datafileInstrProf,
|
global.params.datafileInstrProf,
|
||||||
EI.message().c_str());
|
EI.message().c_str());
|
||||||
});
|
});
|
||||||
|
@ -626,7 +626,7 @@ void loadInstrProfileData(IRState *irs) {
|
||||||
#else
|
#else
|
||||||
std::error_code EC = readerOrErr.getError();
|
std::error_code EC = readerOrErr.getError();
|
||||||
if (EC) {
|
if (EC) {
|
||||||
irs->dmodule->error("Could not read profile file %s: %s",
|
irs->dmodule->error("Could not read profile file '%s': %s",
|
||||||
global.params.datafileInstrProf,
|
global.params.datafileInstrProf,
|
||||||
EC.message().c_str());
|
EC.message().c_str());
|
||||||
fatal();
|
fatal();
|
||||||
|
|
|
@ -99,13 +99,13 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vd && !(vd->storage_class & (STCstatic | STCmanifest))) {
|
if (vd && !(vd->storage_class & (STCstatic | STCmanifest))) {
|
||||||
error(vd->loc, "non-static variable '%s' not allowed in naked function",
|
error(vd->loc, "non-static variable `%s` not allowed in naked function",
|
||||||
vd->toChars());
|
vd->toChars());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fd && !fd->isStatic()) {
|
if (fd && !fd->isStatic()) {
|
||||||
error(fd->loc,
|
error(fd->loc,
|
||||||
"non-static nested function '%s' not allowed in naked function",
|
"non-static nested function `%s` not allowed in naked function",
|
||||||
fd->toChars());
|
fd->toChars());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc &loc,
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
error(loc, "unimplemented return type '%s' for implicit abi return",
|
error(loc, "unimplemented return type `%s` for implicit abi return",
|
||||||
rt->toChars());
|
rt->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc &loc,
|
||||||
as->out_c = "={ax},={dx},";
|
as->out_c = "={ax},={dx},";
|
||||||
asmblock->retn = 2;
|
asmblock->retn = 2;
|
||||||
} else {
|
} else {
|
||||||
error(loc, "unimplemented return type '%s' for implicit abi return",
|
error(loc, "unimplemented return type `%s` for implicit abi return",
|
||||||
rt->toChars());
|
rt->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ DValue *DtoInlineAsmExpr(Loc &loc, FuncDeclaration *fd, Expressions *arguments,
|
||||||
IF_LOG Logger::println("code exp: %s", e->toChars());
|
IF_LOG Logger::println("code exp: %s", e->toChars());
|
||||||
StringExp *se = static_cast<StringExp *>(e);
|
StringExp *se = static_cast<StringExp *>(e);
|
||||||
if (e->op != TOKstring || se->sz != 1) {
|
if (e->op != TOKstring || se->sz != 1) {
|
||||||
e->error("__asm code argument is not a char[] string literal");
|
e->error("`__asm` code argument is not a `char[]` string literal");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
std::string code(se->toPtr(), se->numberOfCodeUnits());
|
std::string code(se->toPtr(), se->numberOfCodeUnits());
|
||||||
|
@ -425,7 +425,7 @@ DValue *DtoInlineAsmExpr(Loc &loc, FuncDeclaration *fd, Expressions *arguments,
|
||||||
IF_LOG Logger::println("constraint exp: %s", e->toChars());
|
IF_LOG Logger::println("constraint exp: %s", e->toChars());
|
||||||
se = static_cast<StringExp *>(e);
|
se = static_cast<StringExp *>(e);
|
||||||
if (e->op != TOKstring || se->sz != 1) {
|
if (e->op != TOKstring || se->sz != 1) {
|
||||||
e->error("__asm constraints argument is not a char[] string literal");
|
e->error("`__asm` constraints argument is not a `char[]` string literal");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
std::string constraints(se->toPtr(), se->numberOfCodeUnits());
|
std::string constraints(se->toPtr(), se->numberOfCodeUnits());
|
||||||
|
@ -450,7 +450,7 @@ DValue *DtoInlineAsmExpr(Loc &loc, FuncDeclaration *fd, Expressions *arguments,
|
||||||
|
|
||||||
// make sure the constraints are valid
|
// make sure the constraints are valid
|
||||||
if (!llvm::InlineAsm::Verify(FT, constraints)) {
|
if (!llvm::InlineAsm::Verify(FT, constraints)) {
|
||||||
e->error("__asm constraint argument is invalid");
|
e->error("`__asm` constraint argument is invalid");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||||||
fd = getParentFunc(fd);
|
fd = getParentFunc(fd);
|
||||||
}
|
}
|
||||||
if (!fd) {
|
if (!fd) {
|
||||||
error(loc, "function %s cannot access frame of function %s",
|
error(loc, "function `%s` cannot access frame of function `%s`",
|
||||||
irfunc->decl->toPrettyChars(), vdparent->toPrettyChars());
|
irfunc->decl->toPrettyChars(), vdparent->toPrettyChars());
|
||||||
return new DLValue(astype, llvm::UndefValue::get(DtoPtrToType(astype)));
|
return new DLValue(astype, llvm::UndefValue::get(DtoPtrToType(astype)));
|
||||||
}
|
}
|
||||||
|
@ -236,9 +236,10 @@ LLValue *DtoNestedContext(Loc &loc, Dsymbol *sym) {
|
||||||
// and we cannot provide one. Thus, it's invalid code that is
|
// and we cannot provide one. Thus, it's invalid code that is
|
||||||
// unfortunately not caught in the frontend (e.g. a function literal
|
// unfortunately not caught in the frontend (e.g. a function literal
|
||||||
// tries to call a nested function from the parent scope).
|
// tries to call a nested function from the parent scope).
|
||||||
error(loc,
|
error(
|
||||||
"function %s is a nested function and cannot be accessed from %s",
|
loc,
|
||||||
sym->toPrettyChars(), irFunc.decl->toPrettyChars());
|
"function `%s` is a nested function and cannot be accessed from `%s`",
|
||||||
|
sym->toPrettyChars(), irFunc.decl->toPrettyChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
return llvm::ConstantPointerNull::get(getVoidPtrType());
|
return llvm::ConstantPointerNull::get(getVoidPtrType());
|
||||||
|
|
|
@ -930,7 +930,7 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader,
|
||||||
"Ignoring profile data: hash mismatch for function: %s",
|
"Ignoring profile data: hash mismatch for function: %s",
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
warning(fd->loc,
|
warning(fd->loc,
|
||||||
"Ignoring profile data for function '%s' ('%s'): "
|
"Ignoring profile data for function `%s` (`%s`): "
|
||||||
"control-flow hash mismatch",
|
"control-flow hash mismatch",
|
||||||
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
|
@ -938,14 +938,14 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader,
|
||||||
IF_LOG Logger::println("Profile data is malformed for function: %s",
|
IF_LOG Logger::println("Profile data is malformed for function: %s",
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
warning(fd->loc,
|
warning(fd->loc,
|
||||||
"Ignoring profile data for function '%s' ('%s'): "
|
"Ignoring profile data for function `%s` (`%s`): "
|
||||||
"control-flow hash mismatch",
|
"control-flow hash mismatch",
|
||||||
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
} else {
|
} else {
|
||||||
IF_LOG Logger::println("Error loading profile counts for function: %s",
|
IF_LOG Logger::println("Error loading profile counts for function: %s",
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
warning(fd->loc, "Error loading profile data for function '%s' ('%s')",
|
warning(fd->loc, "Error loading profile data for function `%s` (`%s`)",
|
||||||
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
const_cast<FuncDeclaration *>(fd)->toPrettyChars(),
|
||||||
FuncName.c_str());
|
FuncName.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ LDCPragma DtoGetPragma(Scope *sc, PragmaDeclaration *decl,
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
if (priority > 65535) {
|
if (priority > 65535) {
|
||||||
error(Loc(), "priority may not be greater then 65535");
|
error(Loc(), "priority may not be greater than 65535");
|
||||||
priority = 65535;
|
priority = 65535;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -285,7 +285,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
if (s->llvmInternal) {
|
if (s->llvmInternal) {
|
||||||
error(Loc(),
|
error(Loc(),
|
||||||
"multiple LDC specific pragmas not allowed not affect the same "
|
"multiple LDC specific pragmas not allowed not affect the same "
|
||||||
"declaration ('%s' at '%s')",
|
"declaration (`%s` at '%s')",
|
||||||
s->toChars(), s->loc.toChars());
|
s->toChars(), s->loc.toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
td->llvmInternal = llvm_internal;
|
td->llvmInternal = llvm_internal;
|
||||||
td->intrinsicName = strdup(arg1str);
|
td->intrinsicName = strdup(arg1str);
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on function or template "
|
error(s->loc, "the `%s` pragma is only allowed on function or template "
|
||||||
"declarations",
|
"declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -317,8 +317,9 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
Type *retType = type->next;
|
Type *retType = type->next;
|
||||||
if (retType->ty != Tvoid || type->parameters->dim > 0 ||
|
if (retType->ty != Tvoid || type->parameters->dim > 0 ||
|
||||||
(fd->isMember() && !fd->isStatic())) {
|
(fd->isMember() && !fd->isStatic())) {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on void functions which "
|
error(s->loc,
|
||||||
"take no arguments",
|
"the `%s` pragma is only allowed on `void` functions which take "
|
||||||
|
"no arguments",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fd->llvmInternal = LLVMnone;
|
fd->llvmInternal = LLVMnone;
|
||||||
break;
|
break;
|
||||||
|
@ -327,7 +328,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
fd->llvmInternal = llvm_internal;
|
fd->llvmInternal = llvm_internal;
|
||||||
fd->priority = std::atoi(arg1str);
|
fd->priority = std::atoi(arg1str);
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on function declarations",
|
error(s->loc, "the `%s` pragma is only allowed on function declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
s->llvmInternal = LLVMnone;
|
s->llvmInternal = LLVMnone;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +339,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
td->llvmInternal = llvm_internal;
|
td->llvmInternal = llvm_internal;
|
||||||
td->intrinsicName = strdup(arg1str);
|
td->intrinsicName = strdup(arg1str);
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on template declarations",
|
error(s->loc, "the `%s` pragma is only allowed on template declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -353,21 +354,21 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
if (td->parameters->dim != 1) {
|
if (td->parameters->dim != 1) {
|
||||||
error(
|
error(
|
||||||
s->loc,
|
s->loc,
|
||||||
"the '%s' pragma template must have exactly one template parameter",
|
"the `%s` pragma template must have exactly one template parameter",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
} else if (!td->onemember) {
|
} else if (!td->onemember) {
|
||||||
error(s->loc, "the '%s' pragma template must have exactly one member",
|
error(s->loc, "the `%s` pragma template must have exactly one member",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
} else if (td->overnext || td->overroot) {
|
} else if (td->overnext || td->overroot) {
|
||||||
error(s->loc, "the '%s' pragma template must not be overloaded",
|
error(s->loc, "the `%s` pragma template must not be overloaded",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
td->llvmInternal = llvm_internal;
|
td->llvmInternal = llvm_internal;
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on template declarations",
|
error(s->loc, "the `%s` pragma is only allowed on template declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -385,7 +386,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
if (FuncDeclaration *fd = s->isFuncDeclaration()) {
|
if (FuncDeclaration *fd = s->isFuncDeclaration()) {
|
||||||
fd->llvmInternal = llvm_internal;
|
fd->llvmInternal = llvm_internal;
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on function declarations",
|
error(s->loc, "the `%s` pragma is only allowed on function declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -400,8 +401,8 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
fd->llvmInternal = llvm_internal;
|
fd->llvmInternal = llvm_internal;
|
||||||
} else {
|
} else {
|
||||||
error(s->loc,
|
error(s->loc,
|
||||||
"the '%s' pragma must only be used on function declarations "
|
"the `%s` pragma must only be used on function declarations "
|
||||||
"of type 'void* function(uint nbytes)'",
|
"of type `void* function(uint nbytes)`",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -410,18 +411,18 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
case LLVMinline_asm:
|
case LLVMinline_asm:
|
||||||
if (TemplateDeclaration *td = s->isTemplateDeclaration()) {
|
if (TemplateDeclaration *td = s->isTemplateDeclaration()) {
|
||||||
if (td->parameters->dim > 1) {
|
if (td->parameters->dim > 1) {
|
||||||
error(s->loc, "the '%s' pragma template must have exactly zero or one "
|
error(s->loc, "the `%s` pragma template must have exactly zero or one "
|
||||||
"template parameters",
|
"template parameters",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
} else if (!td->onemember) {
|
} else if (!td->onemember) {
|
||||||
error(s->loc, "the '%s' pragma template must have exactly one member",
|
error(s->loc, "the `%s` pragma template must have exactly one member",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
td->llvmInternal = llvm_internal;
|
td->llvmInternal = llvm_internal;
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on template declarations",
|
error(s->loc, "the `%s` pragma is only allowed on template declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -431,7 +432,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
if (TemplateDeclaration *td = s->isTemplateDeclaration()) {
|
if (TemplateDeclaration *td = s->isTemplateDeclaration()) {
|
||||||
Dsymbol *member = td->onemember;
|
Dsymbol *member = td->onemember;
|
||||||
if (!member) {
|
if (!member) {
|
||||||
error(s->loc, "the '%s' pragma template must have exactly one member",
|
error(s->loc, "the `%s` pragma template must have exactly one member",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -439,7 +440,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
if (!fun) {
|
if (!fun) {
|
||||||
error(
|
error(
|
||||||
s->loc,
|
s->loc,
|
||||||
"the '%s' pragma template's member must be a function declaration",
|
"the `%s` pragma template's member must be a function declaration",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -456,7 +457,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
|
|
||||||
if (!valid_params) {
|
if (!valid_params) {
|
||||||
error(s->loc,
|
error(s->loc,
|
||||||
"the '%s' pragma template must have exactly three parameters: "
|
"the `%s` pragma template must have exactly three parameters: "
|
||||||
"a string, a type and a type tuple",
|
"a string, a type and a type tuple",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -464,7 +465,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
|
|
||||||
td->llvmInternal = llvm_internal;
|
td->llvmInternal = llvm_internal;
|
||||||
} else {
|
} else {
|
||||||
error(s->loc, "the '%s' pragma is only allowed on template declarations",
|
error(s->loc, "the `%s` pragma is only allowed on template declarations",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -473,7 +474,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
case LLVMextern_weak:
|
case LLVMextern_weak:
|
||||||
if (VarDeclaration *vd = s->isVarDeclaration()) {
|
if (VarDeclaration *vd = s->isVarDeclaration()) {
|
||||||
if (!vd->isDataseg() || !(vd->storage_class & STCextern)) {
|
if (!vd->isDataseg() || !(vd->storage_class & STCextern)) {
|
||||||
error(s->loc, "'%s' requires storage class 'extern'", ident->toChars());
|
error(s->loc, "`%s` requires storage class `extern`", ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +483,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
// symbol is non-zero on the ELF static TLS model on Linux x86_64).
|
// symbol is non-zero on the ELF static TLS model on Linux x86_64).
|
||||||
// Thus, just disallow this altogether.
|
// Thus, just disallow this altogether.
|
||||||
if (vd->isThreadlocal()) {
|
if (vd->isThreadlocal()) {
|
||||||
error(s->loc, "'%s' cannot be applied to thread-local variable '%s'",
|
error(s->loc, "`%s` cannot be applied to thread-local variable `%s`",
|
||||||
ident->toChars(), vd->toPrettyChars());
|
ident->toChars(), vd->toPrettyChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -492,7 +493,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
// fail because 'extern' creates an intermediate
|
// fail because 'extern' creates an intermediate
|
||||||
// StorageClassDeclaration. This might eventually be fixed by making
|
// StorageClassDeclaration. This might eventually be fixed by making
|
||||||
// extern_weak a proper storage class.
|
// extern_weak a proper storage class.
|
||||||
error(s->loc, "the '%s' pragma can only be specified directly on "
|
error(s->loc, "the `%s` pragma can only be specified directly on "
|
||||||
"variable declarations for now",
|
"variable declarations for now",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -501,7 +502,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
warning(s->loc,
|
warning(s->loc,
|
||||||
"the LDC specific pragma '%s' is not yet implemented, ignoring",
|
"the LDC specific pragma `%s` is not yet implemented, ignoring",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ static void checkForImplicitGCCall(const Loc &loc, const char *name) {
|
||||||
&GCNAMES[sizeof(GCNAMES) / sizeof(std::string)], name)) {
|
&GCNAMES[sizeof(GCNAMES) / sizeof(std::string)], name)) {
|
||||||
error(loc,
|
error(loc,
|
||||||
"No implicit garbage collector calls allowed with -nogc "
|
"No implicit garbage collector calls allowed with -nogc "
|
||||||
"option enabled: %s",
|
"option enabled: `%s`",
|
||||||
name);
|
name);
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -137,14 +137,14 @@ llvm::Function *getRuntimeFunction(const Loc &loc, llvm::Module &target,
|
||||||
|
|
||||||
LLFunction *fn = M->getFunction(name);
|
LLFunction *fn = M->getFunction(name);
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
error(loc, "Runtime function '%s' was not found", name);
|
error(loc, "Runtime function `%s` was not found", name);
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
LLFunctionType *fnty = fn->getFunctionType();
|
LLFunctionType *fnty = fn->getFunctionType();
|
||||||
|
|
||||||
if (LLFunction *existing = target.getFunction(name)) {
|
if (LLFunction *existing = target.getFunction(name)) {
|
||||||
if (existing->getFunctionType() != fnty) {
|
if (existing->getFunctionType() != fnty) {
|
||||||
error(Loc(), "Incompatible declaration of runtime function '%s'", name);
|
error(Loc(), "Incompatible declaration of runtime function `%s`", name);
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
return existing;
|
return existing;
|
||||||
|
@ -174,7 +174,7 @@ llvm::GlobalVariable *getRuntimeGlobal(Loc &loc, llvm::Module &target,
|
||||||
|
|
||||||
LLGlobalVariable *g = M->getNamedGlobal(name);
|
LLGlobalVariable *g = M->getNamedGlobal(name);
|
||||||
if (!g) {
|
if (!g) {
|
||||||
error(loc, "Runtime global '%s' was not found", name);
|
error(loc, "Runtime global `%s` was not found", name);
|
||||||
fatal();
|
fatal();
|
||||||
// return NULL;
|
// return NULL;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ static Type *rt_dg2() {
|
||||||
template <typename DECL> static void ensureDecl(DECL *decl, const char *msg) {
|
template <typename DECL> static void ensureDecl(DECL *decl, const char *msg) {
|
||||||
if (!decl || !decl->type) {
|
if (!decl || !decl->type) {
|
||||||
Logger::println("Missing class declaration: %s\n", msg);
|
Logger::println("Missing class declaration: %s\n", msg);
|
||||||
error(Loc(), "Missing class declaration: %s", msg);
|
error(Loc(), "Missing class declaration: `%s`", msg);
|
||||||
errorSupplemental(Loc(),
|
errorSupplemental(Loc(),
|
||||||
"Please check that object.d is included and valid");
|
"Please check that object.d is included and valid");
|
||||||
fatal();
|
fatal();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
struct DComputeSemanticAnalyser : public StoppableVisitor {
|
struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
FuncDeclaration *currentFunction;
|
FuncDeclaration *currentFunction;
|
||||||
// In @compute code only calls to other functions in @compute code are
|
// In @compute code only calls to other functions in `@compute` code are
|
||||||
// allowed.
|
// allowed.
|
||||||
// However, a @kernel function taking a template alias function parameter is
|
// However, a @kernel function taking a template alias function parameter is
|
||||||
// allowed, but while the alias appears in the symbol table of the module of
|
// allowed, but while the alias appears in the symbol table of the module of
|
||||||
|
@ -68,12 +68,12 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(InterfaceDeclaration *decl) override {
|
void visit(InterfaceDeclaration *decl) override {
|
||||||
decl->error("interfaces and classes not allowed in @compute code");
|
decl->error("interfaces and classes not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(ClassDeclaration *decl) override {
|
void visit(ClassDeclaration *decl) override {
|
||||||
decl->error("interfaces and classes not allowed in @compute code");
|
decl->error("interfaces and classes not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
if (decl->isDataseg()) {
|
if (decl->isDataseg()) {
|
||||||
if (strncmp(decl->toChars(), "__critsec", 9) &&
|
if (strncmp(decl->toChars(), "__critsec", 9) &&
|
||||||
strncmp(decl->toChars(), "typeid", 6)) {
|
strncmp(decl->toChars(), "typeid", 6)) {
|
||||||
decl->error("global variables not allowed in @compute code variable=%s",decl->toChars());
|
decl->error("global variables not allowed in `@compute` code");
|
||||||
}
|
}
|
||||||
// Ignore typeid: it is ignored by codegen.
|
// Ignore typeid: it is ignored by codegen.
|
||||||
stop = true;
|
stop = true;
|
||||||
|
@ -90,18 +90,18 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decl->type->ty == Taarray) {
|
if (decl->type->ty == Taarray) {
|
||||||
decl->error("associative arrays not allowed in @compute code");
|
decl->error("associative arrays not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
// includes interfaces
|
// includes interfaces
|
||||||
else if (decl->type->ty == Tclass) {
|
else if (decl->type->ty == Tclass) {
|
||||||
decl->error("interfaces and classes not allowed in @compute code");
|
decl->error("interfaces and classes not allowed in `@compute` code");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void visit(PragmaDeclaration *decl) override {
|
void visit(PragmaDeclaration *decl) override {
|
||||||
if (decl->ident == Id::lib) {
|
if (decl->ident == Id::lib) {
|
||||||
decl->error(
|
decl->error(
|
||||||
"linking additional libraries not supported in @compute code");
|
"linking additional libraries not supported in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,66 +111,66 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
void visit(ArrayLiteralExp *e) override {
|
void visit(ArrayLiteralExp *e) override {
|
||||||
if (e->type->ty != Tarray || !e->elements || !e->elements->dim)
|
if (e->type->ty != Tarray || !e->elements || !e->elements->dim)
|
||||||
return;
|
return;
|
||||||
e->error("array literal in @compute code not allowed");
|
e->error("array literal in `@compute` code not allowed");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(NewExp *e) override {
|
void visit(NewExp *e) override {
|
||||||
e->error("cannot use 'new' in @compute code");
|
e->error("cannot use `new` in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(DeleteExp *e) override {
|
void visit(DeleteExp *e) override {
|
||||||
e->error("cannot use 'delete' in @compute code");
|
e->error("cannot use `delete` in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
// No need to check IndexExp because AA's are banned anyway
|
// No need to check IndexExp because AA's are banned anyway
|
||||||
void visit(AssignExp *e) override {
|
void visit(AssignExp *e) override {
|
||||||
if (e->e1->op == TOKarraylength) {
|
if (e->e1->op == TOKarraylength) {
|
||||||
e->error("setting 'length' in @compute code not allowed");
|
e->error("setting `length` in `@compute` code not allowed");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(CatAssignExp *e) override {
|
void visit(CatAssignExp *e) override {
|
||||||
e->error("cannot use operator ~= in @compute code");
|
e->error("cannot use operator `~=` in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(CatExp *e) override {
|
void visit(CatExp *e) override {
|
||||||
e->error("cannot use operator ~ in @compute code");
|
e->error("cannot use operator `~` in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
// Ban typeid(T)
|
// Ban typeid(T)
|
||||||
void visit(TypeidExp *e) override {
|
void visit(TypeidExp *e) override {
|
||||||
e->error("typeinfo not available in @compute code");
|
e->error("typeinfo not available in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(StringExp *e) override {
|
void visit(StringExp *e) override {
|
||||||
e->error("string literals not allowed in @compue code");
|
e->error("string literals not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(CompoundAsmStatement *e) override {
|
void visit(CompoundAsmStatement *e) override {
|
||||||
e->error("asm not allowed in @compute code");
|
e->error("asm not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(AsmStatement *e) override {
|
void visit(AsmStatement *e) override {
|
||||||
e->error("asm not allowed in @compute code");
|
e->error("asm not allowed in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enforce nothrow. Disallow 'catch' as it is dead code.
|
// Enforce nothrow. Disallow 'catch' as it is dead code.
|
||||||
// try...finally is allowed to facilitate scope(exit)
|
// try...finally is allowed to facilitate scope(exit)
|
||||||
void visit(TryCatchStatement *e) override {
|
void visit(TryCatchStatement *e) override {
|
||||||
e->error("no exceptions in @compute code");
|
e->error("no exceptions in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(ThrowStatement *e) override {
|
void visit(ThrowStatement *e) override {
|
||||||
e->error("no exceptions in @compute code");
|
e->error("no exceptions in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
void visit(SwitchStatement *e) override {
|
void visit(SwitchStatement *e) override {
|
||||||
if (!e->condition->type->isintegral()) {
|
if (!e->condition->type->isintegral()) {
|
||||||
e->error("cannot switch on strings in @compute code");
|
e->error("cannot `switch` on strings in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
// So we intercept it with the CallExp ----
|
// So we intercept it with the CallExp ----
|
||||||
|
|
||||||
if (e->f->ident == Id::criticalenter) {
|
if (e->f->ident == Id::criticalenter) {
|
||||||
e->error("cannot use 'synchronized' in @compute code");
|
e->error("cannot use `synchronized` in `@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -211,15 +211,15 @@ struct DComputeSemanticAnalyser : public StoppableVisitor {
|
||||||
Module *m = e->f->getModule();
|
Module *m = e->f->getModule();
|
||||||
if ((m == nullptr || (hasComputeAttr(m) == DComputeCompileFor::hostOnly)) &&
|
if ((m == nullptr || (hasComputeAttr(m) == DComputeCompileFor::hostOnly)) &&
|
||||||
!isNonComputeCallExpVaild(e)) {
|
!isNonComputeCallExpVaild(e)) {
|
||||||
e->error("can only call functions from other @compute modules in "
|
e->error("can only call functions from other `@compute` modules in "
|
||||||
"@compute code");
|
"`@compute` code");
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(FuncDeclaration *fd) override {
|
void visit(FuncDeclaration *fd) override {
|
||||||
if (hasKernelAttr(fd) && fd->vthis) {
|
if (hasKernelAttr(fd) && fd->vthis) {
|
||||||
fd->error("@kernel functions must not require 'this'");
|
fd->error("`@kernel` functions must not require `this`");
|
||||||
stop = true;
|
stop = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1684,7 +1684,7 @@ public:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void visit(Statement *stmt) LLVM_OVERRIDE {
|
void visit(Statement *stmt) LLVM_OVERRIDE {
|
||||||
error(stmt->loc, "Statement type Statement not implemented: %s",
|
error(stmt->loc, "Statement type Statement not implemented: `%s`",
|
||||||
stmt->toChars());
|
stmt->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -1692,7 +1692,7 @@ public:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void visit(PragmaStatement *stmt) LLVM_OVERRIDE {
|
void visit(PragmaStatement *stmt) LLVM_OVERRIDE {
|
||||||
error(stmt->loc, "Statement type PragmaStatement not implemented: %s",
|
error(stmt->loc, "Statement type PragmaStatement not implemented: `%s`",
|
||||||
stmt->toChars());
|
stmt->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ void DtoResolveStruct(StructDeclaration *sd, Loc &callerLoc) {
|
||||||
|
|
||||||
// if it's a forward declaration, all bets are off. The type should be enough
|
// if it's a forward declaration, all bets are off. The type should be enough
|
||||||
if (sd->sizeok != SIZEOKdone) {
|
if (sd->sizeok != SIZEOKdone) {
|
||||||
error(callerLoc, "struct %s.%s unknown size", sd->getModule()->toChars(),
|
error(callerLoc, "struct `%s.%s` unknown size", sd->getModule()->toChars(),
|
||||||
sd->toChars());
|
sd->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ void Target::_init() {
|
||||||
RealProperties.min_10_exp = -4931;
|
RealProperties.min_10_exp = -4931;
|
||||||
} else {
|
} else {
|
||||||
// leave initialized with host real_t values
|
// leave initialized with host real_t values
|
||||||
warning(Loc(), "unknown properties for target real type");
|
warning(Loc(), "unknown properties for target `real` type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// va_start instruction
|
// va_start instruction
|
||||||
if (fndecl->llvmInternal == LLVMva_start) {
|
if (fndecl->llvmInternal == LLVMva_start) {
|
||||||
if (e->arguments->dim < 1 || e->arguments->dim > 2) {
|
if (e->arguments->dim < 1 || e->arguments->dim > 2) {
|
||||||
e->error("va_start instruction expects 1 (or 2) arguments");
|
e->error("`va_start` instruction expects 1 (or 2) arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list
|
DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list
|
||||||
|
@ -279,7 +279,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// va_copy instruction
|
// va_copy instruction
|
||||||
if (fndecl->llvmInternal == LLVMva_copy) {
|
if (fndecl->llvmInternal == LLVMva_copy) {
|
||||||
if (e->arguments->dim != 2) {
|
if (e->arguments->dim != 2) {
|
||||||
e->error("va_copy instruction expects 2 arguments");
|
e->error("`va_copy` instruction expects 2 arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
DLValue *dest = toElem((*e->arguments)[0])->isLVal(); // va_list
|
DLValue *dest = toElem((*e->arguments)[0])->isLVal(); // va_list
|
||||||
|
@ -293,11 +293,11 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// va_arg instruction
|
// va_arg instruction
|
||||||
if (fndecl->llvmInternal == LLVMva_arg) {
|
if (fndecl->llvmInternal == LLVMva_arg) {
|
||||||
if (e->arguments->dim != 1) {
|
if (e->arguments->dim != 1) {
|
||||||
e->error("va_arg instruction expects 1 argument");
|
e->error("`va_arg` instruction expects 1 argument");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
if (DtoIsInMemoryOnly(e->type)) {
|
if (DtoIsInMemoryOnly(e->type)) {
|
||||||
e->error("va_arg instruction does not support structs and static arrays");
|
e->error("`va_arg` instruction does not support structs and static arrays");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list
|
DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list
|
||||||
|
@ -311,7 +311,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// C alloca
|
// C alloca
|
||||||
if (fndecl->llvmInternal == LLVMalloca) {
|
if (fndecl->llvmInternal == LLVMalloca) {
|
||||||
if (e->arguments->dim != 1) {
|
if (e->arguments->dim != 1) {
|
||||||
e->error("alloca expects 1 arguments");
|
e->error("`alloca` expects 1 argument");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
Expression *exp = (*e->arguments)[0];
|
Expression *exp = (*e->arguments)[0];
|
||||||
|
@ -328,7 +328,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// fence instruction
|
// fence instruction
|
||||||
if (fndecl->llvmInternal == LLVMfence) {
|
if (fndecl->llvmInternal == LLVMfence) {
|
||||||
if (e->arguments->dim < 1 || e->arguments->dim > 2) {
|
if (e->arguments->dim < 1 || e->arguments->dim > 2) {
|
||||||
e->error("fence instruction expects 1 (or 2) arguments");
|
e->error("`fence` instruction expects 1 (or 2) arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
auto atomicOrdering =
|
auto atomicOrdering =
|
||||||
|
@ -383,7 +383,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorStore:
|
errorStore:
|
||||||
e->error("atomic store only supports integer types, not '%s'",
|
e->error("atomic store only supports integer types, not `%s`",
|
||||||
exp1->type->toChars());
|
exp1->type->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorLoad:
|
errorLoad:
|
||||||
e->error("atomic load only supports integer types, not '%s'",
|
e->error("atomic load only supports integer types, not `%s`",
|
||||||
retType->toChars());
|
retType->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// cmpxchg instruction
|
// cmpxchg instruction
|
||||||
if (fndecl->llvmInternal == LLVMatomic_cmp_xchg) {
|
if (fndecl->llvmInternal == LLVMatomic_cmp_xchg) {
|
||||||
if (e->arguments->dim != 4) {
|
if (e->arguments->dim != 4) {
|
||||||
e->error("cmpxchg instruction expects 4 arguments");
|
e->error("`cmpxchg` instruction expects 4 arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
Expression *exp1 = (*e->arguments)[0];
|
Expression *exp1 = (*e->arguments)[0];
|
||||||
|
@ -483,7 +483,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorCmpxchg:
|
errorCmpxchg:
|
||||||
e->error("cmpxchg only supports integer types, not '%s'",
|
e->error("`cmpxchg` only supports integer types, not `%s`",
|
||||||
exp2->type->toChars());
|
exp2->type->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
// atomicrmw instruction
|
// atomicrmw instruction
|
||||||
if (fndecl->llvmInternal == LLVMatomic_rmw) {
|
if (fndecl->llvmInternal == LLVMatomic_rmw) {
|
||||||
if (e->arguments->dim != 3) {
|
if (e->arguments->dim != 3) {
|
||||||
e->error("atomic_rmw instruction expects 3 arguments");
|
e->error("`atomic_rmw` instruction expects 3 arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
int op = 0;
|
int op = 0;
|
||||||
for (;; ++op) {
|
for (;; ++op) {
|
||||||
if (ops[op] == nullptr) {
|
if (ops[op] == nullptr) {
|
||||||
e->error("unknown atomic_rmw operation %s",
|
e->error("unknown atomic_rmw operation `%s`",
|
||||||
fndecl->intrinsicName);
|
fndecl->intrinsicName);
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
|
|
||||||
if (fndecl->llvmInternal == LLVMbitop_vld) {
|
if (fndecl->llvmInternal == LLVMbitop_vld) {
|
||||||
if (e->arguments->dim != 1) {
|
if (e->arguments->dim != 1) {
|
||||||
e->error("bitop.vld intrinsic expects 1 argument");
|
e->error("`bitop.vld` intrinsic expects 1 argument");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
// TODO: Check types
|
// TODO: Check types
|
||||||
|
@ -614,7 +614,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
|
||||||
|
|
||||||
if (fndecl->llvmInternal == LLVMbitop_vst) {
|
if (fndecl->llvmInternal == LLVMbitop_vst) {
|
||||||
if (e->arguments->dim != 2) {
|
if (e->arguments->dim != 2) {
|
||||||
e->error("bitop.vst intrinsic expects 2 arguments");
|
e->error("`bitop.vst` intrinsic expects 2 arguments");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
// TODO: Check types
|
// TODO: Check types
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
VarDeclaration *vd = e->var->isVarDeclaration();
|
VarDeclaration *vd = e->var->isVarDeclaration();
|
||||||
if (vd && vd->isConst() && vd->_init) {
|
if (vd && vd->isConst() && vd->_init) {
|
||||||
if (vd->inuse) {
|
if (vd->inuse) {
|
||||||
e->error("recursive reference %s", e->toChars());
|
e->error("recursive reference `%s`", e->toChars());
|
||||||
result = llvm::UndefValue::get(DtoType(e->type));
|
result = llvm::UndefValue::get(DtoType(e->type));
|
||||||
} else {
|
} else {
|
||||||
vd->inuse++;
|
vd->inuse++;
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
}
|
}
|
||||||
// fail
|
// fail
|
||||||
else {
|
else {
|
||||||
e->error("non-constant expression %s", e->toChars());
|
e->error("non-constant expression `%s`", e->toChars());
|
||||||
result = llvm::UndefValue::get(DtoType(e->type));
|
result = llvm::UndefValue::get(DtoType(e->type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
result = llvm::ConstantExpr::getGetElementPtr(
|
result = llvm::ConstantExpr::getGetElementPtr(
|
||||||
isaPointer(ptr)->getElementType(), ptr, DtoConstSize_t(idx));
|
isaPointer(ptr)->getElementType(), ptr, DtoConstSize_t(idx));
|
||||||
} else {
|
} else {
|
||||||
e->error("expression '%s' is not a constant", e->toChars());
|
e->error("expression `%s` is not a constant", e->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
result = llvm::ConstantExpr::getGetElementPtr(
|
result = llvm::ConstantExpr::getGetElementPtr(
|
||||||
isaPointer(ptr)->getElementType(), ptr, negIdx);
|
isaPointer(ptr)->getElementType(), ptr, negIdx);
|
||||||
} else {
|
} else {
|
||||||
e->error("expression '%s' is not a constant", e->toChars());
|
e->error("expression `%s` is not a constant", e->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public:
|
||||||
}
|
}
|
||||||
size_t arrlen = datalen / eltype->size();
|
size_t arrlen = datalen / eltype->size();
|
||||||
#endif
|
#endif
|
||||||
e->error("ct cast of string to dynamic array not fully implemented");
|
e->error("ct cast of `string` to dynamic array not fully implemented");
|
||||||
result = toConstElem(e->e1);
|
result = toConstElem(e->e1);
|
||||||
}
|
}
|
||||||
// pointer to pointer
|
// pointer to pointer
|
||||||
|
@ -320,7 +320,7 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Lerr:
|
Lerr:
|
||||||
e->error("cannot cast %s to %s at compile time", e->e1->type->toChars(),
|
e->error("cannot cast `%s` to `%s` at compile time", e->e1->type->toChars(),
|
||||||
e->type->toChars());
|
e->type->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -429,7 +429,7 @@ public:
|
||||||
|
|
||||||
result = se->globalVar;
|
result = se->globalVar;
|
||||||
} else if (e->e1->op == TOKslice) {
|
} else if (e->e1->op == TOKslice) {
|
||||||
e->error("non-constant expression '%s'", e->toChars());
|
e->error("non-constant expression `%s`", e->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ public:
|
||||||
}
|
}
|
||||||
// not yet supported
|
// not yet supported
|
||||||
else {
|
else {
|
||||||
e->error("constant expression '%s' not yet implemented", e->toChars());
|
e->error("constant expression `%s` not yet implemented", e->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ public:
|
||||||
|
|
||||||
if (fd->tok != TOKfunction) {
|
if (fd->tok != TOKfunction) {
|
||||||
assert(fd->tok == TOKdelegate || fd->tok == TOKreserved);
|
assert(fd->tok == TOKdelegate || fd->tok == TOKreserved);
|
||||||
e->error("non-constant nested delegate literal expression %s",
|
e->error("non-constant nested delegate literal expression `%s`",
|
||||||
e->toChars());
|
e->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -712,7 +712,7 @@ public:
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void visit(Expression *e) override {
|
void visit(Expression *e) override {
|
||||||
e->error("expression '%s' is not a constant", e->toChars());
|
e->error("expression `%s` is not a constant", e->toChars());
|
||||||
if (!global.gag) {
|
if (!global.gag) {
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
12
gen/toir.cpp
12
gen/toir.cpp
|
@ -557,7 +557,7 @@ public:
|
||||||
// valid array ops would have been transformed by optimize
|
// valid array ops would have been transformed by optimize
|
||||||
if ((t1->ty == Tarray || t1->ty == Tsarray) &&
|
if ((t1->ty == Tarray || t1->ty == Tsarray) &&
|
||||||
(t2->ty == Tarray || t2->ty == Tsarray)) {
|
(t2->ty == Tarray || t2->ty == Tsarray)) {
|
||||||
base->error("Array operation %s not recognized", base->toChars());
|
base->error("Array operation `%s` not recognized", base->toChars());
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1870,8 +1870,8 @@ public:
|
||||||
LOG_SCOPE;
|
LOG_SCOPE;
|
||||||
|
|
||||||
if (e->func->isStatic()) {
|
if (e->func->isStatic()) {
|
||||||
e->error("can't take delegate of static function %s, it does not require "
|
e->error("can't take delegate of static function `%s`, it does not "
|
||||||
"a context ptr",
|
"require a context ptr",
|
||||||
e->func->toChars());
|
e->func->toChars());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2545,7 +2545,7 @@ public:
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void visit(TypeExp *e) override {
|
void visit(TypeExp *e) override {
|
||||||
e->error("type %s is not an expression", e->toChars());
|
e->error("type `%s` is not an expression", e->toChars());
|
||||||
// TODO: Improve error handling. DMD just returns some value here and hopes
|
// TODO: Improve error handling. DMD just returns some value here and hopes
|
||||||
// some more sensible error messages will be triggered.
|
// some more sensible error messages will be triggered.
|
||||||
fatal();
|
fatal();
|
||||||
|
@ -2627,7 +2627,7 @@ public:
|
||||||
IF_LOG Logger::print("PowExp::toElem() %s\n", e->toChars());
|
IF_LOG Logger::print("PowExp::toElem() %s\n", e->toChars());
|
||||||
LOG_SCOPE;
|
LOG_SCOPE;
|
||||||
|
|
||||||
e->error("must import std.math to use ^^ operator");
|
e->error("must import `std.math` to use `^^` operator");
|
||||||
result = new DNullValue(e->type, llvm::UndefValue::get(DtoType(e->type)));
|
result = new DNullValue(e->type, llvm::UndefValue::get(DtoType(e->type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2674,7 +2674,7 @@ public:
|
||||||
|
|
||||||
#define STUB(x) \
|
#define STUB(x) \
|
||||||
void visit(x *e) override { \
|
void visit(x *e) override { \
|
||||||
e->error("Internal compiler error: Type " #x " not implemented: %s", \
|
e->error("Internal compiler error: Type `" #x "` not implemented: `%s`", \
|
||||||
e->toChars()); \
|
e->toChars()); \
|
||||||
fatal(); \
|
fatal(); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ TryCatchFinallyScopes::~TryCatchFinallyScopes() {
|
||||||
// cleanup scopes, both of which are not allowed in D.
|
// cleanup scopes, both of which are not allowed in D.
|
||||||
if (!currentUnresolvedGotos().empty()) {
|
if (!currentUnresolvedGotos().empty()) {
|
||||||
for (const auto &i : currentUnresolvedGotos()) {
|
for (const auto &i : currentUnresolvedGotos()) {
|
||||||
error(i.sourceLoc, "goto into try/finally scope is not allowed");
|
error(i.sourceLoc, "`goto` into `try`/`finally` scope is not allowed");
|
||||||
}
|
}
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,7 +306,7 @@ public:
|
||||||
|
|
||||||
// can't emit typeinfo for forward declarations
|
// can't emit typeinfo for forward declarations
|
||||||
if (sd->sizeok != SIZEOKdone) {
|
if (sd->sizeok != SIZEOKdone) {
|
||||||
sd->error("cannot emit TypeInfo for forward declaration");
|
sd->error("cannot emit `TypeInfo` for forward declaration");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ public:
|
||||||
global.params.targetTriple->getArch() == llvm::Triple::x86_64;
|
global.params.targetTriple->getArch() == llvm::Triple::x86_64;
|
||||||
const unsigned expectedFields = 12 + (isX86_64 ? 2 : 0);
|
const unsigned expectedFields = 12 + (isX86_64 ? 2 : 0);
|
||||||
if (Type::typeinfostruct->fields.dim != expectedFields) {
|
if (Type::typeinfostruct->fields.dim != expectedFields) {
|
||||||
error(Loc(), "Unexpected number of object.TypeInfo_Struct fields; "
|
error(Loc(), "Unexpected number of `object.TypeInfo_Struct` fields; "
|
||||||
"druntime version does not match compiler");
|
"druntime version does not match compiler");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
39
gen/uda.cpp
39
gen/uda.cpp
|
@ -62,7 +62,7 @@ StructLiteralExp *getLdcAttributesStruct(Expression *attr) {
|
||||||
void checkStructElems(StructLiteralExp *sle, ArrayParam<Type *> elemTypes) {
|
void checkStructElems(StructLiteralExp *sle, ArrayParam<Type *> elemTypes) {
|
||||||
if (sle->elements->dim != elemTypes.size()) {
|
if (sle->elements->dim != elemTypes.size()) {
|
||||||
sle->error(
|
sle->error(
|
||||||
"unexpected field count in 'ldc.%s.%s'; does druntime not "
|
"unexpected field count in `ldc.%s.%s`; does druntime not "
|
||||||
"match compiler version?",
|
"match compiler version?",
|
||||||
sle->sd->getModule()->md->id->toChars(),
|
sle->sd->getModule()->md->id->toChars(),
|
||||||
sle->sd->ident->toChars());
|
sle->sd->ident->toChars());
|
||||||
|
@ -71,7 +71,7 @@ void checkStructElems(StructLiteralExp *sle, ArrayParam<Type *> elemTypes) {
|
||||||
|
|
||||||
for (size_t i = 0; i < sle->elements->dim; ++i) {
|
for (size_t i = 0; i < sle->elements->dim; ++i) {
|
||||||
if ((*sle->elements)[i]->type->toBasetype() != elemTypes[i]) {
|
if ((*sle->elements)[i]->type->toBasetype() != elemTypes[i]) {
|
||||||
sle->error("invalid field type in 'ldc.%s.%s'; does druntime not "
|
sle->error("invalid field type in `ldc.%s.%s`; does druntime not "
|
||||||
"match compiler version?",
|
"match compiler version?",
|
||||||
sle->sd->getModule()->md->id->toChars(),
|
sle->sd->getModule()->md->id->toChars(),
|
||||||
sle->sd->ident->toChars());
|
sle->sd->ident->toChars());
|
||||||
|
@ -142,14 +142,14 @@ void applyAttrAllocSize(StructLiteralExp *sle, IrFunction *irFunc) {
|
||||||
// Verify that the index values are valid
|
// Verify that the index values are valid
|
||||||
bool error = false;
|
bool error = false;
|
||||||
if (sizeArgIdx + 1 > sinteger_t(numUserParams)) {
|
if (sizeArgIdx + 1 > sinteger_t(numUserParams)) {
|
||||||
sle->error("@ldc.attributes.allocSize.sizeArgIdx=%d too large for function "
|
sle->error("`@ldc.attributes.allocSize.sizeArgIdx=%d` too large for "
|
||||||
"`%s` with %d arguments.",
|
"function `%s` with %d arguments.",
|
||||||
(int)sizeArgIdx, irFunc->decl->toChars(), (int)numUserParams);
|
(int)sizeArgIdx, irFunc->decl->toChars(), (int)numUserParams);
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if (numArgIdx + 1 > sinteger_t(numUserParams)) {
|
if (numArgIdx + 1 > sinteger_t(numUserParams)) {
|
||||||
sle->error("@ldc.attributes.allocSize.numArgIdx=%d too large for function "
|
sle->error("`@ldc.attributes.allocSize.numArgIdx=%d` too large for "
|
||||||
"`%s` with %d arguments.",
|
"function `%s` with %d arguments.",
|
||||||
(int)numArgIdx, irFunc->decl->toChars(), (int)numUserParams);
|
(int)numArgIdx, irFunc->decl->toChars(), (int)numUserParams);
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ void applyAttrLLVMFastMathFlag(StructLiteralExp *sle, IrFunction *irFunc) {
|
||||||
#if LDC_LLVM_VER >= 500
|
#if LDC_LLVM_VER >= 500
|
||||||
irFunc->FMF.setAllowContract(true);
|
irFunc->FMF.setAllowContract(true);
|
||||||
#else
|
#else
|
||||||
sle->warning("ignoring parameter \"contract\" for @ldc.attributes.%s: "
|
sle->warning("ignoring parameter `contract` for `@ldc.attributes.%s`: "
|
||||||
"LDC needs to be built against LLVM 5.0+ for support",
|
"LDC needs to be built against LLVM 5.0+ for support",
|
||||||
sle->sd->ident->toChars());
|
sle->sd->ident->toChars());
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,7 +237,7 @@ void applyAttrLLVMFastMathFlag(StructLiteralExp *sle, IrFunction *irFunc) {
|
||||||
// `value` is a null-terminated returned from getStringElem so can be passed
|
// `value` is a null-terminated returned from getStringElem so can be passed
|
||||||
// to warning("... %s ...").
|
// to warning("... %s ...").
|
||||||
sle->warning(
|
sle->warning(
|
||||||
"ignoring unrecognized flag parameter '%s' for '@ldc.attributes.%s'",
|
"ignoring unrecognized flag parameter `%s` for `@ldc.attributes.%s`",
|
||||||
value.data(), sle->sd->ident->toChars());
|
value.data(), sle->sd->ident->toChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,8 +249,8 @@ void applyAttrOptStrategy(StructLiteralExp *sle, IrFunction *irFunc) {
|
||||||
llvm::Function *func = irFunc->getLLVMFunc();
|
llvm::Function *func = irFunc->getLLVMFunc();
|
||||||
if (value == "none") {
|
if (value == "none") {
|
||||||
if (irFunc->decl->inlining == PINLINEalways) {
|
if (irFunc->decl->inlining == PINLINEalways) {
|
||||||
sle->error("cannot combine '@ldc.attributes.%s(\"none\")' with "
|
sle->error("cannot combine `@ldc.attributes.%s(\"none\")` with "
|
||||||
"'pragma(inline, true)'",
|
"`pragma(inline, true)`",
|
||||||
sle->sd->ident->toChars());
|
sle->sd->ident->toChars());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ void applyAttrOptStrategy(StructLiteralExp *sle, IrFunction *irFunc) {
|
||||||
func->addFnAttr(llvm::Attribute::MinSize);
|
func->addFnAttr(llvm::Attribute::MinSize);
|
||||||
} else {
|
} else {
|
||||||
sle->warning(
|
sle->warning(
|
||||||
"ignoring unrecognized parameter '%s' for '@ldc.attributes.%s'",
|
"ignoring unrecognized parameter `%s` for `@ldc.attributes.%s`",
|
||||||
value.data(), sle->sd->ident->toChars());
|
value.data(), sle->sd->ident->toChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,13 +355,14 @@ void applyVarDeclUDAs(VarDeclaration *decl, llvm::GlobalVariable *gvar) {
|
||||||
applyAttrSection(sle, gvar);
|
applyAttrSection(sle, gvar);
|
||||||
} else if (ident == Id::udaOptStrategy || ident == Id::udaTarget) {
|
} else if (ident == Id::udaOptStrategy || ident == Id::udaTarget) {
|
||||||
sle->error(
|
sle->error(
|
||||||
"Special attribute 'ldc.attributes.%s' is only valid for functions",
|
"Special attribute `ldc.attributes.%s` is only valid for functions",
|
||||||
ident->toChars());
|
ident->toChars());
|
||||||
} else if (ident == Id::udaWeak) {
|
} else if (ident == Id::udaWeak) {
|
||||||
// @weak is applied elsewhere
|
// @weak is applied elsewhere
|
||||||
} else {
|
} else {
|
||||||
sle->warning(
|
sle->warning(
|
||||||
"Ignoring unrecognized special attribute 'ldc.attributes.%s'", ident->toChars());
|
"Ignoring unrecognized special attribute `ldc.attributes.%s`",
|
||||||
|
ident->toChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +398,8 @@ void applyFuncDeclUDAs(FuncDeclaration *decl, IrFunction *irFunc) {
|
||||||
// @weak and @kernel are applied elsewhere
|
// @weak and @kernel are applied elsewhere
|
||||||
} else {
|
} else {
|
||||||
sle->warning(
|
sle->warning(
|
||||||
"Ignoring unrecognized special attribute 'ldc.attributes.%s'", ident->toChars());
|
"Ignoring unrecognized special attribute `ldc.attributes.%s`",
|
||||||
|
ident->toChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +413,7 @@ bool hasWeakUDA(Dsymbol *sym) {
|
||||||
checkStructElems(sle, {});
|
checkStructElems(sle, {});
|
||||||
auto vd = sym->isVarDeclaration();
|
auto vd = sym->isVarDeclaration();
|
||||||
if (!(vd && vd->isDataseg()) && !sym->isFuncDeclaration())
|
if (!(vd && vd->isDataseg()) && !sym->isFuncDeclaration())
|
||||||
sym->error("@ldc.attributes.weak can only be applied to functions or "
|
sym->error("`@ldc.attributes.weak` can only be applied to functions or "
|
||||||
"global variables");
|
"global variables");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -438,9 +440,10 @@ bool hasKernelAttr(Dsymbol *sym) {
|
||||||
checkStructElems(sle, {});
|
checkStructElems(sle, {});
|
||||||
|
|
||||||
if (!sym->isFuncDeclaration() &&
|
if (!sym->isFuncDeclaration() &&
|
||||||
hasComputeAttr(sym->getModule()) != DComputeCompileFor::hostOnly)
|
hasComputeAttr(sym->getModule()) != DComputeCompileFor::hostOnly) {
|
||||||
sym->error("@ldc.dcompute.kernel can only be applied to functions"
|
sym->error("`@ldc.dcompute.kernel` can only be applied to functions"
|
||||||
" in modules marked @ldc.dcompute.compute");
|
" in modules marked `@ldc.dcompute.compute`");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ void warnInvalidPrintfCall(Loc loc, Expression *arguments, size_t nargs) {
|
||||||
|
|
||||||
StringExp *strexp = static_cast<StringExp *>(arg);
|
StringExp *strexp = static_cast<StringExp *>(arg);
|
||||||
|
|
||||||
// not wchar or dhar
|
// not wchar or dchar
|
||||||
if (strexp->sz != 1) {
|
if (strexp->sz != 1) {
|
||||||
warning(loc, "printf does not support wchar and dchar strings");
|
warning(loc, "`printf` does not support `wchar` and `dchar` strings");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,14 +208,14 @@ LLConstant *IrAggr::getVtblInit() {
|
||||||
if (fd->leastAsSpecialized(fd2) || fd2->leastAsSpecialized(fd)) {
|
if (fd->leastAsSpecialized(fd2) || fd2->leastAsSpecialized(fd)) {
|
||||||
TypeFunction *tf = static_cast<TypeFunction *>(fd->type);
|
TypeFunction *tf = static_cast<TypeFunction *>(fd->type);
|
||||||
if (tf->ty == Tfunction) {
|
if (tf->ty == Tfunction) {
|
||||||
cd->error("use of %s%s is hidden by %s; use 'alias %s = %s.%s;' "
|
cd->error("use of `%s%s` is hidden by `%s`; use `alias %s = "
|
||||||
"to introduce base class overload set",
|
"%s.%s;` to introduce base class overload set",
|
||||||
fd->toPrettyChars(),
|
fd->toPrettyChars(),
|
||||||
parametersTypeToChars(tf->parameters, tf->varargs),
|
parametersTypeToChars(tf->parameters, tf->varargs),
|
||||||
cd->toChars(), fd->toChars(), fd->parent->toChars(),
|
cd->toChars(), fd->toChars(), fd->parent->toChars(),
|
||||||
fd->toChars());
|
fd->toChars());
|
||||||
} else {
|
} else {
|
||||||
cd->error("use of %s is hidden by %s", fd->toPrettyChars(),
|
cd->error("use of `%s` is hidden by `%s`", fd->toPrettyChars(),
|
||||||
cd->toChars());
|
cd->toChars());
|
||||||
}
|
}
|
||||||
fatal();
|
fatal();
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
import ldc.llvmasm : __asm;
|
import ldc.llvmasm : __asm;
|
||||||
// CHECK: Error: __asm constraint argument is invalid
|
// CHECK: Error: `__asm` constraint argument is invalid
|
||||||
__asm("", "][");
|
__asm("", "][");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import ldc.attributes;
|
||||||
|
|
||||||
version(NORMAL)
|
version(NORMAL)
|
||||||
{
|
{
|
||||||
// NORMAL: attr_allocsize_diag.d([[@LINE+2]]): Error: @ldc.attributes.allocSize.sizeArgIdx=2 too large for function `my_calloc` with 2 arguments.
|
// NORMAL: attr_allocsize_diag.d([[@LINE+2]]): Error: `@ldc.attributes.allocSize.sizeArgIdx=2` too large for function `my_calloc` with 2 arguments.
|
||||||
// NORMAL: attr_allocsize_diag.d([[@LINE+1]]): Error: @ldc.attributes.allocSize.numArgIdx=2 too large for function `my_calloc` with 2 arguments.
|
// NORMAL: attr_allocsize_diag.d([[@LINE+1]]): Error: `@ldc.attributes.allocSize.numArgIdx=2` too large for function `my_calloc` with 2 arguments.
|
||||||
extern (C) void* my_calloc(size_t num, size_t size) @allocSize(2, 2)
|
extern (C) void* my_calloc(size_t num, size_t size) @allocSize(2, 2)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -22,8 +22,8 @@ version(THIS)
|
||||||
// Test function type with hidden `this` argument
|
// Test function type with hidden `this` argument
|
||||||
class A
|
class A
|
||||||
{
|
{
|
||||||
// THIS: attr_allocsize_diag.d([[@LINE+2]]): Error: @ldc.attributes.allocSize.sizeArgIdx=4 too large for function `this_calloc` with 4 arguments.
|
// THIS: attr_allocsize_diag.d([[@LINE+2]]): Error: `@ldc.attributes.allocSize.sizeArgIdx=4` too large for function `this_calloc` with 4 arguments.
|
||||||
// THIS: attr_allocsize_diag.d([[@LINE+1]]): Error: @ldc.attributes.allocSize.numArgIdx=4 too large for function `this_calloc` with 4 arguments.
|
// THIS: attr_allocsize_diag.d([[@LINE+1]]): Error: `@ldc.attributes.allocSize.numArgIdx=4` too large for function `this_calloc` with 4 arguments.
|
||||||
void* this_calloc(int size, int b, size_t num, int c) @allocSize(4, 4)
|
void* this_calloc(int size, int b, size_t num, int c) @allocSize(4, 4)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import ldc.attributes;
|
||||||
|
|
||||||
version(WARNING)
|
version(WARNING)
|
||||||
{
|
{
|
||||||
// WARNING: attr_llvmFMF.d(11): Warning: ignoring unrecognized flag parameter 'unrecognized' for '@ldc.attributes.llvmFastMathFlag'
|
// WARNING: attr_llvmFMF.d(11): Warning: ignoring unrecognized flag parameter `unrecognized` for `@ldc.attributes.llvmFastMathFlag`
|
||||||
@llvmFastMathFlag("unrecognized")
|
@llvmFastMathFlag("unrecognized")
|
||||||
void foo() {}
|
void foo() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,57 +6,57 @@ import ldc.dcompute;
|
||||||
import inputs.notatcompute : somefunc;
|
import inputs.notatcompute : somefunc;
|
||||||
|
|
||||||
extern(C) bool perhaps();
|
extern(C) bool perhaps();
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in `@compute` code
|
||||||
interface I {}
|
interface I {}
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in `@compute` code
|
||||||
class C : Throwable { this() { super(""); } }
|
class C : Throwable { this() { super(""); } }
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} global variables not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} global variables not allowed in `@compute` code
|
||||||
C c;
|
C c;
|
||||||
|
|
||||||
void func()
|
void func()
|
||||||
{
|
{
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} associative arrays not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} associative arrays not allowed in `@compute` code
|
||||||
int[int] foo;
|
int[int] foo;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: array literal in @compute code not allowed
|
//CHECK: dcompute.d([[@LINE+1]]): Error: array literal in `@compute` code not allowed
|
||||||
auto bar = [0, 1, 2];
|
auto bar = [0, 1, 2];
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use 'new' in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use `new` in `@compute` code
|
||||||
auto baz = new int;
|
auto baz = new int;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use 'delete' in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use `delete` in `@compute` code
|
||||||
delete baz;
|
delete baz;
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in `@compute` code
|
||||||
I i;
|
I i;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: {{.*}} interfaces and classes not allowed in `@compute` code
|
||||||
C cc;
|
C cc;
|
||||||
int[] quux;
|
int[] quux;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: setting 'length' in @compute code not allowed
|
//CHECK: dcompute.d([[@LINE+1]]): Error: setting `length` in `@compute` code not allowed
|
||||||
quux.length = 1;
|
quux.length = 1;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use operator ~= in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use operator `~=` in `@compute` code
|
||||||
quux ~= 42;
|
quux ~= 42;
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use operator ~ in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use operator `~` in `@compute` code
|
||||||
cast(void) (quux ~ 1);
|
cast(void) (quux ~ 1);
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: typeinfo not available in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: typeinfo not available in `@compute` code
|
||||||
cast(void) typeid(int);
|
cast(void) typeid(int);
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use 'synchronized' in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot use `synchronized` in `@compute` code
|
||||||
synchronized {}
|
synchronized {}
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: string literals not allowed in @compue code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: string literals not allowed in `@compute` code
|
||||||
auto s = "geaxsese";
|
auto s = "geaxsese";
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot switch on strings in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: cannot `switch` on strings in `@compute` code
|
||||||
switch(s)
|
switch(s)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: can only call functions from other @compute modules in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: can only call functions from other `@compute` modules in `@compute` code
|
||||||
somefunc();
|
somefunc();
|
||||||
if (__dcompute_reflect(ReflectTarget.Host,0))
|
if (__dcompute_reflect(ReflectTarget.Host,0))
|
||||||
//CHECK-NOT: Error:
|
//CHECK-NOT: Error:
|
||||||
somefunc();
|
somefunc();
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in `@compute` code
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
func1();
|
func1();
|
||||||
|
@ -66,7 +66,7 @@ void func()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (perhaps())
|
if (perhaps())
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in `@compute` code
|
||||||
throw c;
|
throw c;
|
||||||
|
|
||||||
//CHECK-NOT: Error:
|
//CHECK-NOT: Error:
|
||||||
|
@ -82,12 +82,12 @@ void func()
|
||||||
scope(exit)
|
scope(exit)
|
||||||
func2();
|
func2();
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: asm not allowed in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: asm not allowed in `@compute` code
|
||||||
asm {ret;}
|
asm {ret;}
|
||||||
}
|
}
|
||||||
|
|
||||||
void func1() {}
|
void func1() {}
|
||||||
void func2() {}
|
void func2() {}
|
||||||
|
|
||||||
//CHECK: dcompute.d([[@LINE+1]]): Error: pragma lib linking additional libraries not supported in @compute code
|
//CHECK: dcompute.d([[@LINE+1]]): Error: pragma lib linking additional libraries not supported in `@compute` code
|
||||||
pragma(lib, "bar");
|
pragma(lib, "bar");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue