[flang-commits] [flang] [flang][driver] Make the -J option less restrictive so we would not have to struggle with autoconf (PR #110010)

Paul Osmialowski via flang-commits flang-commits at lists.llvm.org
Fri Sep 27 05:48:36 PDT 2024


================
@@ -830,14 +831,20 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   unsigned numErrorsBefore = diags.getNumErrors();
 
   // -J/module-dir option
-  auto moduleDirList =
+  std::vector<std::string> moduleDirList =
       args.getAllArgValues(clang::driver::options::OPT_module_dir);
-  // User can only specify -J/-module-dir once
+  // User can only specify one -J/-module-dir directory, but may repeat
+  // -J/-module-dir as long as the directory is the same each time.
   // https://gcc.gnu.org/onlinedocs/gfortran/Directory-Options.html
+  std::sort(moduleDirList.begin(), moduleDirList.end());
+  moduleDirList.erase(std::unique(moduleDirList.begin(), moduleDirList.end()),
+                      moduleDirList.end());
   if (moduleDirList.size() > 1) {
     const unsigned diagID =
         diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-                              "Only one '-module-dir/-J' option allowed");
+                              "Only one '-module-dir/-J' directory allowed. "
+                              "The '-module-dir/-J' may be given multiple times"
----------------
pawosm-arm wrote:

The shorter one is better, this line is long enough already.

https://github.com/llvm/llvm-project/pull/110010


More information about the flang-commits mailing list