Commit 66d7749b by Nathan Sidwell Committed by Nathan Sidwell

[PR preprocessor/90927] Fixe dependency output

https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01664.html
	libcpp/
	PR preprocessor/90927
	* mkdeps.c (mkdeps::vec::operator[]): Add non-const variant.
	(deps_add_target): Deal with out of order unquoted targets.

	gcc/testsuite/
	* c-c++-common/pr90927.c: New.

From-SVN: r272692
parent 93a090cf
2019-06-26 Nathan Sidwell <nathan@acm.org>
* c-c++-common/pr90927.c: New.
2019-06-26 Richard Biener <rguenther@suse.de> 2019-06-26 Richard Biener <rguenther@suse.de>
PR ipa/90982 PR ipa/90982
......
/* { dg-do preprocess } */
/* { dg-additional-options "-M -MQ b\\\$ob -MT b\\\$ill" } */
int i;
/* { dg-final { scan-file pr90927.i {b\$ill b\$\$ob:} } } */
2019-06-26 Nathan Sidwell <nathan@acm.org>
PR preprocessor/90927
* mkdeps.c (mkdeps::vec::operator[]): Add non-const variant.
(deps_add_target): Deal with out of order unquoted targets.
2019-05-19 Andrew Pinski <apinski@marvell.com> 2019-05-19 Andrew Pinski <apinski@marvell.com>
PR pch/81721 PR pch/81721
......
...@@ -59,6 +59,10 @@ public: ...@@ -59,6 +59,10 @@ public:
{ {
return ary[ix]; return ary[ix];
} }
T &operator[] (unsigned ix)
{
return ary[ix];
}
void push (const T &elt) void push (const T &elt)
{ {
if (num == alloc) if (num == alloc)
...@@ -235,14 +239,22 @@ deps_free (struct mkdeps *d) ...@@ -235,14 +239,22 @@ deps_free (struct mkdeps *d)
void void
deps_add_target (struct mkdeps *d, const char *t, int quote) deps_add_target (struct mkdeps *d, const char *t, int quote)
{ {
t = apply_vpath (d, t); t = xstrdup (apply_vpath (d, t));
if (!quote) if (!quote)
{ {
gcc_assert (d->quote_lwm == d->targets.size ()); /* Sometimes unquoted items are added after quoted ones.
Swap out the lowest quoted. */
if (d->quote_lwm != d->targets.size ())
{
const char *lowest = d->targets[d->quote_lwm];
d->targets[d->quote_lwm] = t;
t = lowest;
}
d->quote_lwm++; d->quote_lwm++;
} }
d->targets.push (xstrdup (t)); d->targets.push (t);
} }
/* Sets the default target if none has been given already. An empty /* Sets the default target if none has been given already. An empty
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment