Index: flang/tools/f18/f18.cpp =================================================================== --- flang/tools/f18/f18.cpp +++ flang/tools/f18/f18.cpp @@ -386,6 +386,11 @@ } } +int printVersion(){ + llvm::errs() << "\nf18 compiler (under development)\n"; + return exitStatus; +} + int main(int argc, char *const argv[]) { atexit(CleanUpAtExit); @@ -406,6 +411,10 @@ options.predefinitions.emplace_back("__F18_MAJOR__", "1"); options.predefinitions.emplace_back("__F18_MINOR__", "1"); options.predefinitions.emplace_back("__F18_PATCHLEVEL__", "1"); + options.predefinitions.emplace_back("__FLANG", "1"); + options.predefinitions.emplace_back("__FLANG_MAJOR__", "1"); + options.predefinitions.emplace_back("__FLANG_MINOR__", "1"); + options.predefinitions.emplace_back("__FLANG_PATCHLEVEL__", "1"); #if __x86_64__ options.predefinitions.emplace_back("__x86_64__", "1"); #endif @@ -622,13 +631,16 @@ << " -help print this again\n" << "Other options are passed through to the compiler.\n"; return exitStatus; - } else if (arg == "-V") { - llvm::errs() << "\nf18 compiler (under development)\n"; - return exitStatus; + } else if (arg == "-V" || arg == "-version") { + return printVersion(); } else { driver.F18_FCArgs.push_back(arg); if (arg == "-v") { - driver.verbose = true; + if( args.size() > 1 ) { + driver.verbose = true; + } else { + return printVersion(); + } } else if (arg == "-I") { driver.F18_FCArgs.push_back(args.front()); driver.searchDirectories.push_back(args.front());