From: Iain Buclaw Date: Sun, 7 Jun 2020 17:42:58 +0000 (+0200) Subject: d: Merge upstream dmd 108ca1bcd. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fced594b313ddfb941913b2f59b10ce3514faaf6;p=gcc.git d: Merge upstream dmd 108ca1bcd. Renames OutBuffer::peekString to OutBuffer::peekChars, and OutBuffer::extractString to OutBuffer::extractChars. All callers have been updated as appropriate. Reviewed-on: https://github.com/dlang/dmd/pull/11247 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 108ca1bcd. * d-diagnostic.cc (expand_d_format): Adjust to use extractChars(). * d-frontend.cc (Loc::toChars): Likewise. * d-lang.cc (deps_write): Likewise. (d_parse_file): Likewise. * decl.cc (d_mangle_decl): Likewise. * intrinsics.cc (maybe_set_intrinsic): Likewise. --- diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc index 6af35f71c31..bf10b11d600 100644 --- a/gcc/d/d-diagnostic.cc +++ b/gcc/d/d-diagnostic.cc @@ -110,7 +110,7 @@ expand_d_format (const char *format) } gcc_assert (!inbacktick); - return buf.extractString (); + return buf.extractChars (); } /* Helper routine for all error routines. Reports a diagnostic specified by diff --git a/gcc/d/d-frontend.cc b/gcc/d/d-frontend.cc index 28756161b93..90cf74a0f61 100644 --- a/gcc/d/d-frontend.cc +++ b/gcc/d/d-frontend.cc @@ -122,7 +122,7 @@ Loc::toChars (void) const buf.printf (":%u", this->charnum); } - return buf.extractString (); + return buf.extractChars (); } bool diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index 41921934fdd..2bc0def02c3 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -163,7 +163,7 @@ deps_write (Module *module, OutBuffer *buffer, unsigned colmax = 72) /* Write out make target module name. */ if (d_option.deps_target) { - buffer->writestring (d_option.deps_target->extractString ()); + buffer->writestring (d_option.deps_target->extractChars ()); column = d_option.deps_target->offset; } else @@ -1262,7 +1262,7 @@ d_parse_file (void) to make the middle-end fully deterministic. */ OutBuffer buf; mangleToBuffer (Module::rootModule, &buf); - first_global_object_name = buf.extractString (); + first_global_object_name = buf.extractChars (); } /* Make dependencies. */ diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index f2d39a74cc8..a2a21428a26 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -68,7 +68,7 @@ d_mangle_decl (Dsymbol *decl) { OutBuffer buf; mangleToBuffer (decl, &buf); - return buf.extractString (); + return buf.extractChars (); } } diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 6ccb79c643b..96d579b90fc 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -b0df0e982cc44bd09a9061acfc8160f29767334a +108ca1bcde2096a2c6173c567a204d749538dd74 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/arrayop.c b/gcc/d/dmd/arrayop.c index 3ec07e2b068..3beba9a206b 100644 --- a/gcc/d/dmd/arrayop.c +++ b/gcc/d/dmd/arrayop.c @@ -203,7 +203,7 @@ Expression *arrayOp(BinExp *e, Scope *sc) */ buf.writestring(e->type->toBasetype()->nextOf()->toBasetype()->mutableOf()->deco); - char *name = buf.peekString(); + char *name = buf.peekChars(); Identifier *ident = Identifier::idPool(name); FuncDeclaration **pFd = (FuncDeclaration **)dmd_aaGet(&arrayfuncs, (void *)ident); diff --git a/gcc/d/dmd/attrib.c b/gcc/d/dmd/attrib.c index f4ca06d296a..81b2da11e56 100644 --- a/gcc/d/dmd/attrib.c +++ b/gcc/d/dmd/attrib.c @@ -654,7 +654,7 @@ const char *ProtDeclaration::toPrettyChars(bool) buf.writeByte('\''); protectionToBuffer(&buf, protection); buf.writeByte('\''); - return buf.extractString(); + return buf.extractChars(); } /********************************* AlignDeclaration ****************************/ @@ -1132,7 +1132,7 @@ void PragmaDeclaration::semantic(Scope *sc) if (args->length) buf.writeByte(')'); } - message("pragma %s", buf.peekString()); + message("pragma %s", buf.peekChars()); } goto Lnodecl; } diff --git a/gcc/d/dmd/cppmangle.c b/gcc/d/dmd/cppmangle.c index ee19bd1932a..b361d37f75d 100644 --- a/gcc/d/dmd/cppmangle.c +++ b/gcc/d/dmd/cppmangle.c @@ -632,7 +632,7 @@ class CppMangleVisitor : public Visitor * ::= */ prefix_name(p); - //printf("p: %s\n", buf.peekString()); + //printf("p: %s\n", buf.peekChars()); if (d->isCtorDeclaration()) { @@ -1110,7 +1110,7 @@ public: { buf->writestring("_ZTI"); cpp_mangle_name(s, false); - return buf->extractString(); + return buf->extractChars(); } }; @@ -1120,7 +1120,7 @@ const char *toCppMangleItanium(Dsymbol *s) OutBuffer buf; CppMangleVisitor v(&buf, s->loc); v.mangleOf(s); - return buf.extractString(); + return buf.extractChars(); } const char *cppTypeInfoMangleItanium(Dsymbol *s) @@ -1130,5 +1130,5 @@ const char *cppTypeInfoMangleItanium(Dsymbol *s) buf.writestring("_ZTI"); // "TI" means typeinfo structure CppMangleVisitor v(&buf, s->loc); v.cpp_mangle_name(s, false); - return buf.extractString(); + return buf.extractChars(); } diff --git a/gcc/d/dmd/declaration.c b/gcc/d/dmd/declaration.c index 04f7a34ea97..aa48195794b 100644 --- a/gcc/d/dmd/declaration.c +++ b/gcc/d/dmd/declaration.c @@ -1119,7 +1119,7 @@ Lnomatch: OutBuffer buf; buf.printf("__%s_field_%llu", ident->toChars(), (ulonglong)i); - const char *name = buf.extractString(); + const char *name = buf.extractChars(); Identifier *id = Identifier::idPool(name); Initializer *ti; @@ -1190,7 +1190,7 @@ Lnomatch: { OutBuffer buf; stcToBuffer(&buf, stc); - error("cannot be %s", buf.peekString()); + error("cannot be %s", buf.peekChars()); } storage_class &= ~stc; // strip off } @@ -1202,7 +1202,7 @@ Lnomatch: { OutBuffer buf; stcToBuffer(&buf, stc); - error("cannot be 'scope' and '%s'", buf.peekString()); + error("cannot be 'scope' and '%s'", buf.peekChars()); } else if (isMember()) { @@ -2246,7 +2246,7 @@ const char *TypeInfoDeclaration::toChars() buf.writestring("typeid("); buf.writestring(tinfo->toChars()); buf.writeByte(')'); - return buf.extractString(); + return buf.extractChars(); } /***************************** TypeInfoConstDeclaration **********************/ diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c index d6acafee5de..1c564b70e68 100644 --- a/gcc/d/dmd/dmangle.c +++ b/gcc/d/dmd/dmangle.c @@ -307,7 +307,7 @@ public: buf2.reserve(32); Mangler v(&buf2); v.paramsToDecoBuffer(t->arguments); - const char *s = buf2.peekString(); + const char *s = buf2.peekChars(); int len = (int)buf2.offset; buf->printf("%d%.*s", len, len, s); } @@ -839,7 +839,7 @@ const char *mangleExact(FuncDeclaration *fd) OutBuffer buf; Mangler v(&buf); v.mangleExact(fd); - fd->mangleString = buf.extractString(); + fd->mangleString = buf.extractChars(); } return fd->mangleString; } diff --git a/gcc/d/dmd/dmodule.c b/gcc/d/dmd/dmodule.c index 5bb544746ec..f9f59a20224 100644 --- a/gcc/d/dmd/dmodule.c +++ b/gcc/d/dmd/dmodule.c @@ -202,7 +202,7 @@ static void checkModFileAlias(OutBuffer *buf, OutBuffer *dotmods, const char *m = (*ms)[j]; const char *q = strchr(m, '='); assert(q); - if (dotmods->offset <= (size_t)(q - m) && memcmp(dotmods->peekString(), m, q - m) == 0) + if (dotmods->offset <= (size_t)(q - m) && memcmp(dotmods->peekChars(), m, q - m) == 0) { buf->reset(); size_t qlen = strlen(q + 1); @@ -283,7 +283,7 @@ Module *Module::load(Loc loc, Identifiers *packages, Identifier *ident) } } buf.printf("%s\t(%s)", ident->toChars(), m->srcfile->toChars()); - message("import %s", buf.peekString()); + message("import %s", buf.peekChars()); } m = m->parse(); @@ -1129,7 +1129,7 @@ const char *ModuleDeclaration::toChars() } } buf.writestring(id->toChars()); - return buf.extractString(); + return buf.extractChars(); } /* =========================== Package ===================== */ diff --git a/gcc/d/dmd/doc.c b/gcc/d/dmd/doc.c index 0738f4202d9..afe5c4bc00b 100644 --- a/gcc/d/dmd/doc.c +++ b/gcc/d/dmd/doc.c @@ -622,7 +622,7 @@ static void emitAnchor(OutBuffer *buf, Dsymbol *s, Scope *sc) { OutBuffer anc; emitAnchorName(&anc, s, skipNonQualScopes(sc)); - ident = Identifier::idPool(anc.peekString()); + ident = Identifier::idPool(anc.peekChars()); } size_t *count = (size_t*)dmd_aaGet(&sc->anchorCounts, (void *)ident); TemplateDeclaration *td = getEponymousParent(s); diff --git a/gcc/d/dmd/dscope.c b/gcc/d/dmd/dscope.c index a5d56b2e4a7..d7460a07d7b 100644 --- a/gcc/d/dmd/dscope.c +++ b/gcc/d/dmd/dscope.c @@ -661,7 +661,7 @@ void Scope::deprecation10378(Loc loc, Dsymbol *sold, Dsymbol *snew) else buf.writestring("nothing"); - deprecation(loc, "%s", buf.peekString()); + deprecation(loc, "%s", buf.peekChars()); } Dsymbol *Scope::search_correct(Identifier *ident) diff --git a/gcc/d/dmd/dtemplate.c b/gcc/d/dmd/dtemplate.c index 34fd621a9f9..5ec9a4b609c 100644 --- a/gcc/d/dmd/dtemplate.c +++ b/gcc/d/dmd/dtemplate.c @@ -2765,7 +2765,7 @@ const char *TemplateDeclaration::toChars() ::toCBuffer(constraint, &buf, &hgs); buf.writeByte(')'); } - return buf.extractString(); + return buf.extractChars(); } Prot TemplateDeclaration::prot() @@ -7571,7 +7571,7 @@ Identifier *TemplateInstance::genIdent(Objects *args) OutBuffer bufsa; mangleToBuffer(sa, &bufsa); - const char *s = bufsa.extractString(); + const char *s = bufsa.extractChars(); /* Bugzilla 3043: if the first character of s is a digit this * causes ambiguity issues because the digits of the two numbers are adjacent. @@ -7592,7 +7592,7 @@ Identifier *TemplateInstance::genIdent(Objects *args) assert(0); } buf.writeByte('Z'); - id = buf.peekString(); + id = buf.peekChars(); //printf("\tgenIdent = %s\n", id); return Identifier::idPool(id); } @@ -7860,14 +7860,14 @@ const char *TemplateInstance::toChars() { OutBuffer buf; toCBufferInstance(this, &buf); - return buf.extractString(); + return buf.extractChars(); } const char *TemplateInstance::toPrettyCharsHelper() { OutBuffer buf; toCBufferInstance(this, &buf, true); - return buf.extractString(); + return buf.extractChars(); } /************************************* @@ -8599,5 +8599,5 @@ const char *TemplateMixin::toChars() { OutBuffer buf; toCBufferInstance(this, &buf); - return buf.extractString(); + return buf.extractChars(); } diff --git a/gcc/d/dmd/dversion.c b/gcc/d/dmd/dversion.c index 3c539a7ff83..f88fca561c5 100644 --- a/gcc/d/dmd/dversion.c +++ b/gcc/d/dmd/dversion.c @@ -47,7 +47,7 @@ const char *DebugSymbol::toChars() { OutBuffer buf; buf.printf("%d", level); - return buf.extractString(); + return buf.extractChars(); } } @@ -137,7 +137,7 @@ const char *VersionSymbol::toChars() { OutBuffer buf; buf.printf("%d", level); - return buf.extractString(); + return buf.extractChars(); } } diff --git a/gcc/d/dmd/expression.c b/gcc/d/dmd/expression.c index ca4a6e97d21..d15081763df 100644 --- a/gcc/d/dmd/expression.c +++ b/gcc/d/dmd/expression.c @@ -2058,7 +2058,7 @@ const char *Expression::toChars() OutBuffer buf; HdrGenState hgs; toCBuffer(this, &buf, &hgs); - return buf.extractString(); + return buf.extractChars(); } void Expression::error(const char *format, ...) const @@ -2557,7 +2557,7 @@ bool Expression::checkPurity(Scope *sc, VarDeclaration *v) MODMatchToBuffer(&ffbuf, ff->type->mod, v->type->mod); MODMatchToBuffer(&vbuf, v->type->mod, ff->type->mod); error("%s%s '%s' cannot access %sdata '%s'", - ffbuf.peekString(), ff->kind(), ff->toPrettyChars(), vbuf.peekString(), v->toChars()); + ffbuf.peekChars(), ff->kind(), ff->toPrettyChars(), vbuf.peekChars(), v->toChars()); err = true; break; } @@ -6754,7 +6754,7 @@ Expression *PrettyFuncInitExp::resolveLoc(Loc loc, Scope *sc) const char *funcStr = fd->Dsymbol::toPrettyChars(); OutBuffer buf; functionToBufferWithIdent((TypeFunction *)fd->type, &buf, funcStr); - s = buf.extractString(); + s = buf.extractChars(); } else { diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c index 9112b7bc307..25f4bd51a59 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -2678,7 +2678,7 @@ public: MODMatchToBuffer(&thisBuf, e->e1->type->mod, tf->mod); MODMatchToBuffer(&funcBuf, tf->mod, e->e1->type->mod); e->error("%smethod %s is not callable using a %s%s", - funcBuf.peekString(), f->toPrettyChars(), thisBuf.peekString(), e->e1->toChars()); + funcBuf.peekChars(), f->toPrettyChars(), thisBuf.peekChars(), e->e1->toChars()); return setError(); } } @@ -3420,7 +3420,7 @@ public: //printf("tf = %s, args = %s\n", tf->deco, (*exp->arguments)[0]->type->deco); ::error(exp->loc, "%s %s %s is not callable using argument types %s", p, exp->e1->toChars(), parametersTypeToChars(tf->parameterList), - buf.peekString()); + buf.peekChars()); return setError(); } @@ -3493,7 +3493,7 @@ public: //printf("tf = %s, args = %s\n", tf->deco, (*exp->arguments)[0]->type->deco); ::error(exp->loc, "%s %s is not callable using argument types %s", exp->e1->toChars(), parametersTypeToChars(tf->parameterList), - buf.peekString()); + buf.peekChars()); exp->f = NULL; } @@ -8250,7 +8250,7 @@ Expression *semanticX(DotIdExp *exp, Scope *sc) } OutBuffer buf; mangleToBuffer(ds, &buf); - const char *s = buf.extractString(); + const char *s = buf.extractChars(); Expression *e = new StringExp(exp->loc, const_cast(s), strlen(s)); e = semantic(e, sc); return e; diff --git a/gcc/d/dmd/func.c b/gcc/d/dmd/func.c index aa09f3e7f65..276303a2851 100644 --- a/gcc/d/dmd/func.c +++ b/gcc/d/dmd/func.c @@ -618,7 +618,7 @@ void FuncDeclaration::semantic(Scope *sc) { OutBuffer buf; MODtoBuffer(&buf, tf->mod); - error("without 'this' cannot be %s", buf.peekString()); + error("without 'this' cannot be %s", buf.peekChars()); tf->mod = 0; // remove qualifiers } @@ -3258,7 +3258,7 @@ FuncDeclaration *FuncDeclaration::overloadModMatch(Loc loc, Type *tthis, bool &h MODMatchToBuffer(&thisBuf, tthis->mod, tf->mod); MODMatchToBuffer(&funcBuf, tf->mod, tthis->mod); ::error(loc, "%smethod %s is not callable using a %sobject", - funcBuf.peekString(), this->toPrettyChars(), thisBuf.peekString()); + funcBuf.peekChars(), this->toPrettyChars(), thisBuf.peekChars()); } } @@ -3551,7 +3551,7 @@ FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, { ::error(loc, "%s %s.%s cannot deduce function from argument types !(%s)%s, candidates are:", td->kind(), td->parent->toPrettyChars(), td->ident->toChars(), - tiargsBuf.peekString(), fargsBuf.peekString()); + tiargsBuf.peekChars(), fargsBuf.peekChars()); // Display candidate templates (even if there are no multiple overloads) TemplateCandidateWalker tcw; @@ -3562,7 +3562,7 @@ FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, else if (od) { ::error(loc, "none of the overloads of '%s' are callable using argument types !(%s)%s", - od->ident->toChars(), tiargsBuf.peekString(), fargsBuf.peekString()); + od->ident->toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars()); } else { @@ -3577,22 +3577,22 @@ FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, MODMatchToBuffer(&funcBuf, tf->mod, tthis->mod); if (hasOverloads) ::error(loc, "none of the overloads of '%s' are callable using a %sobject, candidates are:", - fd->ident->toChars(), thisBuf.peekString()); + fd->ident->toChars(), thisBuf.peekChars()); else ::error(loc, "%smethod %s is not callable using a %sobject", - funcBuf.peekString(), fd->toPrettyChars(), thisBuf.peekString()); + funcBuf.peekChars(), fd->toPrettyChars(), thisBuf.peekChars()); } else { //printf("tf = %s, args = %s\n", tf->deco, (*fargs)[0]->type->deco); if (hasOverloads) ::error(loc, "none of the overloads of '%s' are callable using argument types %s, candidates are:", - fd->ident->toChars(), fargsBuf.peekString()); + fd->ident->toChars(), fargsBuf.peekChars()); else fd->error(loc, "%s%s is not callable using argument types %s", parametersTypeToChars(tf->parameterList), tf->modToChars(), - fargsBuf.peekString()); + fargsBuf.peekChars()); } // Display candidate functions @@ -3614,7 +3614,7 @@ FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, ::error(loc, "%s.%s called with argument types %s matches both:\n" "%s: %s%s\nand:\n%s: %s%s", s->parent->toPrettyChars(), s->ident->toChars(), - fargsBuf.peekString(), + fargsBuf.peekChars(), m.lastf->loc.toChars(), m.lastf->toPrettyChars(), lastprms, m.nextf->loc.toChars(), m.nextf->toPrettyChars(), nextprms); } @@ -3725,7 +3725,7 @@ const char *FuncDeclaration::toFullSignature() { OutBuffer buf; functionToBufferWithIdent(type->toTypeFunction(), &buf, toChars()); - return buf.extractString(); + return buf.extractChars(); } bool FuncDeclaration::isMain() @@ -5421,7 +5421,7 @@ static Identifier *unitTestId(Loc loc) { OutBuffer buf; buf.printf("__unittestL%u_", loc.linnum); - return Identifier::generateId(buf.peekString()); + return Identifier::generateId(buf.peekChars()); } UnitTestDeclaration::UnitTestDeclaration(Loc loc, Loc endloc, StorageClass stc, char *codedoc) diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c index af933bd2e88..2c88ef597c6 100644 --- a/gcc/d/dmd/hdrgen.c +++ b/gcc/d/dmd/hdrgen.c @@ -3475,5 +3475,5 @@ const char *parametersTypeToChars(ParameterList pl) HdrGenState hgs; PrettyPrintVisitor v(&buf, &hgs); v.parametersToBuffer(pl.parameters, pl.varargs); - return buf.extractString(); + return buf.extractChars(); } diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c index d5c927c12b0..1bd453fc53c 100644 --- a/gcc/d/dmd/identifier.c +++ b/gcc/d/dmd/identifier.c @@ -110,7 +110,7 @@ Identifier *Identifier::generateId(const char *prefix, size_t i) buf.writestring(prefix); buf.printf("%llu", (ulonglong)i); - char *id = buf.peekString(); + char *id = buf.peekChars(); return idPool(id); } diff --git a/gcc/d/dmd/init.c b/gcc/d/dmd/init.c index c4a496f8b5d..28b4187b2e6 100644 --- a/gcc/d/dmd/init.c +++ b/gcc/d/dmd/init.c @@ -53,7 +53,7 @@ const char *Initializer::toChars() OutBuffer buf; HdrGenState hgs; ::toCBuffer(this, &buf, &hgs); - return buf.extractString(); + return buf.extractChars(); } /********************************** ErrorInitializer ***************************/ diff --git a/gcc/d/dmd/mtype.c b/gcc/d/dmd/mtype.c index d7144879fba..30fd54da185 100644 --- a/gcc/d/dmd/mtype.c +++ b/gcc/d/dmd/mtype.c @@ -1455,7 +1455,7 @@ char *MODtoChars(MOD mod) OutBuffer buf; buf.reserve(16); MODtoBuffer(&buf, mod); - return buf.extractString(); + return buf.extractChars(); } /******************************** @@ -1470,7 +1470,7 @@ const char *Type::toChars() hgs.fullQual = (ty == Tclass && !mod); ::toCBuffer(this, &buf, NULL, &hgs); - return buf.extractString(); + return buf.extractChars(); } char *Type::toPrettyChars(bool QualifyTypes) @@ -1481,7 +1481,7 @@ char *Type::toPrettyChars(bool QualifyTypes) hgs.fullQual = QualifyTypes; ::toCBuffer(this, &buf, NULL, &hgs); - return buf.extractString(); + return buf.extractChars(); } /********************************* @@ -1504,7 +1504,7 @@ char *Type::modToChars() OutBuffer buf; buf.reserve(16); modToBuffer(&buf); - return buf.extractString(); + return buf.extractChars(); } /** For each active modifier (MODconst, MODimmutable, etc) call fp with a @@ -5715,7 +5715,7 @@ Type *TypeFunction::semantic(Loc loc, Scope *sc) OutBuffer buf2; stcToBuffer(&buf2, stc2); error(loc, "incompatible parameter storage classes '%s' and '%s'", - buf1.peekString(), buf2.peekString()); + buf1.peekChars(), buf2.peekChars()); errors = true; stc = stc1 | (stc & ~(STCref | STCout | STClazy)); } diff --git a/gcc/d/dmd/parse.c b/gcc/d/dmd/parse.c index e983501bde1..38da5808484 100644 --- a/gcc/d/dmd/parse.c +++ b/gcc/d/dmd/parse.c @@ -803,7 +803,7 @@ Dsymbols *Parser::parseDeclDefs(int once, Dsymbol **pLastDecl, PrefixAttributes if (e) { buf1.printf("(%s)", e->toChars()); - s1 = buf1.peekString(); + s1 = buf1.peekChars(); } error("redundant alignment attribute align%s", s1); } @@ -977,9 +977,9 @@ StorageClass Parser::appendStorageClass(StorageClass storageClass, StorageClass OutBuffer buf; stcToBuffer(&buf, stc); if (deprec) - deprecation("redundant attribute '%s'", buf.peekString()); + deprecation("redundant attribute '%s'", buf.peekChars()); else - error("redundant attribute '%s'", buf.peekString()); + error("redundant attribute '%s'", buf.peekChars()); return storageClass | stc; } @@ -1712,7 +1712,7 @@ Dsymbol *Parser::parseStaticCtor(PrefixAttributes *pAttrs) { OutBuffer buf; stcToBuffer(&buf, modStc); - error(loc, "static constructor cannot be %s", buf.peekString()); + error(loc, "static constructor cannot be %s", buf.peekChars()); } stc &= ~(STCstatic | STC_TYPECTOR); @@ -1750,7 +1750,7 @@ Dsymbol *Parser::parseStaticDtor(PrefixAttributes *pAttrs) { OutBuffer buf; stcToBuffer(&buf, modStc); - error(loc, "static destructor cannot be %s", buf.peekString()); + error(loc, "static destructor cannot be %s", buf.peekChars()); } stc &= ~(STCstatic | STC_TYPECTOR); @@ -1792,7 +1792,7 @@ Dsymbol *Parser::parseSharedStaticCtor(PrefixAttributes *pAttrs) { OutBuffer buf; stcToBuffer(&buf, modStc); - error(loc, "shared static constructor cannot be %s", buf.peekString()); + error(loc, "shared static constructor cannot be %s", buf.peekChars()); } stc &= ~(STCstatic | STC_TYPECTOR); @@ -1829,7 +1829,7 @@ Dsymbol *Parser::parseSharedStaticDtor(PrefixAttributes *pAttrs) { OutBuffer buf; stcToBuffer(&buf, modStc); - error(loc, "shared static destructor cannot be %s", buf.peekString()); + error(loc, "shared static destructor cannot be %s", buf.peekChars()); } stc &= ~(STCstatic | STC_TYPECTOR); @@ -4206,7 +4206,7 @@ Dsymbol *Parser::parseFunctionLiteral() { OutBuffer buf; stcToBuffer(&buf, modStc); - error("function literal cannot be %s", buf.peekString()); + error("function literal cannot be %s", buf.peekChars()); } else save = TOKdelegate; diff --git a/gcc/d/dmd/root/filename.c b/gcc/d/dmd/root/filename.c index 88391df0f28..667efb941b7 100644 --- a/gcc/d/dmd/root/filename.c +++ b/gcc/d/dmd/root/filename.c @@ -127,7 +127,7 @@ Strings *FileName::splitPath(const char *path) } if (buf.offset) // if path is not empty { - array->push(buf.extractString()); + array->push(buf.extractChars()); } } while (c); } diff --git a/gcc/d/dmd/root/outbuffer.c b/gcc/d/dmd/root/outbuffer.c index db09ca29045..d25a14b4872 100644 --- a/gcc/d/dmd/root/outbuffer.c +++ b/gcc/d/dmd/root/outbuffer.c @@ -374,7 +374,7 @@ void OutBuffer::remove(size_t offset, size_t nbytes) this->offset -= nbytes; } -char *OutBuffer::peekString() +char *OutBuffer::peekChars() { if (!offset || data[offset-1] != '\0') { @@ -384,7 +384,7 @@ char *OutBuffer::peekString() return (char *)data; } -char *OutBuffer::extractString() +char *OutBuffer::extractChars() { if (!offset || data[offset-1] != '\0') writeByte(0); diff --git a/gcc/d/dmd/root/outbuffer.h b/gcc/d/dmd/root/outbuffer.h index e1bada8728b..fbc3f32d456 100644 --- a/gcc/d/dmd/root/outbuffer.h +++ b/gcc/d/dmd/root/outbuffer.h @@ -68,7 +68,7 @@ public: size_t insert(size_t offset, const void *data, size_t nbytes); void remove(size_t offset, size_t nbytes); // Append terminating null if necessary and get view of internal buffer - char *peekString(); + char *peekChars(); // Append terminating null if necessary and take ownership of data - char *extractString(); + char *extractChars(); }; diff --git a/gcc/d/dmd/statement.c b/gcc/d/dmd/statement.c index b0daed514b7..7a0fd6db069 100644 --- a/gcc/d/dmd/statement.c +++ b/gcc/d/dmd/statement.c @@ -49,7 +49,7 @@ Identifier *fixupLabelName(Scope *sc, Identifier *ident) OutBuffer buf; buf.printf("%s%s", prefix, ident->toChars()); - const char *name = buf.extractString(); + const char *name = buf.extractChars(); ident = Identifier::idPool(name); } return ident; @@ -121,7 +121,7 @@ const char *Statement::toChars() OutBuffer buf; ::toCBuffer(this, &buf, &hgs); - return buf.extractString(); + return buf.extractChars(); } diff --git a/gcc/d/dmd/tokens.c b/gcc/d/dmd/tokens.c index 9509ffd3cff..9db1e33c1da 100644 --- a/gcc/d/dmd/tokens.c +++ b/gcc/d/dmd/tokens.c @@ -133,7 +133,7 @@ const char *Token::toChars() const buf.writeByte('"'); if (postfix) buf.writeByte(postfix); - p = buf.extractString(); + p = buf.extractChars(); } break; diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc index c7bde88e5cd..ba7e6aef6ed 100644 --- a/gcc/d/intrinsics.cc +++ b/gcc/d/intrinsics.cc @@ -118,7 +118,7 @@ maybe_set_intrinsic (FuncDeclaration *decl) OutBuffer buf; mangleToBuffer (fd->type, &buf); - tdeco = buf.extractString (); + tdeco = buf.extractChars (); } /* Matching the type deco may be a bit too strict, as it means that all