[pkg-d-commits] [ldc] 22/74: Fix object file type autodetection (issue #2105)

Matthias Klumpp mak at moszumanska.debian.org
Thu Jul 13 20:54:15 UTC 2017


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

mak pushed a commit to annotated tag v1.3.0-beta2
in repository ldc.

commit 5becfcf4f18888099ff0d68c45eea4cae5abd3dd
Author: Martin <noone at nowhere.com>
Date:   Sun May 14 14:26:55 2017 +0200

    Fix object file type autodetection (issue #2105)
---
 driver/main.cpp | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/driver/main.cpp b/driver/main.cpp
index 0efa58f..c0fde02 100644
--- a/driver/main.cpp
+++ b/driver/main.cpp
@@ -530,29 +530,24 @@ void parseCommandLine(int argc, char **argv, Strings &sourceFiles,
 
   // LDC output determination
 
-  // if we don't link, autodetect target from extension
-  if (!global.params.link && !global.params.lib && global.params.objname) {
+  // if we don't link and there's no `-output-*` switch but an `-of` one,
+  // autodetect type of desired 'object' file from file extension
+  if (!global.params.link && !global.params.lib && global.params.objname &&
+      global.params.output_o == OUTPUTFLAGdefault) {
     const char *ext = FileName::ext(global.params.objname);
-    bool autofound = false;
     if (!ext) {
       // keep things as they are
-    } else if (strcmp(ext, global.ll_ext) == 0) {
+    } else if (opts::output_ll != cl::BOU_FALSE &&
+               strcmp(ext, global.ll_ext) == 0) {
       global.params.output_ll = OUTPUTFLAGset;
-      autofound = true;
-    } else if (strcmp(ext, global.bc_ext) == 0) {
+      global.params.output_o = OUTPUTFLAGno;
+    } else if (opts::output_bc != cl::BOU_FALSE &&
+               strcmp(ext, global.bc_ext) == 0) {
       global.params.output_bc = OUTPUTFLAGset;
-      autofound = true;
-    } else if (strcmp(ext, global.s_ext) == 0) {
+      global.params.output_o = OUTPUTFLAGno;
+    } else if (opts::output_s != cl::BOU_FALSE &&
+               strcmp(ext, global.s_ext) == 0) {
       global.params.output_s = OUTPUTFLAGset;
-      autofound = true;
-    } else if (strcmp(ext, global.obj_ext) == 0 || strcmp(ext, "obj") == 0) {
-      // global.obj_ext hasn't been corrected yet for MSVC targets as we first
-      // need the command line to figure out the target...
-      // so treat both 'o' and 'obj' extensions as object files
-      global.params.output_o = OUTPUTFLAGset;
-      autofound = true;
-    }
-    if (autofound && global.params.output_o == OUTPUTFLAGdefault) {
       global.params.output_o = OUTPUTFLAGno;
     }
   }

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