aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-06-23 18:08:54 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2020-06-25 17:02:46 +0200
commite52f5d0786fce4ef6ae5937ab33e871c59da3c99 (patch)
treef3265654eb4df5a4fbb8fc5ea750e01f78fce9be /gcc/d
parentd103f336bdc3144e756c7634b8914830c867896d (diff)
downloadgcc-e52f5d0786fce4ef6ae5937ab33e871c59da3c99.zip
gcc-e52f5d0786fce4ef6ae5937ab33e871c59da3c99.tar.gz
gcc-e52f5d0786fce4ef6ae5937ab33e871c59da3c99.tar.bz2
d: Remove another dependency on the front-end OutBuffer type.
As the DMD front-end never frees allocated memory, the glue layer between the DMD front-end and GCC should generally avoid using DMD types and interfaces if the purpose is internal only. gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Replace OutBuffer with obstack.
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/d-lang.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index e4d0a24..2c474f8 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -1032,18 +1032,20 @@ d_parse_file (void)
message ("binary %s", global.params.argv0.ptr);
message ("version %s", global.version.ptr);
- if (global.params.versionids)
+ if (global.versionids)
{
- OutBuffer buf;
- buf.writestring ("predefs ");
- for (size_t i = 0; i < global.params.versionids->length; i++)
+ obstack buffer;
+ gcc_obstack_init (&buffer);
+ obstack_grow (&buffer, "predefs ", 9);
+ for (size_t i = 0; i < global.versionids->length; i++)
{
- const char *s = (*global.params.versionids)[i];
- buf.writestring (" ");
- buf.writestring (s);
+ Identifier *id = (*global.versionids)[i];
+ const char *str = id->toChars ();
+ obstack_1grow (&buffer, ' ');
+ obstack_grow (&buffer, str, strlen (str));
}
- message ("%s", buf.peekChars ());
+ message ("%s", (char *) obstack_finish (&buffer));
}
}