public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-888] d: Revert "Come up with startswith function."
@ 2021-05-18 21:01 Iain Buclaw
0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-05-18 21:01 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3e0ad85638b8b7085add06b4afd77cbbf3549631
commit r12-888-g3e0ad85638b8b7085add06b4afd77cbbf3549631
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue May 18 19:05:20 2021 +0200
d: Revert "Come up with startswith function."
This reverts changes to the DMD front-end in commit
6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b.
Changes were incorrectly committed directly to the GCC repo instead of
the master repository.
gcc/d/ChangeLog:
* dmd/dinterpret.c (evaluateIfBuiltin): Revert last change.
* dmd/dmangle.c: Likewise.
* dmd/hdrgen.c: Likewise.
* dmd/identifier.c (Identifier::toHChars2): Likewise.
Diff:
---
gcc/d/dmd/dinterpret.c | 2 +-
gcc/d/dmd/dmangle.c | 2 +-
gcc/d/dmd/hdrgen.c | 2 +-
gcc/d/dmd/identifier.c | 6 +++---
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c
index 9e74a0dbf1f..5e71f3b24a1 100644
--- a/gcc/d/dmd/dinterpret.c
+++ b/gcc/d/dmd/dinterpret.c
@@ -6881,7 +6881,7 @@ Expression *evaluateIfBuiltin(UnionExp *pue, InterState *istate, Loc loc,
const char *id = fd->ident->toChars();
size_t idlen = strlen(id);
if (nargs == 2 && (idlen == 10 || idlen == 11) &&
- startswith (id, "_aApply"))
+ !strncmp(id, "_aApply", 7))
{
// Functions from aApply.d and aApplyR.d in the runtime
bool rvs = (idlen == 11); // true if foreach_reverse
diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c
index f112243cf5f..83f4c18bee8 100644
--- a/gcc/d/dmd/dmangle.c
+++ b/gcc/d/dmd/dmangle.c
@@ -673,7 +673,7 @@ public:
cd == ClassDeclaration::object ||
cd == Type::typeinfoclass ||
cd == Module::moduleinfo ||
- startswith (cd->ident->toChars(), "TypeInfo_"))
+ strncmp(cd->ident->toChars(), "TypeInfo_", 9) == 0)
{
// Don't mangle parent
ad->parent = NULL;
diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c
index e72273b2dbd..9397b1e8abd 100644
--- a/gcc/d/dmd/hdrgen.c
+++ b/gcc/d/dmd/hdrgen.c
@@ -3212,7 +3212,7 @@ public:
}
else if (p->type->ty == Tident &&
strlen(((TypeIdentifier *)p->type)->ident->toChars()) > 3 &&
- startswith (((TypeIdentifier *)p->type)->ident->toChars(), "__T"))
+ strncmp(((TypeIdentifier *)p->type)->ident->toChars(), "__T", 3) == 0)
{
// print parameter name, instead of undetermined type parameter
buf->writestring(p->ident->toChars());
diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c
index dd2c58fd657..197d288e532 100644
--- a/gcc/d/dmd/identifier.c
+++ b/gcc/d/dmd/identifier.c
@@ -73,11 +73,11 @@ const char *Identifier::toHChars2()
{ p = toChars();
if (*p == '_')
{
- if (startswith(p, "_staticCtor"))
+ if (strncmp(p, "_staticCtor", 11) == 0)
p = "static this";
- else if (startswith(p, "_staticDtor"))
+ else if (strncmp(p, "_staticDtor", 11) == 0)
p = "static ~this";
- else if (startswith(p, "__invariant"))
+ else if (strncmp(p, "__invariant", 11) == 0)
p = "invariant";
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-18 21:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 21:01 [gcc r12-888] d: Revert "Come up with startswith function." Iain Buclaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).