mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 23:50:43 +03:00
Add -Xcpp CLI option for C preprocessor flags (-P with ldmd2)
This commit is contained in:
parent
5b137768a0
commit
1bf7e28c59
5 changed files with 23 additions and 13 deletions
|
@ -400,16 +400,18 @@ cl::list<std::string>
|
|||
cl::value_desc("linkerflag"), cl::cat(linkingCategory),
|
||||
cl::Prefix);
|
||||
|
||||
cl::list<std::string>
|
||||
ccSwitches("Xcc", cl::desc("Pass <ccflag> to GCC/Clang for linking"),
|
||||
cl::value_desc("ccflag"), cl::cat(linkingCategory));
|
||||
cl::list<std::string> ccSwitches(
|
||||
"Xcc", cl::value_desc("ccflag"), cl::cat(linkingCategory),
|
||||
cl::desc("Pass <ccflag> to GCC/Clang for linking/preprocessing"));
|
||||
|
||||
cl::opt<std::string>
|
||||
moduleDeps("deps", cl::ValueOptional, cl::ZeroOrMore,
|
||||
cl::value_desc("filename"),
|
||||
cl::desc("Write module dependencies to <filename> (only imports). "
|
||||
"'-deps' alone prints module dependencies "
|
||||
"(imports/file/version/debug/lib)"));
|
||||
cl::list<std::string> cppSwitches("Xcpp", cl::value_desc("cppflag"),
|
||||
cl::desc("Pass <cppflag> to C preprocessor"));
|
||||
|
||||
cl::opt<std::string> moduleDeps(
|
||||
"deps", cl::ValueOptional, cl::ZeroOrMore, cl::value_desc("filename"),
|
||||
cl::desc("Write module dependencies to <filename> (only imports). "
|
||||
"'-deps' alone prints module dependencies "
|
||||
"(imports/file/version/debug/lib)"));
|
||||
|
||||
cl::opt<std::string>
|
||||
makeDeps("makedeps", cl::ValueOptional, cl::ZeroOrMore,
|
||||
|
|
|
@ -75,6 +75,7 @@ extern cl::opt<std::string> makeDeps;
|
|||
extern cl::opt<std::string> cacheDir;
|
||||
extern cl::list<std::string> linkerSwitches;
|
||||
extern cl::list<std::string> ccSwitches;
|
||||
extern cl::list<std::string> cppSwitches;
|
||||
extern cl::list<std::string> includeModulePatterns;
|
||||
|
||||
extern cl::opt<bool> m32bits;
|
||||
|
|
|
@ -46,7 +46,9 @@ FileName runCPreprocessor(FileName csrcfile, const Loc &loc, bool &ifile,
|
|||
for (const auto &ccSwitch : opts::ccSwitches) {
|
||||
args.push_back(ccSwitch);
|
||||
}
|
||||
// TODO: -Xcpp switches?
|
||||
for (const auto &cppSwitch : opts::cppSwitches) {
|
||||
args.push_back(cppSwitch);
|
||||
}
|
||||
|
||||
if (isMSVC) {
|
||||
args.push_back("/P"); // run preprocessor
|
||||
|
|
|
@ -234,7 +234,9 @@ Where:\n\
|
|||
#if 0
|
||||
" -os=<os> sets target operating system to <os>\n"
|
||||
#endif
|
||||
" -preview=<name> enable an upcoming language change identified by 'name'\n\
|
||||
" -P=<preprocessorflag>\n\
|
||||
pass preprocessorflag to C preprocessor\n\
|
||||
-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"
|
||||
|
@ -707,7 +709,11 @@ void translateArgs(const llvm::SmallVectorImpl<const char *> &ldmdArgs,
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
/* -L
|
||||
* -defaultlib
|
||||
*/
|
||||
else if (p[1] == 'P') {
|
||||
ldcArgs.push_back(concat("-Xcpp=", p + 2 + (p[2] == '=' ? 1 : 0)));
|
||||
}
|
||||
/* -defaultlib
|
||||
* -debuglib
|
||||
* -deps
|
||||
* -main
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* REQUIRED_ARGS: -P=-DABC=3
|
||||
*/
|
||||
// DISABLED: LDC // FIXME
|
||||
|
||||
_Static_assert(ABC == 3, "1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue