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

David Spickett via flang-commits flang-commits at lists.llvm.org
Fri Sep 27 01:30: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"
----------------
DavidSpickett wrote:

Either:
The `-module-dir/-J' *option* may be...
Or:
'-module-dir/-J' may be...

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


More information about the flang-commits mailing list