diff --git a/driver/codegenerator.cpp b/driver/codegenerator.cpp index 80d4f44819..c452e2f13b 100644 --- a/driver/codegenerator.cpp +++ b/driver/codegenerator.cpp @@ -170,7 +170,7 @@ namespace ldc { CodeGenerator::CodeGenerator(llvm::LLVMContext &context, bool singleObj) : context_(context), moduleCount_(0), singleObj_(singleObj), ir_(nullptr) { 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"); fatal(); } diff --git a/driver/main.cpp b/driver/main.cpp index 85091f9ae9..80f46112f9 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -534,11 +534,9 @@ void parseCommandLine(int argc, char **argv, Strings &sourceFiles, } if (noDefaultLib) { - deprecation( - Loc(), - "-nodefaultlib is deprecated, as " - "-defaultlib/-debuglib now override the existing list instead of " - "appending to it. Please use the latter instead."); + deprecation(Loc(), "-nodefaultlib is deprecated, as -defaultlib/-debuglib " + "now override the existing list instead of appending to " + "it. Please use the latter instead."); } else { // Parse comma-separated default library list. std::stringstream libNames(linkDebugLib ? debugLib : defaultLib); diff --git a/driver/tool.cpp b/driver/tool.cpp index 439522b54a..f023d29de8 100644 --- a/driver/tool.cpp +++ b/driver/tool.cpp @@ -269,7 +269,7 @@ bool setupMsvcEnvironmentImpl() { const int exitCode = executeAndWait(commandLine.c_str()); 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); return false; } diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 32e07ac920..770152df48 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -1266,7 +1266,7 @@ DValue *DtoCastArray(Loc &loc, DValue *u, Type *to) { Type *totype = to->toBasetype(); Type *fromtype = u->type->toBasetype(); 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(); } @@ -1297,7 +1297,7 @@ DValue *DtoCastArray(Loc &loc, DValue *u, Type *to) { totype->nextOf()->size() != 0) { 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()); fatal(); } diff --git a/gen/asm-x86.h b/gen/asm-x86.h index 1bde2d9e93..03405105e4 100644 --- a/gen/asm-x86.h +++ b/gen/asm-x86.h @@ -2178,7 +2178,7 @@ struct AsmProcessor { } } while (i != j); - stmt->error("unknown opcode '%s'", opcode); + stmt->error("unknown opcode `%s`", opcode); return Op_Invalid; } @@ -2237,7 +2237,7 @@ struct AsmProcessor { if (token->value == TOKcomma) { nextToken(); } 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; } } @@ -2339,7 +2339,7 @@ struct AsmProcessor { break; 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()); break; @@ -2369,7 +2369,7 @@ struct AsmProcessor { break; } } - stmt->error("unsupported memory reference to '%s' in naked asm", + stmt->error("unsupported memory reference to `%s` in naked asm", e->toChars()); break; @@ -2593,7 +2593,7 @@ struct AsmProcessor { if (operands[1].cls == Opr_Reg && operands[1].reg == Reg_ST) { nOperands = 1; } 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); 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); } @@ -3598,7 +3598,7 @@ struct AsmProcessor { if (token->value == TOKrbracket) { nextToken(); } else { - stmt->error("missing ']'"); + stmt->error("missing `]`"); } } @@ -3654,7 +3654,7 @@ struct AsmProcessor { stmt->error("multiple specifications of operand size"); } } else { - stmt->error("unknown operand size '%s'", token->toChars()); + stmt->error("unknown operand size `%s`", token->toChars()); } nextToken(); nextToken(); @@ -3666,11 +3666,11 @@ struct AsmProcessor { case TOKidentifier: if (token->ident == ident_seg) { nextToken(); - stmt->error("'seg' not supported"); + stmt->error("`seg` not supported"); e = parseAsmExp(); } else if (token->ident == Id::offset || token->ident == Id::offsetof) { if (token->ident == Id::offset && !global.params.useDeprecated) { - stmt->error("offset deprecated, use offsetof"); + stmt->error("offset deprecated, use `offsetof`"); } nextToken(); e = parseAsmExp(); @@ -3779,7 +3779,7 @@ struct AsmProcessor { if (token->value == TOKrparen) { nextToken(); } else { - stmt->error("expected ')'"); + stmt->error("expected `)`"); } return e; default: @@ -3795,7 +3795,7 @@ struct AsmProcessor { } else if (i >= Reg_CS && i <= Reg_GS) { operand->segmentPrefix = static_cast(i); } else { - stmt->error("'%s' is not a segment register", ident->toChars()); + stmt->error("`%s` is not a segment register", ident->toChars()); } return parseAsmExp(); } diff --git a/gen/classes.cpp b/gen/classes.cpp index 68b6eddeb1..a6522da228 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -563,7 +563,7 @@ LLConstant *DtoDefineClassInfo(ClassDeclaration *cd) { ClassDeclaration *cinfo = Type::typeinfoclass; 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)"); fatal(); } diff --git a/gen/complex.cpp b/gen/complex.cpp index c0b450c835..80e468c625 100644 --- a/gen/complex.cpp +++ b/gen/complex.cpp @@ -497,6 +497,7 @@ DValue *DtoCastComplex(Loc &loc, DValue *val, Type *_to) { auto re = new DImValue(extractty, repart); 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(); } diff --git a/gen/functions.cpp b/gen/functions.cpp index 5fbb9920f4..58aba67450 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -294,7 +294,7 @@ llvm::FunctionType *DtoFunctionType(FuncDeclaration *fdecl) { if (fdecl->selector) { hasSel = true; } 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(fdecl->type); if (tf->varargs != 1 || (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"); fatal(); } @@ -535,7 +535,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) { } else if (func->getFunctionType() != functype) { error(fdecl->loc, "Function type does not match previously declared " - "function with the same mangled name: %s", + "function with the same mangled name: `%s`", mangleExact(fdecl)); fatal(); } @@ -571,7 +571,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) { // Detect multiple main functions, which is disallowed. DMD checks this // in the glue code, so we need to do it here as well. if (gIR->mainFunc) { - error(fdecl->loc, "only one main function allowed"); + error(fdecl->loc, "only one `main` function allowed"); } gIR->mainFunc = func; } @@ -812,7 +812,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) { // the codegen expect irFunc to be set for defined functions. error(fd->loc, "Internal Compiler Error: function not fully analyzed; " - "previous unreported errors compiling %s?", + "previous unreported errors compiling `%s`?", fd->toPrettyChars()); fatal(); } @@ -885,7 +885,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) { if (fd->semanticRun != PASSsemantic3done) { error(fd->loc, "Internal Compiler Error: function not fully analyzed; " - "previous unreported errors compiling %s?", + "previous unreported errors compiling `%s`?", fd->toPrettyChars()); fatal(); } diff --git a/gen/inlineir.cpp b/gen/inlineir.cpp index 9a30211b14..cc400c5dfc 100644 --- a/gen/inlineir.cpp +++ b/gen/inlineir.cpp @@ -90,8 +90,8 @@ DValue *DtoInlineIRExpr(Loc &loc, FuncDeclaration *fdecl, // assert(ty); if (!ty) { error(tinst->loc, "All parameters of a template defined with pragma " - "LDC_inline_ir, except for the first one, should be " - "types"); + "`LDC_inline_ir`, except for the first one, should " + "be types"); fatal(); } stream << *DtoType(ty); @@ -117,12 +117,12 @@ DValue *DtoInlineIRExpr(Loc &loc, FuncDeclaration *fdecl, std::string errstr = err.getMessage(); if (!errstr.empty()) { - error( - tinst->loc, - "can't parse inline LLVM IR:\n%s\n%s\n%s\nThe input string was: \n%s", - err.getLineContents().str().c_str(), - (std::string(err.getColumnNo(), ' ') + '^').c_str(), errstr.c_str(), - stream.str().c_str()); + error(tinst->loc, + "can't parse inline LLVM IR:\n`%s`\n%s\n%s\nThe input string " + "was:\n`%s`", + err.getLineContents().str().c_str(), + (std::string(err.getColumnNo(), ' ') + '^').c_str(), errstr.c_str(), + stream.str().c_str()); } m->setDataLayout(gIR->module.getDataLayout()); diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 0c912304da..2ecbdde95e 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -296,7 +296,7 @@ void DtoGoto(Loc &loc, LabelDsymbol *target) { LabelStatement *lblstmt = target->statement; 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(); } @@ -412,7 +412,7 @@ DValue *DtoNullValue(Type *type, Loc loc) { LLValue *ptr = getNullPtr(DtoPtrToType(basetype->nextOf())); 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(); } @@ -463,7 +463,7 @@ DValue *DtoCastInt(Loc &loc, DValue *val, Type *_to) { IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n'; rval = gIR->ir->CreateIntToPtr(rval, tolltype); } 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()); fatal(); } @@ -495,7 +495,7 @@ DValue *DtoCastPtr(Loc &loc, DValue *val, Type *to) { } else if (totype->isintegral()) { rval = new llvm::PtrToIntInst(DtoRVal(val), tolltype, "", gIR->scopebb()); } 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()); fatal(); } @@ -534,7 +534,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) { } else if (fromsz > tosz) { rval = new llvm::FPTruncInst(DtoRVal(val), tolltype, "", gIR->scopebb()); } 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()); fatal(); } @@ -545,7 +545,7 @@ DValue *DtoCastFloat(Loc &loc, DValue *val, Type *to) { rval = new llvm::FPToSIInst(DtoRVal(val), tolltype, "", gIR->scopebb()); } } 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()); fatal(); } @@ -561,7 +561,7 @@ DValue *DtoCastDelegate(Loc &loc, DValue *val, Type *to) { return new DImValue(to, 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()); fatal(); } @@ -593,7 +593,7 @@ DValue *DtoCastVector(Loc &loc, DValue *val, Type *to) { if (totype->ty == Tvector && to->size() == val->type->size()) { 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()); fatal(); } @@ -610,7 +610,7 @@ DValue *DtoCastStruct(Loc &loc, DValue *val, Type *to) { 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()); fatal(); } @@ -679,7 +679,7 @@ DValue *DtoCast(Loc &loc, DValue *val, Type *to) { } // fall-through 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()); fatal(); } @@ -1243,7 +1243,8 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti, char prefix = T->isreal() ? 'f' : T->isintegral() ? 'i' : 0; 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 } @@ -1269,13 +1270,13 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti, } else { if (pos && (name[pos - 1] == 'i' || name[pos - 1] == 'f')) { // Wrong type character. - ti->error( - "has invalid parameter type for intrinsic %s: %s is not a%s type", - name.c_str(), T->toChars(), - (name[pos - 1] == 'i' ? "n integral" : " floating-point")); + ti->error("has invalid parameter type for intrinsic `%s`: `%s` is not " + "a%s type", + name.c_str(), T->toChars(), + (name[pos - 1] == 'i' ? "n integral" : " floating-point")); } else { // 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 } @@ -1393,7 +1394,7 @@ void callPostblit(Loc &loc, Expression *exp, LLValue *val) { FuncDeclaration *fd = sd->postblit; if (fd->storage_class & STCdisable) { 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); Expressions args; @@ -1518,7 +1519,7 @@ DValue *DtoSymbolAddress(Loc &loc, Type *type, Declaration *decl) { // this is an error! must be accessed with DotVarExp if (vd->needThis()) { - error(loc, "need 'this' to access member %s", vd->toChars()); + error(loc, "need `this` to access member `%s`", vd->toChars()); fatal(); } @@ -1648,7 +1649,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) { // TODO: This check really does not belong here, should be moved to // semantic analysis in the frontend. if (decl->needThis()) { - error(loc, "need 'this' to access %s", decl->toChars()); + error(loc, "need `this` to access `%s`", decl->toChars()); fatal(); } @@ -1660,7 +1661,7 @@ llvm::Constant *DtoConstSymbolAddress(Loc &loc, Declaration *decl) { // AssocArrayLiteralExp::toElem, which requires on error // gagging to check for constantness of the initializer. error(loc, - "cannot use address of non-global variable '%s' as constant " + "cannot use address of non-global variable `%s` as constant " "initializer", vd->toChars()); if (!global.gag) { @@ -1730,7 +1731,7 @@ llvm::GlobalVariable *getOrCreateGlobal(const Loc &loc, llvm::Module &module, if (existing->getType()->getElementType() != type) { error(loc, "Global variable type does not match previous declaration with " - "same mangled name: %s", + "same mangled name: `%s`", name.str().c_str()); fatal(); } diff --git a/gen/moduleinfo.cpp b/gen/moduleinfo.cpp index 6fb8c9c12b..a2e03beee9 100644 --- a/gen/moduleinfo.cpp +++ b/gen/moduleinfo.cpp @@ -195,7 +195,7 @@ llvm::Constant *buildLocalClasses(Module *m, size_t &count) { llvm::GlobalVariable *genModuleInfo(Module *m) { if (!Module::moduleinfo) { - m->error("object.d is missing the ModuleInfo struct"); + m->error("object.d is missing the `ModuleInfo` struct"); fatal(); } @@ -204,7 +204,7 @@ llvm::GlobalVariable *genModuleInfo(Module *m) { // should consist only of the _flags/_index fields (the latter of which is // unused). 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)"); fatal(); } diff --git a/gen/modules.cpp b/gen/modules.cpp index 6a3e061e29..7b960151fb 100644 --- a/gen/modules.cpp +++ b/gen/modules.cpp @@ -71,8 +71,8 @@ void Module::checkAndAddOutputFile(File *file) { if (i != files.end()) { Module *previousMod = i->second; ::error(Loc(), - "Output file '%s' for module '%s' collides with previous " - "module '%s'. See the -oq option", + "Output file '%s' for module `%s` collides with previous " + "module `%s`. See the -oq option", key.c_str(), toPrettyChars(), previousMod->toPrettyChars()); fatal(); } @@ -617,7 +617,7 @@ void loadInstrProfileData(IRState *irs) { #if LDC_LLVM_VER >= 309 if (auto E = readerOrErr.takeError()) { 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, EI.message().c_str()); }); @@ -626,7 +626,7 @@ void loadInstrProfileData(IRState *irs) { #else std::error_code EC = readerOrErr.getError(); 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, EC.message().c_str()); fatal(); diff --git a/gen/naked.cpp b/gen/naked.cpp index 5208e15c15..760a076f6e 100644 --- a/gen/naked.cpp +++ b/gen/naked.cpp @@ -99,13 +99,13 @@ public: return; } 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()); return; } if (fd && !fd->isStatic()) { 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()); return; } @@ -331,7 +331,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc &loc, return; #endif } else { - error(loc, "unimplemented return type '%s' for implicit abi return", + error(loc, "unimplemented return type `%s` for implicit abi return", rt->toChars()); fatal(); } @@ -380,7 +380,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc &loc, as->out_c = "={ax},={dx},"; asmblock->retn = 2; } else { - error(loc, "unimplemented return type '%s' for implicit abi return", + error(loc, "unimplemented return type `%s` for implicit abi return", rt->toChars()); fatal(); } @@ -415,7 +415,7 @@ DValue *DtoInlineAsmExpr(Loc &loc, FuncDeclaration *fd, Expressions *arguments, IF_LOG Logger::println("code exp: %s", e->toChars()); StringExp *se = static_cast(e); 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(); } 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()); se = static_cast(e); 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(); } 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 if (!llvm::InlineAsm::Verify(FT, constraints)) { - e->error("__asm constraint argument is invalid"); + e->error("`__asm` constraint argument is invalid"); fatal(); } diff --git a/gen/nested.cpp b/gen/nested.cpp index c6277927b5..90fc8a9cb0 100644 --- a/gen/nested.cpp +++ b/gen/nested.cpp @@ -46,7 +46,7 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd, fd = getParentFunc(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()); 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 // unfortunately not caught in the frontend (e.g. a function literal // tries to call a nested function from the parent scope). - error(loc, - "function %s is a nested function and cannot be accessed from %s", - sym->toPrettyChars(), irFunc.decl->toPrettyChars()); + error( + loc, + "function `%s` is a nested function and cannot be accessed from `%s`", + sym->toPrettyChars(), irFunc.decl->toPrettyChars()); fatal(); } return llvm::ConstantPointerNull::get(getVoidPtrType()); diff --git a/gen/pgo.cpp b/gen/pgo.cpp index 1dde5f8786..c4b83b8c6a 100644 --- a/gen/pgo.cpp +++ b/gen/pgo.cpp @@ -930,7 +930,7 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader, "Ignoring profile data: hash mismatch for function: %s", FuncName.c_str()); warning(fd->loc, - "Ignoring profile data for function '%s' ('%s'): " + "Ignoring profile data for function `%s` (`%s`): " "control-flow hash mismatch", const_cast(fd)->toPrettyChars(), FuncName.c_str()); @@ -938,14 +938,14 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader, IF_LOG Logger::println("Profile data is malformed for function: %s", FuncName.c_str()); warning(fd->loc, - "Ignoring profile data for function '%s' ('%s'): " + "Ignoring profile data for function `%s` (`%s`): " "control-flow hash mismatch", const_cast(fd)->toPrettyChars(), FuncName.c_str()); } else { IF_LOG Logger::println("Error loading profile counts for function: %s", 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(fd)->toPrettyChars(), FuncName.c_str()); } diff --git a/gen/pragma.cpp b/gen/pragma.cpp index 2d36a6c2d1..8faed564ff 100644 --- a/gen/pragma.cpp +++ b/gen/pragma.cpp @@ -107,7 +107,7 @@ LDCPragma DtoGetPragma(Scope *sc, PragmaDeclaration *decl, fatal(); } if (priority > 65535) { - error(Loc(), "priority may not be greater then 65535"); + error(Loc(), "priority may not be greater than 65535"); priority = 65535; } } else { @@ -285,7 +285,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (s->llvmInternal) { error(Loc(), "multiple LDC specific pragmas not allowed not affect the same " - "declaration ('%s' at '%s')", + "declaration (`%s` at '%s')", s->toChars(), s->loc.toChars()); fatal(); } @@ -302,7 +302,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, td->llvmInternal = llvm_internal; td->intrinsicName = strdup(arg1str); } 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", ident->toChars()); fatal(); @@ -317,8 +317,9 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, Type *retType = type->next; if (retType->ty != Tvoid || type->parameters->dim > 0 || (fd->isMember() && !fd->isStatic())) { - error(s->loc, "the '%s' pragma is only allowed on void functions which " - "take no arguments", + error(s->loc, + "the `%s` pragma is only allowed on `void` functions which take " + "no arguments", ident->toChars()); fd->llvmInternal = LLVMnone; break; @@ -327,7 +328,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, fd->llvmInternal = llvm_internal; fd->priority = std::atoi(arg1str); } 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()); s->llvmInternal = LLVMnone; } @@ -338,7 +339,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, td->llvmInternal = llvm_internal; td->intrinsicName = strdup(arg1str); } 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()); fatal(); } @@ -353,21 +354,21 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (td->parameters->dim != 1) { error( s->loc, - "the '%s' pragma template must have exactly one template parameter", + "the `%s` pragma template must have exactly one template parameter", ident->toChars()); fatal(); } 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()); fatal(); } 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()); fatal(); } td->llvmInternal = llvm_internal; } 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()); fatal(); } @@ -385,7 +386,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (FuncDeclaration *fd = s->isFuncDeclaration()) { fd->llvmInternal = llvm_internal; } 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()); fatal(); } @@ -400,8 +401,8 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, fd->llvmInternal = llvm_internal; } else { error(s->loc, - "the '%s' pragma must only be used on function declarations " - "of type 'void* function(uint nbytes)'", + "the `%s` pragma must only be used on function declarations " + "of type `void* function(uint nbytes)`", ident->toChars()); fatal(); } @@ -410,18 +411,18 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, case LLVMinline_asm: if (TemplateDeclaration *td = s->isTemplateDeclaration()) { 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", ident->toChars()); fatal(); } 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()); fatal(); } td->llvmInternal = llvm_internal; } 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()); fatal(); } @@ -431,7 +432,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (TemplateDeclaration *td = s->isTemplateDeclaration()) { Dsymbol *member = td->onemember; 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()); fatal(); } @@ -439,7 +440,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (!fun) { error( 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()); fatal(); } @@ -456,7 +457,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, if (!valid_params) { 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", ident->toChars()); fatal(); @@ -464,7 +465,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, td->llvmInternal = llvm_internal; } 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()); fatal(); } @@ -473,7 +474,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, case LLVMextern_weak: if (VarDeclaration *vd = s->isVarDeclaration()) { 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(); } @@ -482,7 +483,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, // symbol is non-zero on the ELF static TLS model on Linux x86_64). // Thus, just disallow this altogether. 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()); fatal(); } @@ -492,7 +493,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, // fail because 'extern' creates an intermediate // StorageClassDeclaration. This might eventually be fixed by making // 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", ident->toChars()); fatal(); @@ -501,7 +502,7 @@ void DtoCheckPragma(PragmaDeclaration *decl, Dsymbol *s, default: 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()); } } diff --git a/gen/runtime.cpp b/gen/runtime.cpp index f96961311b..c644dce75f 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -98,7 +98,7 @@ static void checkForImplicitGCCall(const Loc &loc, const char *name) { &GCNAMES[sizeof(GCNAMES) / sizeof(std::string)], name)) { error(loc, "No implicit garbage collector calls allowed with -nogc " - "option enabled: %s", + "option enabled: `%s`", name); fatal(); } @@ -137,14 +137,14 @@ llvm::Function *getRuntimeFunction(const Loc &loc, llvm::Module &target, LLFunction *fn = M->getFunction(name); if (!fn) { - error(loc, "Runtime function '%s' was not found", name); + error(loc, "Runtime function `%s` was not found", name); fatal(); } LLFunctionType *fnty = fn->getFunctionType(); if (LLFunction *existing = target.getFunction(name)) { if (existing->getFunctionType() != fnty) { - error(Loc(), "Incompatible declaration of runtime function '%s'", name); + error(Loc(), "Incompatible declaration of runtime function `%s`", name); fatal(); } return existing; @@ -174,7 +174,7 @@ llvm::GlobalVariable *getRuntimeGlobal(Loc &loc, llvm::Module &target, LLGlobalVariable *g = M->getNamedGlobal(name); if (!g) { - error(loc, "Runtime global '%s' was not found", name); + error(loc, "Runtime global `%s` was not found", name); fatal(); // return NULL; } @@ -216,7 +216,7 @@ static Type *rt_dg2() { template static void ensureDecl(DECL *decl, const char *msg) { if (!decl || !decl->type) { Logger::println("Missing class declaration: %s\n", msg); - error(Loc(), "Missing class declaration: %s", msg); + error(Loc(), "Missing class declaration: `%s`", msg); errorSupplemental(Loc(), "Please check that object.d is included and valid"); fatal(); diff --git a/gen/semantic-dcompute.cpp b/gen/semantic-dcompute.cpp index 98235c4f9d..b3cfa917bb 100644 --- a/gen/semantic-dcompute.cpp +++ b/gen/semantic-dcompute.cpp @@ -30,7 +30,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { 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. // 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 @@ -68,12 +68,12 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { } 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; } 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; } @@ -82,7 +82,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { if (decl->isDataseg()) { if (strncmp(decl->toChars(), "__critsec", 9) && 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. stop = true; @@ -90,18 +90,18 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { } 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; } // includes interfaces 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 { if (decl->ident == Id::lib) { decl->error( - "linking additional libraries not supported in @compute code"); + "linking additional libraries not supported in `@compute` code"); stop = true; } } @@ -111,66 +111,66 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { void visit(ArrayLiteralExp *e) override { if (e->type->ty != Tarray || !e->elements || !e->elements->dim) return; - e->error("array literal in @compute code not allowed"); + e->error("array literal in `@compute` code not allowed"); stop = true; } void visit(NewExp *e) override { - e->error("cannot use 'new' in @compute code"); + e->error("cannot use `new` in `@compute` code"); stop = true; } void visit(DeleteExp *e) override { - e->error("cannot use 'delete' in @compute code"); + e->error("cannot use `delete` in `@compute` code"); stop = true; } // No need to check IndexExp because AA's are banned anyway void visit(AssignExp *e) override { 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; } } void visit(CatAssignExp *e) override { - e->error("cannot use operator ~= in @compute code"); + e->error("cannot use operator `~=` in `@compute` code"); stop = true; } void visit(CatExp *e) override { - e->error("cannot use operator ~ in @compute code"); + e->error("cannot use operator `~` in `@compute` code"); stop = true; } // Ban typeid(T) void visit(TypeidExp *e) override { - e->error("typeinfo not available in @compute code"); + e->error("typeinfo not available in `@compute` code"); stop = true; } 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; } void visit(CompoundAsmStatement *e) override { - e->error("asm not allowed in @compute code"); + e->error("asm not allowed in `@compute` code"); stop = true; } void visit(AsmStatement *e) override { - e->error("asm not allowed in @compute code"); + e->error("asm not allowed in `@compute` code"); stop = true; } // Enforce nothrow. Disallow 'catch' as it is dead code. // try...finally is allowed to facilitate scope(exit) void visit(TryCatchStatement *e) override { - e->error("no exceptions in @compute code"); + e->error("no exceptions in `@compute` code"); stop = true; } void visit(ThrowStatement *e) override { - e->error("no exceptions in @compute code"); + e->error("no exceptions in `@compute` code"); stop = true; } void visit(SwitchStatement *e) override { 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; } } @@ -198,7 +198,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { // So we intercept it with the CallExp ---- if (e->f->ident == Id::criticalenter) { - e->error("cannot use 'synchronized' in @compute code"); + e->error("cannot use `synchronized` in `@compute` code"); stop = true; return; } @@ -211,15 +211,15 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { Module *m = e->f->getModule(); if ((m == nullptr || (hasComputeAttr(m) == DComputeCompileFor::hostOnly)) && !isNonComputeCallExpVaild(e)) { - e->error("can only call functions from other @compute modules in " - "@compute code"); + e->error("can only call functions from other `@compute` modules in " + "`@compute` code"); stop = true; } } void visit(FuncDeclaration *fd) override { if (hasKernelAttr(fd) && fd->vthis) { - fd->error("@kernel functions must not require 'this'"); + fd->error("`@kernel` functions must not require `this`"); stop = true; return; } diff --git a/gen/statements.cpp b/gen/statements.cpp index 3cefbc40a5..73ffe81c93 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -1684,7 +1684,7 @@ public: ////////////////////////////////////////////////////////////////////////// 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()); fatal(); } @@ -1692,7 +1692,7 @@ public: ////////////////////////////////////////////////////////////////////////// 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()); fatal(); } diff --git a/gen/structs.cpp b/gen/structs.cpp index fa1ab624d2..8268f0edd4 100644 --- a/gen/structs.cpp +++ b/gen/structs.cpp @@ -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 (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()); fatal(); } diff --git a/gen/target.cpp b/gen/target.cpp index 7076231012..847f4bea2a 100644 --- a/gen/target.cpp +++ b/gen/target.cpp @@ -90,7 +90,7 @@ void Target::_init() { RealProperties.min_10_exp = -4931; } else { // leave initialized with host real_t values - warning(Loc(), "unknown properties for target real type"); + warning(Loc(), "unknown properties for target `real` type"); } } diff --git a/gen/tocall.cpp b/gen/tocall.cpp index 4ad582214b..7510297f62 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -260,7 +260,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // va_start instruction if (fndecl->llvmInternal == LLVMva_start) { 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(); } DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list @@ -279,7 +279,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // va_copy instruction if (fndecl->llvmInternal == LLVMva_copy) { if (e->arguments->dim != 2) { - e->error("va_copy instruction expects 2 arguments"); + e->error("`va_copy` instruction expects 2 arguments"); fatal(); } DLValue *dest = toElem((*e->arguments)[0])->isLVal(); // va_list @@ -293,11 +293,11 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // va_arg instruction if (fndecl->llvmInternal == LLVMva_arg) { if (e->arguments->dim != 1) { - e->error("va_arg instruction expects 1 argument"); + e->error("`va_arg` instruction expects 1 argument"); fatal(); } 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(); } DLValue *ap = toElem((*e->arguments)[0])->isLVal(); // va_list @@ -311,7 +311,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // C alloca if (fndecl->llvmInternal == LLVMalloca) { if (e->arguments->dim != 1) { - e->error("alloca expects 1 arguments"); + e->error("`alloca` expects 1 argument"); fatal(); } Expression *exp = (*e->arguments)[0]; @@ -328,7 +328,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // fence instruction if (fndecl->llvmInternal == LLVMfence) { 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(); } auto atomicOrdering = @@ -383,7 +383,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, } } else { errorStore: - e->error("atomic store only supports integer types, not '%s'", + e->error("atomic store only supports integer types, not `%s`", exp1->type->toChars()); fatal(); } @@ -427,7 +427,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, } } else { errorLoad: - e->error("atomic load only supports integer types, not '%s'", + e->error("atomic load only supports integer types, not `%s`", retType->toChars()); fatal(); } @@ -449,7 +449,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // cmpxchg instruction if (fndecl->llvmInternal == LLVMatomic_cmp_xchg) { if (e->arguments->dim != 4) { - e->error("cmpxchg instruction expects 4 arguments"); + e->error("`cmpxchg` instruction expects 4 arguments"); fatal(); } Expression *exp1 = (*e->arguments)[0]; @@ -483,7 +483,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, } } else { errorCmpxchg: - e->error("cmpxchg only supports integer types, not '%s'", + e->error("`cmpxchg` only supports integer types, not `%s`", exp2->type->toChars()); fatal(); } @@ -508,7 +508,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, // atomicrmw instruction if (fndecl->llvmInternal == LLVMatomic_rmw) { if (e->arguments->dim != 3) { - e->error("atomic_rmw instruction expects 3 arguments"); + e->error("`atomic_rmw` instruction expects 3 arguments"); fatal(); } @@ -519,7 +519,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, int op = 0; for (;; ++op) { if (ops[op] == nullptr) { - e->error("unknown atomic_rmw operation %s", + e->error("unknown atomic_rmw operation `%s`", fndecl->intrinsicName); fatal(); } @@ -601,7 +601,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, if (fndecl->llvmInternal == LLVMbitop_vld) { if (e->arguments->dim != 1) { - e->error("bitop.vld intrinsic expects 1 argument"); + e->error("`bitop.vld` intrinsic expects 1 argument"); fatal(); } // TODO: Check types @@ -614,7 +614,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, if (fndecl->llvmInternal == LLVMbitop_vst) { if (e->arguments->dim != 2) { - e->error("bitop.vst intrinsic expects 2 arguments"); + e->error("`bitop.vst` intrinsic expects 2 arguments"); fatal(); } // TODO: Check types diff --git a/gen/toconstelem.cpp b/gen/toconstelem.cpp index a614694475..9d3155dc84 100644 --- a/gen/toconstelem.cpp +++ b/gen/toconstelem.cpp @@ -79,7 +79,7 @@ public: VarDeclaration *vd = e->var->isVarDeclaration(); if (vd && vd->isConst() && vd->_init) { if (vd->inuse) { - e->error("recursive reference %s", e->toChars()); + e->error("recursive reference `%s`", e->toChars()); result = llvm::UndefValue::get(DtoType(e->type)); } else { vd->inuse++; @@ -90,7 +90,7 @@ public: } // fail else { - e->error("non-constant expression %s", e->toChars()); + e->error("non-constant expression `%s`", e->toChars()); result = llvm::UndefValue::get(DtoType(e->type)); } } @@ -218,7 +218,7 @@ public: result = llvm::ConstantExpr::getGetElementPtr( isaPointer(ptr)->getElementType(), ptr, DtoConstSize_t(idx)); } else { - e->error("expression '%s' is not a constant", e->toChars()); + e->error("expression `%s` is not a constant", e->toChars()); if (!global.gag) { fatal(); } @@ -240,7 +240,7 @@ public: result = llvm::ConstantExpr::getGetElementPtr( isaPointer(ptr)->getElementType(), ptr, negIdx); } else { - e->error("expression '%s' is not a constant", e->toChars()); + e->error("expression `%s` is not a constant", e->toChars()); if (!global.gag) { fatal(); } @@ -271,7 +271,7 @@ public: } size_t arrlen = datalen / eltype->size(); #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); } // pointer to pointer @@ -320,7 +320,7 @@ public: return; 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()); if (!global.gag) { fatal(); @@ -429,7 +429,7 @@ public: result = se->globalVar; } 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) { fatal(); } @@ -437,7 +437,7 @@ public: } // not yet supported else { - e->error("constant expression '%s' not yet implemented", e->toChars()); + e->error("constant expression `%s` not yet implemented", e->toChars()); fatal(); } } @@ -463,7 +463,7 @@ public: if (fd->tok != TOKfunction) { 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()); if (!global.gag) { fatal(); @@ -712,7 +712,7 @@ public: ////////////////////////////////////////////////////////////////////////////// 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) { fatal(); } diff --git a/gen/toir.cpp b/gen/toir.cpp index d95e24866e..134eba25c1 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -557,7 +557,7 @@ public: // valid array ops would have been transformed by optimize if ((t1->ty == Tarray || t1->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(); } } @@ -1870,8 +1870,8 @@ public: LOG_SCOPE; if (e->func->isStatic()) { - e->error("can't take delegate of static function %s, it does not require " - "a context ptr", + e->error("can't take delegate of static function `%s`, it does not " + "require a context ptr", e->func->toChars()); } @@ -2545,7 +2545,7 @@ public: ////////////////////////////////////////////////////////////////////////////// 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 // some more sensible error messages will be triggered. fatal(); @@ -2627,7 +2627,7 @@ public: IF_LOG Logger::print("PowExp::toElem() %s\n", e->toChars()); 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))); } @@ -2674,7 +2674,7 @@ public: #define STUB(x) \ 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()); \ fatal(); \ } diff --git a/gen/trycatchfinally.cpp b/gen/trycatchfinally.cpp index bdd40f5bfd..4456215fdc 100644 --- a/gen/trycatchfinally.cpp +++ b/gen/trycatchfinally.cpp @@ -434,7 +434,7 @@ TryCatchFinallyScopes::~TryCatchFinallyScopes() { // cleanup scopes, both of which are not allowed in D. if (!currentUnresolvedGotos().empty()) { 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(); } diff --git a/gen/typinf.cpp b/gen/typinf.cpp index e8583d4447..2208f9eed1 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -306,7 +306,7 @@ public: // can't emit typeinfo for forward declarations if (sd->sizeok != SIZEOKdone) { - sd->error("cannot emit TypeInfo for forward declaration"); + sd->error("cannot emit `TypeInfo` for forward declaration"); fatal(); } @@ -351,7 +351,7 @@ public: global.params.targetTriple->getArch() == llvm::Triple::x86_64; const unsigned expectedFields = 12 + (isX86_64 ? 2 : 0); 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"); fatal(); } diff --git a/gen/uda.cpp b/gen/uda.cpp index 806bd4fd3c..ed8a3c8917 100644 --- a/gen/uda.cpp +++ b/gen/uda.cpp @@ -62,7 +62,7 @@ StructLiteralExp *getLdcAttributesStruct(Expression *attr) { void checkStructElems(StructLiteralExp *sle, ArrayParam elemTypes) { if (sle->elements->dim != elemTypes.size()) { 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?", sle->sd->getModule()->md->id->toChars(), sle->sd->ident->toChars()); @@ -71,7 +71,7 @@ void checkStructElems(StructLiteralExp *sle, ArrayParam elemTypes) { for (size_t i = 0; i < sle->elements->dim; ++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?", sle->sd->getModule()->md->id->toChars(), sle->sd->ident->toChars()); @@ -142,14 +142,14 @@ void applyAttrAllocSize(StructLiteralExp *sle, IrFunction *irFunc) { // Verify that the index values are valid bool error = false; if (sizeArgIdx + 1 > sinteger_t(numUserParams)) { - sle->error("@ldc.attributes.allocSize.sizeArgIdx=%d too large for function " - "`%s` with %d arguments.", + sle->error("`@ldc.attributes.allocSize.sizeArgIdx=%d` too large for " + "function `%s` with %d arguments.", (int)sizeArgIdx, irFunc->decl->toChars(), (int)numUserParams); error = true; } if (numArgIdx + 1 > sinteger_t(numUserParams)) { - sle->error("@ldc.attributes.allocSize.numArgIdx=%d too large for function " - "`%s` with %d arguments.", + sle->error("`@ldc.attributes.allocSize.numArgIdx=%d` too large for " + "function `%s` with %d arguments.", (int)numArgIdx, irFunc->decl->toChars(), (int)numUserParams); error = true; } @@ -221,7 +221,7 @@ void applyAttrLLVMFastMathFlag(StructLiteralExp *sle, IrFunction *irFunc) { #if LDC_LLVM_VER >= 500 irFunc->FMF.setAllowContract(true); #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", sle->sd->ident->toChars()); #endif @@ -237,7 +237,7 @@ void applyAttrLLVMFastMathFlag(StructLiteralExp *sle, IrFunction *irFunc) { // `value` is a null-terminated returned from getStringElem so can be passed // to warning("... %s ..."). 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()); } } @@ -249,8 +249,8 @@ void applyAttrOptStrategy(StructLiteralExp *sle, IrFunction *irFunc) { llvm::Function *func = irFunc->getLLVMFunc(); if (value == "none") { if (irFunc->decl->inlining == PINLINEalways) { - sle->error("cannot combine '@ldc.attributes.%s(\"none\")' with " - "'pragma(inline, true)'", + sle->error("cannot combine `@ldc.attributes.%s(\"none\")` with " + "`pragma(inline, true)`", sle->sd->ident->toChars()); return; } @@ -262,7 +262,7 @@ void applyAttrOptStrategy(StructLiteralExp *sle, IrFunction *irFunc) { func->addFnAttr(llvm::Attribute::MinSize); } else { sle->warning( - "ignoring unrecognized parameter '%s' for '@ldc.attributes.%s'", + "ignoring unrecognized parameter `%s` for `@ldc.attributes.%s`", value.data(), sle->sd->ident->toChars()); } } @@ -355,13 +355,14 @@ void applyVarDeclUDAs(VarDeclaration *decl, llvm::GlobalVariable *gvar) { applyAttrSection(sle, gvar); } else if (ident == Id::udaOptStrategy || ident == Id::udaTarget) { sle->error( - "Special attribute 'ldc.attributes.%s' is only valid for functions", + "Special attribute `ldc.attributes.%s` is only valid for functions", ident->toChars()); } else if (ident == Id::udaWeak) { // @weak is applied elsewhere } else { 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 } else { 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, {}); auto vd = sym->isVarDeclaration(); 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"); return true; } @@ -438,9 +440,10 @@ bool hasKernelAttr(Dsymbol *sym) { checkStructElems(sle, {}); if (!sym->isFuncDeclaration() && - hasComputeAttr(sym->getModule()) != DComputeCompileFor::hostOnly) - sym->error("@ldc.dcompute.kernel can only be applied to functions" - " in modules marked @ldc.dcompute.compute"); + hasComputeAttr(sym->getModule()) != DComputeCompileFor::hostOnly) { + sym->error("`@ldc.dcompute.kernel` can only be applied to functions" + " in modules marked `@ldc.dcompute.compute`"); + } return true; } diff --git a/gen/warnings.cpp b/gen/warnings.cpp index 1428f1c8a8..48c5521151 100644 --- a/gen/warnings.cpp +++ b/gen/warnings.cpp @@ -21,9 +21,9 @@ void warnInvalidPrintfCall(Loc loc, Expression *arguments, size_t nargs) { StringExp *strexp = static_cast(arg); - // not wchar or dhar + // not wchar or dchar 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; } diff --git a/ir/irclass.cpp b/ir/irclass.cpp index e2e2cf860b..b51c1d7c2e 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -208,14 +208,14 @@ LLConstant *IrAggr::getVtblInit() { if (fd->leastAsSpecialized(fd2) || fd2->leastAsSpecialized(fd)) { TypeFunction *tf = static_cast(fd->type); if (tf->ty == Tfunction) { - cd->error("use of %s%s is hidden by %s; use 'alias %s = %s.%s;' " - "to introduce base class overload set", + cd->error("use of `%s%s` is hidden by `%s`; use `alias %s = " + "%s.%s;` to introduce base class overload set", fd->toPrettyChars(), parametersTypeToChars(tf->parameters, tf->varargs), cd->toChars(), fd->toChars(), fd->parent->toChars(), fd->toChars()); } 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()); } fatal(); diff --git a/tests/codegen/asm_constraints.d b/tests/codegen/asm_constraints.d index 39ead6030b..4a6e00d4ab 100644 --- a/tests/codegen/asm_constraints.d +++ b/tests/codegen/asm_constraints.d @@ -2,6 +2,6 @@ void main () { import ldc.llvmasm : __asm; - // CHECK: Error: __asm constraint argument is invalid + // CHECK: Error: `__asm` constraint argument is invalid __asm("", "]["); } diff --git a/tests/codegen/attr_allocsize_diag.d b/tests/codegen/attr_allocsize_diag.d index 1a1f3d2b2e..1094966278 100644 --- a/tests/codegen/attr_allocsize_diag.d +++ b/tests/codegen/attr_allocsize_diag.d @@ -9,8 +9,8 @@ import ldc.attributes; 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+1]]): Error: @ldc.attributes.allocSize.numArgIdx=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. extern (C) void* my_calloc(size_t num, size_t size) @allocSize(2, 2) { return null; @@ -22,8 +22,8 @@ version(THIS) // Test function type with hidden `this` argument 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+1]]): Error: @ldc.attributes.allocSize.numArgIdx=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. void* this_calloc(int size, int b, size_t num, int c) @allocSize(4, 4) { return null; diff --git a/tests/codegen/attr_llvmFMF.d b/tests/codegen/attr_llvmFMF.d index 9656485676..99bc1a34c0 100644 --- a/tests/codegen/attr_llvmFMF.d +++ b/tests/codegen/attr_llvmFMF.d @@ -7,7 +7,7 @@ import ldc.attributes; 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") void foo() {} } diff --git a/tests/semantic/dcompute.d b/tests/semantic/dcompute.d index 11aa980c9c..8ce0edd8e3 100644 --- a/tests/semantic/dcompute.d +++ b/tests/semantic/dcompute.d @@ -6,57 +6,57 @@ import ldc.dcompute; import inputs.notatcompute : somefunc; 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 {} -//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(""); } } -//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; 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; - //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]; - //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; - //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; - //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; - //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; 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; - //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; - //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); - //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); - //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 {} - //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"; - //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) { default: 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(); if (__dcompute_reflect(ReflectTarget.Host,0)) //CHECK-NOT: Error: somefunc(); - //CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in @compute code + //CHECK: dcompute.d([[@LINE+1]]): Error: no exceptions in `@compute` code try { func1(); @@ -66,7 +66,7 @@ void func() } 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; //CHECK-NOT: Error: @@ -82,12 +82,12 @@ void func() scope(exit) 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;} } void func1() {} 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");