mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
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.
This commit is contained in:
parent
0e71a760ae
commit
cecb040ff0
3 changed files with 24 additions and 14 deletions
|
@ -124,10 +124,9 @@ struct Param
|
||||||
bool betterC; // be a "better C" compiler; no dependency on D runtime
|
bool betterC; // be a "better C" compiler; no dependency on D runtime
|
||||||
bool addMain; // add a default main() function
|
bool addMain; // add a default main() function
|
||||||
bool allInst; // generate code for all template instantiations
|
bool allInst; // generate code for all template instantiations
|
||||||
// LDC_FIXME: Implement "addMain" and "allInst".
|
|
||||||
bool check10378; // check for issues transitioning to 10738
|
bool check10378; // check for issues transitioning to 10738
|
||||||
bool bug10378; // use pre-bugzilla 10378 search strategy
|
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
|
bool showGaggedErrors; // print gagged errors anyway
|
||||||
|
|
||||||
BOUNDSCHECK useArrayBounds;
|
BOUNDSCHECK useArrayBounds;
|
||||||
|
|
|
@ -431,8 +431,12 @@ void translateArgs(size_t originalArgc, char **originalArgv,
|
||||||
} else {
|
} else {
|
||||||
goto Lerror;
|
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
|
* -w
|
||||||
* -wi
|
* -wi
|
||||||
* -O
|
* -O
|
||||||
|
@ -585,6 +589,9 @@ void translateArgs(size_t originalArgc, char **originalArgv,
|
||||||
|
|
||||||
if (noFiles) {
|
if (noFiles) {
|
||||||
printUsage(originalArgv[0], ldcPath);
|
printUsage(originalArgv[0], ldcPath);
|
||||||
|
if (originalArgc == 1)
|
||||||
|
exit(EXIT_FAILURE); // compatible with DMD
|
||||||
|
else
|
||||||
error("No source file specified.");
|
error("No source file specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,16 +178,18 @@ void processVersions(std::vector<std::string> &list, const char *type,
|
||||||
void processTransitions(std::vector<std::string> &list) {
|
void processTransitions(std::vector<std::string> &list) {
|
||||||
for (const auto &i : list) {
|
for (const auto &i : list) {
|
||||||
if (i == "?") {
|
if (i == "?") {
|
||||||
printf("Language changes listed by -transition=id:\n");
|
printf("\n"
|
||||||
printf(" = all list information on all language changes\n");
|
"Language changes listed by -transition=id:\n"
|
||||||
printf(" = checkimports give deprecation messages about 10378 "
|
" =all list information on all language changes\n"
|
||||||
"anomalies\n");
|
" =checkimports give deprecation messages about 10378 "
|
||||||
printf(
|
"anomalies\n"
|
||||||
" = complex,14488 list all usages of complex or imaginary types\n");
|
" =complex,14488 list all usages of complex or imaginary types\n"
|
||||||
printf(" = field,3449 list all non - mutable fields which occupy an "
|
" =field,3449 list all non-mutable fields which occupy an "
|
||||||
"object instance\n");
|
"object instance\n"
|
||||||
printf(" = import,10378 revert to single phase name lookup\n");
|
" =import,10378 revert to single phase name lookup\n"
|
||||||
printf(" = tls list all variables going into thread local "
|
" =safe shows places with hidden change in semantics "
|
||||||
|
"needed for better @safe guarantees\n"
|
||||||
|
" =tls list all variables going into thread local "
|
||||||
"storage\n");
|
"storage\n");
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} else if (i == "all") {
|
} else if (i == "all") {
|
||||||
|
@ -204,6 +206,8 @@ void processTransitions(std::vector<std::string> &list) {
|
||||||
global.params.vfield = true;
|
global.params.vfield = true;
|
||||||
} else if (i == "import" || i == "10378") {
|
} else if (i == "import" || i == "10378") {
|
||||||
global.params.bug10378 = true;
|
global.params.bug10378 = true;
|
||||||
|
} else if (i == "safe") {
|
||||||
|
global.params.vsafe = true;
|
||||||
} else if (i == "tls") {
|
} else if (i == "tls") {
|
||||||
global.params.vtls = true;
|
global.params.vtls = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue