From f76870f255b64c227caa91ae6ec09e9149666235 Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Sun, 7 Jun 2009 17:20:55 +0200 Subject: [PATCH] Print the path to the configuration file being used if `-v` is passed. --- gen/configfile.cpp | 3 +++ gen/configfile.h | 4 ++++ gen/main.cpp | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/gen/configfile.cpp b/gen/configfile.cpp index 4c3c2898..6274202d 100644 --- a/gen/configfile.cpp +++ b/gen/configfile.cpp @@ -89,6 +89,9 @@ bool ConfigFile::read(const char* argv0, void* mainAddr, const char* filename) } } + // save config file path for -v output + pathstr = p.toString(); + try { // read the cfg diff --git a/gen/configfile.h b/gen/configfile.h index a9695273..dbbc82e6 100644 --- a/gen/configfile.h +++ b/gen/configfile.h @@ -2,6 +2,7 @@ #define LDC_CONF_CONFIGFILE_H #include +#include namespace libconfig { @@ -23,8 +24,11 @@ public: s_iterator switches_begin() { return switches.begin(); } s_iterator switches_end() { return switches.end(); } + const std::string& path() { return pathstr; } + private: libconfig::Config* cfg; + std::string pathstr; s_vector switches; }; diff --git a/gen/main.cpp b/gen/main.cpp index ddfe77e4..aa600f2c 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -204,6 +204,13 @@ int main(int argc, char** argv) cl::SetVersionPrinter(&printVersion); cl::ParseCommandLineOptions(final_args.size(), (char**)&final_args[0], "LLVM-based D Compiler\n", true); + // Print config file path if -v was passed + if (global.params.verbose) { + const std::string& path = cfg_file.path(); + if (!path.empty()) + printf("config %s\n", path.c_str()); + } + // Negated options global.params.link = !compileOnly; global.params.obj = !dontWriteObj;