mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 22:50:53 +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 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;
|
||||
|
|
|
@ -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,6 +589,9 @@ void translateArgs(size_t originalArgc, char **originalArgv,
|
|||
|
||||
if (noFiles) {
|
||||
printUsage(originalArgv[0], ldcPath);
|
||||
if (originalArgc == 1)
|
||||
exit(EXIT_FAILURE); // compatible with DMD
|
||||
else
|
||||
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) {
|
||||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue