[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
Thu Sep 26 04:31:12 PDT 2024


================
@@ -832,12 +833,15 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   // -J/module-dir option
   auto 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
   // 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");
----------------
DavidSpickett wrote:

This is not 100% clear that the number of -J isn't the problem, it's the number of unique directories given. How about:
"Only one `-module-dir/-J' directory allowed. '-module-dir/-J' may be given multiple times but the directory must be the same each time."

It's wordy but less room for confusion.

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


More information about the flang-commits mailing list