public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] d: Merge upstream dmd 740f3d1ea.
@ 2020-06-10 3:41 Jiu Fu Guo
0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-10 3:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:5bc13e5217f687f5d08a7022b4c6081befc54402
commit 5bc13e5217f687f5d08a7022b4c6081befc54402
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Fri Jun 5 23:09:23 2020 +0200
d: Merge upstream dmd 740f3d1ea.
Backports the conversion of the parameter fields debugids and versionids
to Identifiers. The idea is that Identifiers should be used instead of
C strings where ever possible.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 740f3d1ea.
* d-lang.cc (d_handle_option): Use new fields to save debug and
version levels passed over command-line.
(d_post_options): Add them to front-end here.
Diff:
---
gcc/d/d-lang.cc | 31 +++++++++++++++++++++++++++----
gcc/d/dmd/MERGE | 2 +-
gcc/d/dmd/cond.c | 40 +++++++++++++++-------------------------
gcc/d/dmd/cond.h | 4 +---
gcc/d/dmd/dversion.c | 8 ++++----
gcc/d/dmd/globals.h | 3 +++
gcc/d/dmd/module.h | 8 ++++----
7 files changed, 55 insertions(+), 41 deletions(-)
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index 203039e9ecf..54d5799e59c 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -443,14 +443,16 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
int level = integral_argument (arg);
if (level != -1)
{
- DebugCondition::setGlobalLevel (level);
+ global.params.debuglevel = level;
break;
}
}
if (Identifier::isValidIdentifier (CONST_CAST (char *, arg)))
{
- DebugCondition::addGlobalIdent (arg);
+ if (!global.params.debugids)
+ global.params.debugids = new Strings ();
+ global.params.debugids->push (arg);
break;
}
@@ -582,14 +584,16 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
int level = integral_argument (arg);
if (level != -1)
{
- VersionCondition::setGlobalLevel (level);
+ global.params.versionlevel = level;
break;
}
}
if (Identifier::isValidIdentifier (CONST_CAST (char *, arg)))
{
- VersionCondition::addGlobalIdent (arg);
+ if (!global.params.versionids)
+ global.params.versionids = new Strings ();
+ global.params.versionids->push (arg);
break;
}
@@ -812,6 +816,25 @@ d_post_options (const char ** fn)
/* Has no effect yet. */
global.params.pic = flag_pic != 0;
+ /* Add in versions given on the command line. */
+ if (global.params.versionids)
+ {
+ for (size_t i = 0; i < global.params.versionids->length; i++)
+ {
+ const char *s = (*global.params.versionids)[i];
+ VersionCondition::addGlobalIdent (s);
+ }
+ }
+
+ if (global.params.debugids)
+ {
+ for (size_t i = 0; i < global.params.debugids->length; i++)
+ {
+ const char *s = (*global.params.debugids)[i];
+ DebugCondition::addGlobalIdent (s);
+ }
+ }
+
if (warn_return_type == -1)
warn_return_type = 0;
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 3248bf7c982..540801d1d44 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-f5638c7b8a6912858a9b51987df6a725e6796dc9
+740f3d1eab81d88d11451083d955d5075f60d4e0
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/cond.c b/gcc/d/dmd/cond.c
index 88febdf5e1e..53c5499f158 100644
--- a/gcc/d/dmd/cond.c
+++ b/gcc/d/dmd/cond.c
@@ -29,15 +29,15 @@
Expression *semantic(Expression *e, Scope *sc);
bool evalStaticCondition(Scope *sc, Expression *exp, Expression *e, bool &errors);
-int findCondition(Strings *ids, Identifier *ident)
+int findCondition(Identifiers *ids, Identifier *ident)
{
if (ids)
{
for (size_t i = 0; i < ids->length; i++)
{
- const char *id = (*ids)[i];
+ Identifier *id = (*ids)[i];
- if (strcmp(id, ident->toChars()) == 0)
+ if (id == ident)
return true;
}
}
@@ -391,16 +391,11 @@ Condition *DVCondition::syntaxCopy()
/* ============================================================ */
-void DebugCondition::setGlobalLevel(unsigned level)
-{
- global.params.debuglevel = level;
-}
-
void DebugCondition::addGlobalIdent(const char *ident)
{
- if (!global.params.debugids)
- global.params.debugids = new Strings();
- global.params.debugids->push(ident);
+ if (!global.debugids)
+ global.debugids = new Identifiers();
+ global.debugids->push(Identifier::idPool(ident));
}
@@ -444,12 +439,12 @@ int DebugCondition::include(Scope *sc)
inc = 1;
definedInModule = true;
}
- else if (findCondition(global.params.debugids, ident))
+ else if (findCondition(global.debugids, ident))
inc = 1;
else
{ if (!mod->debugidsNot)
- mod->debugidsNot = new Strings();
- mod->debugidsNot->push(ident->toChars());
+ mod->debugidsNot = new Identifiers();
+ mod->debugidsNot->push(ident);
}
}
else if (level <= global.params.debuglevel || level <= mod->debuglevel)
@@ -462,11 +457,6 @@ int DebugCondition::include(Scope *sc)
/* ============================================================ */
-void VersionCondition::setGlobalLevel(unsigned level)
-{
- global.params.versionlevel = level;
-}
-
static bool isReserved(const char *ident)
{
static const char* reserved[] =
@@ -598,9 +588,9 @@ void VersionCondition::addGlobalIdent(const char *ident)
void VersionCondition::addPredefinedGlobalIdent(const char *ident)
{
- if (!global.params.versionids)
- global.params.versionids = new Strings();
- global.params.versionids->push(ident);
+ if (!global.versionids)
+ global.versionids = new Identifiers();
+ global.versionids->push(Identifier::idPool(ident));
}
@@ -624,13 +614,13 @@ int VersionCondition::include(Scope *sc)
inc = 1;
definedInModule = true;
}
- else if (findCondition(global.params.versionids, ident))
+ else if (findCondition(global.versionids, ident))
inc = 1;
else
{
if (!mod->versionidsNot)
- mod->versionidsNot = new Strings();
- mod->versionidsNot->push(ident->toChars());
+ mod->versionidsNot = new Identifiers();
+ mod->versionidsNot->push(ident);
}
}
else if (level <= global.params.versionlevel || level <= mod->versionlevel)
diff --git a/gcc/d/dmd/cond.h b/gcc/d/dmd/cond.h
index c32f7bba5e6..1963f0519a9 100644
--- a/gcc/d/dmd/cond.h
+++ b/gcc/d/dmd/cond.h
@@ -23,7 +23,7 @@ class DebugCondition;
class ForeachStatement;
class ForeachRangeStatement;
-int findCondition(Strings *ids, Identifier *ident);
+int findCondition(Identifiers *ids, Identifier *ident);
class Condition
{
@@ -76,7 +76,6 @@ public:
class DebugCondition : public DVCondition
{
public:
- static void setGlobalLevel(unsigned level);
static void addGlobalIdent(const char *ident);
DebugCondition(Module *mod, unsigned level, Identifier *ident);
@@ -89,7 +88,6 @@ public:
class VersionCondition : public DVCondition
{
public:
- static void setGlobalLevel(unsigned level);
static void addGlobalIdent(const char *ident);
static void addPredefinedGlobalIdent(const char *ident);
diff --git a/gcc/d/dmd/dversion.c b/gcc/d/dmd/dversion.c
index f9f4b75a6f2..3c539a7ff83 100644
--- a/gcc/d/dmd/dversion.c
+++ b/gcc/d/dmd/dversion.c
@@ -81,8 +81,8 @@ void DebugSymbol::addMember(Scope *, ScopeDsymbol *sds)
errors = true;
}
if (!m->debugids)
- m->debugids = new Strings();
- m->debugids->push(ident->toChars());
+ m->debugids = new Identifiers();
+ m->debugids->push(ident);
}
}
else
@@ -172,8 +172,8 @@ void VersionSymbol::addMember(Scope *, ScopeDsymbol *sds)
errors = true;
}
if (!m->versionids)
- m->versionids = new Strings();
- m->versionids->push(ident->toChars());
+ m->versionids = new Identifiers();
+ m->versionids->push(ident);
}
}
else
diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h
index be75fc09d2e..a6449b93ab8 100644
--- a/gcc/d/dmd/globals.h
+++ b/gcc/d/dmd/globals.h
@@ -239,6 +239,9 @@ struct Global
void* console; // opaque pointer to console for controlling text attributes
+ Array<class Identifier*>* versionids; // command line versions and predefined versions
+ Array<class Identifier*>* debugids; // command line debug versions and predefined versions
+
/* Start gagging. Return the current number of gagged errors
*/
unsigned startGagging();
diff --git a/gcc/d/dmd/module.h b/gcc/d/dmd/module.h
index 5c799bb7e82..17ad5904523 100644
--- a/gcc/d/dmd/module.h
+++ b/gcc/d/dmd/module.h
@@ -100,12 +100,12 @@ public:
Modules aimports; // all imported modules
unsigned debuglevel; // debug level
- Strings *debugids; // debug identifiers
- Strings *debugidsNot; // forward referenced debug identifiers
+ Identifiers *debugids; // debug identifiers
+ Identifiers *debugidsNot; // forward referenced debug identifiers
unsigned versionlevel; // version level
- Strings *versionids; // version identifiers
- Strings *versionidsNot; // forward referenced version identifiers
+ Identifiers *versionids; // version identifiers
+ Identifiers *versionidsNot; // forward referenced version identifiers
Macro *macrotable; // document comment macros
Escape *escapetable; // document comment escapes
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-10 3:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 3:41 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] d: Merge upstream dmd 740f3d1ea Jiu Fu Guo
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).