[pkg-d-commits] [ldc] 101/149: Add command-line option -transition=safe

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:37:02 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 cecb040ff01cbd0bf543b9ef49e0a176ff2e1f43
Author: Martin <noone at nowhere.com>
Date:   Sun Feb 12 16:59:50 2017 +0100

    Add command-line option -transition=safe
    
    Also fix `ldmd2 -transition=?` regression and don't display an error
    message when invoking LDMD without command-line args.
---
 ddmd/globals.h  |  3 +--
 driver/ldmd.cpp | 11 +++++++++--
 driver/main.cpp | 24 ++++++++++++++----------
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/ddmd/globals.h b/ddmd/globals.h
index f548309..81aad1e 100644
--- a/ddmd/globals.h
+++ b/ddmd/globals.h
@@ -124,10 +124,9 @@ struct Param
     bool betterC;       // be a "better C" compiler; no dependency on D runtime
     bool addMain;       // add a default main() function
     bool allInst;       // generate code for all template instantiations
-// LDC_FIXME: Implement "addMain" and "allInst".
     bool check10378;    // check for issues transitioning to 10738
     bool bug10378;      // use pre-bugzilla 10378 search strategy
-    bool safe;          // use enhanced @safe checking
+    bool vsafe;         // use enhanced @safe checking
     bool showGaggedErrors;  // print gagged errors anyway
 
     BOUNDSCHECK useArrayBounds;
diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp
index 52210ff..a4c83b3 100644
--- a/driver/ldmd.cpp
+++ b/driver/ldmd.cpp
@@ -431,8 +431,12 @@ void translateArgs(size_t originalArgc, char **originalArgv,
         } else {
           goto Lerror;
         }
+      } else if (strcmp(p + 1, "transition=?") == 0) {
+        const char *transitionargs[] = {ldcPath.c_str(), p, nullptr};
+        execute(ldcPath, transitionargs);
+        exit(EXIT_SUCCESS);
       }
-      /* -transition
+      /* -transition=<id>
        * -w
        * -wi
        * -O
@@ -585,7 +589,10 @@ void translateArgs(size_t originalArgc, char **originalArgv,
 
   if (noFiles) {
     printUsage(originalArgv[0], ldcPath);
-    error("No source file specified.");
+    if (originalArgc == 1)
+      exit(EXIT_FAILURE); // compatible with DMD
+    else
+      error("No source file specified.");
   }
 
   if (vdmd) {
diff --git a/driver/main.cpp b/driver/main.cpp
index 372c7b4..a7a8ac2 100644
--- a/driver/main.cpp
+++ b/driver/main.cpp
@@ -178,16 +178,18 @@ void processVersions(std::vector<std::string> &list, const char *type,
 void processTransitions(std::vector<std::string> &list) {
   for (const auto &i : list) {
     if (i == "?") {
-      printf("Language changes listed by -transition=id:\n");
-      printf("  = all           list information on all language changes\n");
-      printf("  = checkimports  give deprecation messages about 10378 "
-             "anomalies\n");
-      printf(
-          "  = complex,14488 list all usages of complex or imaginary types\n");
-      printf("  = field,3449    list all non - mutable fields which occupy an "
-             "object instance\n");
-      printf("  = import,10378  revert to single phase name lookup\n");
-      printf("  = tls           list all variables going into thread local "
+      printf("\n"
+             "Language changes listed by -transition=id:\n"
+             "  =all           list information on all language changes\n"
+             "  =checkimports  give deprecation messages about 10378 "
+             "anomalies\n"
+             "  =complex,14488 list all usages of complex or imaginary types\n"
+             "  =field,3449    list all non-mutable fields which occupy an "
+             "object instance\n"
+             "  =import,10378  revert to single phase name lookup\n"
+             "  =safe          shows places with hidden change in semantics "
+             "needed for better @safe guarantees\n"
+             "  =tls           list all variables going into thread local "
              "storage\n");
       exit(EXIT_SUCCESS);
     } else if (i == "all") {
@@ -204,6 +206,8 @@ void processTransitions(std::vector<std::string> &list) {
       global.params.vfield = true;
     } else if (i == "import" || i == "10378") {
       global.params.bug10378 = true;
+    } else if (i == "safe") {
+      global.params.vsafe = true;
     } else if (i == "tls") {
       global.params.vtls = true;
     } else {

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