[pkg-d-commits] [ldc] 40/211: Fix regression wrt. `-oq` (fully qualified object filenames)

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit eb85bc2f75706ea1ae54f5dc1a0345cc41f2f55c
Author: Martin <noone at nowhere.com>
Date:   Mon Sep 26 21:04:45 2016 +0200

    Fix regression wrt. `-oq` (fully qualified object filenames)
---
 ddmd/mars.d | 45 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/ddmd/mars.d b/ddmd/mars.d
index ee8ff12..1304b0b 100644
--- a/ddmd/mars.d
+++ b/ddmd/mars.d
@@ -1351,16 +1351,9 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
         modules.push(m);
       version (IN_LLVM)
       {
-        // If `-run` is passed, the obj file is temporary and is removed after execution.
-        // Make sure the name does not collide with other files from other processes by
-        // creating a unique filename.
-        if (global.params.run)
-            m.makeObjectFilenameUnique();
-
         if (!global.params.oneobj || firstModuleObjectFileIndex == size_t.max)
         {
-            global.params.objfiles.push(m.objfile.name.str);
-            m.checkAndAddOutputFile(m.objfile);
+            global.params.objfiles.push(cast(const(char)*)m); // defer to a later stage after parsing
             if (firstModuleObjectFileIndex == size_t.max)
                 firstModuleObjectFileIndex = global.params.objfiles.dim - 1;
         }
@@ -1437,8 +1430,11 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
         if (!Module.rootModule)
             Module.rootModule = m;
         m.importedFrom = m; // m->isRoot() == true
+      version (IN_LLVM) {} else
+      {
         if (!global.params.oneobj || modi == 0 || m.isDocFile)
             m.deleteObjFile();
+      }
         static if (ASYNCREAD)
         {
             if (aw.read(filei))
@@ -1448,6 +1444,39 @@ extern (C++) int mars_mainBody(ref Strings files, ref Strings libmodules)
             }
         }
         m.parse();
+      version (IN_LLVM)
+      {
+        // Finalize output filenames. Update if `-oq` was specified (only feasible after parsing).
+        if (global.params.fullyQualifiedObjectFiles && m.md)
+        {
+            m.objfile = m.setOutfile(global.params.objname, global.params.objdir, m.arg, FileName.ext(m.objfile.name.str));
+            if (m.docfile)
+                m.setDocfile();
+            if (m.hdrfile)
+                m.hdrfile = m.setOutfile(global.params.hdrname, global.params.hdrdir, m.arg, global.hdr_ext);
+        }
+
+        // If `-run` is passed, the obj file is temporary and is removed after execution.
+        // Make sure the name does not collide with other files from other processes by
+        // creating a unique filename.
+        if (global.params.run)
+            m.makeObjectFilenameUnique();
+
+        // Set object filename in global.params.objfiles.
+        for (size_t j = 0; j < global.params.objfiles.dim; j++)
+        {
+            if ((*global.params.objfiles)[j] == cast(const(char)*)m)
+            {
+                (*global.params.objfiles)[j] = m.objfile.name.str;
+                if (!m.isDocFile)
+                    m.checkAndAddOutputFile(m.objfile);
+                break;
+            }
+        }
+
+        if (!global.params.oneobj || modi == 0 || m.isDocFile)
+            m.deleteObjFile();
+      }
         if (m.isDocFile)
         {
             anydocfiles = true;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list