public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: Iain Buclaw <ibuclaw@gdcproject.org>
Cc: gcc-patches@gcc.gnu.org, "Arsen Arsenović" <arsen@aarsen.me>
Subject: [PATCH] gcc/d: give dependency files better filenames
Date: Sun, 12 Jan 2025 16:16:58 +0100	[thread overview]
Message-ID: <20250112153348.1578402-1-arsen@aarsen.me> (raw)

Regstrapped on x86_64-pc-linux-gnu.  I've also checked the generated
dependency files are correct by hand and "instrumented" the build to
fail if two dependency files are the same, by doing the following:

  DPOSTCOMPILE = ! test -f $(DEPFILE).Po && mv ...

... and confirmed no further conflicts of this sort happen.

OK for trunk?
---------- >8 ----------
Currently, the dependency files for root-file.o and common-file.o were
both d/.deps/file.Po, which would cause parallel builds to fail
sometimes with:

  make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/build/gcc'
  make[3]: Entering directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/build/gcc'
  mv: cannot stat 'd/.deps/file.TPo': No such file or directory
  make[3]: *** [/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/gcc-14-20240511/gcc/d/Make-lang.in:421: d/root-file.o] Error 1 shuffle=131581365

Also, this means that dependencies of one of root-file or common-file
are missing when developing.  After this patch, those two files get
assigned dependency files d/.deps/d-root-file.o.Po and
d/.deps/d-common-file.o.Po respectively.

There are other files with similar conflicts (mangle-package.o,
visitor-package.o for instance).

gcc/d/ChangeLog:

	* Make-lang.in: Assign dependency-tracking files better
	filenames.
---
 gcc/d/Make-lang.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in
index f28761e4b370..25e2b0bbfe94 100644
--- a/gcc/d/Make-lang.in
+++ b/gcc/d/Make-lang.in
@@ -65,8 +65,9 @@ ALL_DFLAGS = $(DFLAGS-$@) $(GDCFLAGS) -fversion=IN_GCC $(CHECKING_DFLAGS) \
 	$(WARN_DFLAGS)
 
 DCOMPILE.base = $(GDC) -c $(ALL_DFLAGS) -o $@
-DCOMPILE = $(DCOMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo
-DPOSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po
+DEPFILE = $(subst /,-,$@)
+DCOMPILE = $(DCOMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(DEPFILE).TPo
+DPOSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(DEPFILE).TPo $(@D)/$(DEPDIR)/$(DEPFILE).Po
 DLINKER = $(GDC) $(NO_PIE_FLAG) -lstdc++
 
 # Like LINKER, but use a mutex for serializing front end links.
-- 
2.48.0


             reply	other threads:[~2025-01-12 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-12 15:16 Arsen Arsenović [this message]
2025-01-13  9:33 ` Rainer Orth
2025-01-13 10:00 ` [PATCH] d, v2: " Jakub Jelinek
2025-01-13 10:01   ` Jakub Jelinek
2025-01-13 13:45   ` Arsen Arsenović
2025-01-13 13:58     ` Jakub Jelinek
2025-01-13 18:29       ` Iain Buclaw
2025-01-13 18:35         ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250112153348.1578402-1-arsen@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ibuclaw@gdcproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).