Skip to content

Commit

Permalink
Sync with dmd/mars.d
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Feb 18, 2022
1 parent a6e9903 commit fa9897f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ version (IN_LLVM)
break;
case "16997":
case "intpromote":
params.fix16997 = true;
deprecation(Loc.initial, "`-transition=%s` is now the default behavior", name);
break;
case "markdown":
params.markdown = true;
Expand Down
7 changes: 4 additions & 3 deletions driver/cl_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ static cl::list<std::string, StringsAdapter> stringImportPaths(
"J", cl::desc("Look for string imports also in <directory>"),
cl::value_desc("directory"), cl::location(strImpPathStore), cl::Prefix);

static cl::opt<bool, true>
addMain("main", cl::desc("Add default main() (e.g. for unittesting)"),
cl::ZeroOrMore, cl::location(global.params.addMain));
static cl::opt<bool, true> addMain(
"main", cl::ZeroOrMore, cl::location(global.params.addMain),
cl::desc(
"Add default main() if not present already (e.g. for unittesting)"));

// -d-debug is a bit messy, it has 3 modes:
// -d-debug=ident, -d-debug=level and -d-debug (without argument)
Expand Down
40 changes: 25 additions & 15 deletions driver/ldmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ Where:\n\
" -extern-std=[h|help|?]\n\
list all supported standards\n"
#endif
" -fPIC generate position independent code\n\
-g add symbolic debug info\n\
" -fPIC generate position independent code\n"
#if 0
" -fPIE generate position independent executables\n"
#endif
" -g add symbolic debug info\n\
-gdwarf=<version> add DWARF symbolic debug info\n\
-gf emit debug info for all referenced types\n\
-gs always emit stack frame\n"
Expand All @@ -188,8 +191,11 @@ Where:\n\
-Hd=<directory> write 'header' file to directory\n\
-Hf=<filename> write 'header' file to filename\n\
-HC[=[silent|verbose]]\n\
generate C++ 'header' file\n\
-HCd=<directory> write C++ 'header' file to directory\n\
generate C++ 'header' file\n"
#if 0
" -HC=[?|h|help] list available modes for C++ 'header' file generation\n"
#endif
" -HCd=<directory> write C++ 'header' file to directory\n\
-HCf=<filename> write C++ 'header' file to filename\n\
--help print help and exit\n\
-I=<directory> look for imports also in directory\n\
Expand All @@ -205,10 +211,9 @@ Where:\n\
" -m32mscoff generate 32 bit code and write MS-COFF object files\n"
#endif
" -m64 generate 64 bit code\n\
-main add default main() (e.g. for unittesting)\n\
-makedeps print module dependencies in Makefile compatible format to stdout\n\
-makedeps=<filename>\n\
write module dependencies in Makefile compatible format to filename (only imports)\n\
-main add default main() if not present already (e.g. for unittesting)\n\
-makedeps[=<filename>]\n\
print dependencies in Makefile compatible format to filename or stdout\n\
-man open web browser on manual page\n"
#if 0
" -map generate linker .map file\n"
Expand All @@ -225,8 +230,11 @@ Where:\n\
-o- do not write object file\n\
-od=<directory> write object & library files to directory\n\
-of=<filename> name output file to filename\n\
-op preserve source path for output files\n\
-preview=<name> enable an upcoming language change identified by 'name'\n\
-op preserve source path for output files\n"
#if 0
" -os=<os> sets target operating system to <os>\n"
#endif
" -preview=<name> enable an upcoming language change identified by 'name'\n\
-preview=[h|help|?]\n\
list all upcoming language changes\n\
-profile profile runtime performance of generated code\n"
Expand All @@ -246,6 +254,7 @@ Where:\n\
list all language changes\n\
-unittest compile in unit tests\n\
-v verbose\n\
-vasm generate additional textual assembly files (*.s)\n\
-vcolumns print character (column) numbers in diagnostics\n\
-vdmd print the underlying LDC command line\n\
-verror-style=[digitalmars|gnu]\n\
Expand Down Expand Up @@ -530,16 +539,14 @@ void translateArgs(const llvm::SmallVectorImpl<const char *> &ldmdArgs,
}
}
/* -v
*/
else if (strcmp(p + 1, "vtls") == 0) {
ldcArgs.push_back("-transition=tls");
}
/* -vasm [was added by https://github.com/dlang/dmd/pull/13447]
* -vcg-ast
*/
else if (strcmp(p + 1, "vasm") == 0) {
ldcArgs.push_back("--output-s");
ldcArgs.push_back("--output-o");
ldcArgs.push_back("--x86-asm-syntax=intel");
} else if (strcmp(p + 1, "vtls") == 0) {
ldcArgs.push_back("-transition=tls");
}
/* -vtemplates
* -vcolumns
Expand Down Expand Up @@ -577,6 +584,9 @@ void translateArgs(const llvm::SmallVectorImpl<const char *> &ldmdArgs,
} else {
goto Lerror;
}
} else if (startsWith(p + 1, "os=")) {
error("please specify a full target triple via -mtriple instead of the "
"target OS (-os) alone");
}
/* -extern-std
* -transition
Expand Down
12 changes: 12 additions & 0 deletions driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,14 @@ void registerPredefinedVersions() {
VersionCondition::addPredefinedGlobalIdent("assert");
}

if (global.params.useIn == CHECKENABLEon) {
VersionCondition::addPredefinedGlobalIdent("D_PreConditions");
}

if (global.params.useOut == CHECKENABLEon) {
VersionCondition::addPredefinedGlobalIdent("D_PostConditions");
}

if (global.params.useArrayBounds == CHECKENABLEoff) {
VersionCondition::addPredefinedGlobalIdent("D_NoBoundsChecks");
}
Expand All @@ -921,6 +929,10 @@ void registerPredefinedVersions() {
VersionCondition::addPredefinedGlobalIdent("D_TypeInfo");
}

if (global.params.tracegc) {
VersionCondition::addPredefinedGlobalIdent("D_ProfileGC");
}

registerPredefinedTargetVersions();

// `D_ObjectiveC` is added by the dmd.objc.Supported ctor
Expand Down
2 changes: 1 addition & 1 deletion tests/d2/dmd-testsuite

0 comments on commit fa9897f

Please sign in to comment.