[pkg-d-commits] [ldc] 122/149: Add hidden -ldmd option when invoking LDC via LDMD

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:37:05 UTC 2017


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

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

commit 9a1c4adbbc8ecaec06e5904685724462932183a0
Author: Martin <noone at nowhere.com>
Date:   Sat Mar 4 00:09:01 2017 +0100

    Add hidden -ldmd option when invoking LDC via LDMD
    
    Thus providing a generic way to slightly alter some command-line semantics
    in DMD compatibility mode.
---
 driver/cl_options.cpp |  3 +++
 driver/cl_options.h   |  1 +
 driver/ldmd.cpp       | 12 ++++--------
 driver/linker.cpp     | 11 ++++-------
 4 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/driver/cl_options.cpp b/driver/cl_options.cpp
index 49e342b..338a9cc 100644
--- a/driver/cl_options.cpp
+++ b/driver/cl_options.cpp
@@ -59,6 +59,9 @@ cl::list<std::string> runargs(
         "Runs the resulting program, passing the remaining arguments to it"),
     cl::Positional, cl::PositionalEatsArgs);
 
+cl::opt<bool> invokedByLDMD("ldmd", cl::desc("Invoked by LDMD?"),
+                            cl::ZeroOrMore, cl::ReallyHidden);
+
 static cl::opt<ubyte, true> useDeprecated(
     cl::desc("Allow deprecated code/language features:"), cl::ZeroOrMore,
     clEnumValues(clEnumValN(0, "de", "Do not allow deprecated features"),
diff --git a/driver/cl_options.h b/driver/cl_options.h
index bdb54c6..e604a94 100644
--- a/driver/cl_options.h
+++ b/driver/cl_options.h
@@ -44,6 +44,7 @@ extern llvm::SmallVector<const char *, 32> allArguments;
  */
 extern cl::list<std::string> fileList;
 extern cl::list<std::string> runargs;
+extern cl::opt<bool> invokedByLDMD;
 extern cl::opt<bool> compileOnly;
 extern cl::opt<bool, true> enforcePropertySyntax;
 extern cl::opt<bool> noAsm;
diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp
index e6e7d21..19d231e 100644
--- a/driver/ldmd.cpp
+++ b/driver/ldmd.cpp
@@ -350,6 +350,8 @@ void translateArgs(size_t originalArgc, char **originalArgv,
   assert(ldcArgs.size() == 1);
   const std::string ldcPath = ldcArgs[0];
 
+  ldcArgs.push_back("-ldmd");
+
   bool vdmd = false;
   bool noFiles = true;
 
@@ -441,14 +443,8 @@ void translateArgs(size_t originalArgc, char **originalArgv,
        * -wi
        * -O
        * -o-
-       */
-      else if (strcmp(p + 1, "od") == 0) {
-        ldcArgs.push_back(p);
-        // DMD creates static libraries in the objects directory (unless using
-        // an absolute output path via `-of`).
-        ldcArgs.push_back("-create-static-lib-in-objdir");
-      }
-      /* -of
+       * -od
+       * -of
        * -op
        */
       else if (strcmp(p + 1, "o") == 0) {
diff --git a/driver/linker.cpp b/driver/linker.cpp
index 367ef50..557b60c 100644
--- a/driver/linker.cpp
+++ b/driver/linker.cpp
@@ -45,12 +45,6 @@ static llvm::cl::opt<bool> staticFlag(
         "Create a statically linked binary, including all system dependencies"),
     llvm::cl::ZeroOrMore);
 
-// used by LDMD
-static llvm::cl::opt<bool> createStaticLibInObjdir(
-    "create-static-lib-in-objdir",
-    llvm::cl::desc("Create static library in -od directory (DMD-compliant)"),
-    llvm::cl::ZeroOrMore, llvm::cl::ReallyHidden);
-
 static llvm::cl::opt<std::string>
     ltoLibrary("flto-binary",
                llvm::cl::desc("Set the linker LTO plugin library file (e.g. "
@@ -851,7 +845,10 @@ int createStaticLibrary() {
     libName += '.';
     libName += global.lib_ext;
   }
-  if (createStaticLibInObjdir && global.params.objdir &&
+
+  // DMD creates static libraries in the objects directory (unless using an
+  // absolute output path via `-of`).
+  if (opts::invokedByLDMD && global.params.objdir &&
       !FileName::absolute(libName.c_str())) {
     libName = FileName::combine(global.params.objdir, libName.c_str());
   }

-- 
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