Skip to content

Conversation

Meinersbur
Copy link
Member

@Meinersbur Meinersbur commented Jul 17, 2025

Add the syntax -fintrinsic-modules-path=<dir> as an alias to the existing option -fintrinsic-modules-path <dir>. gfortran also supports both alternatives.

This is particularly useful with CMake which de-duplicates command-line options. For instance, -fintrinsic-modules-path /path/A -fintrinsic-modules-path /path/B is de-duplicated to -fintrinsic-modules-path /path/A /path/B since it conisiders the second -fintrinsic-modules-path "redundant". This can be avoided using the syntax -fintrinsic-modules-path=/path/A -fintrinsic-modules-path=/path/B.

@Meinersbur Meinersbur marked this pull request as ready for review July 18, 2025 07:36
@llvmbot llvmbot added clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category labels Jul 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-flang-driver

Author: Michael Kruse (Meinersbur)

Changes

Add the syntax -fintrinsic-modules-path=&lt;dir&gt; as an alias to the existing option -fintrinsic-modules-path &lt;dir&gt;. gfortran also supports both alternatives.

This is particularly useful with CMake which de-duplicates command-line options. For instance, -fintrinsic-modules-path /path/A -fintrinsic-modules-path /path/B is de-duplicated to -fintrinsic-modules-path /path/A /path/B since it conisiders the second flag "redundant". This can be avoided using the syntax -fintrinsic-modules-path=/path/A -fintrinsic-modules-path=/path/B.


Full diff: https://github.com/llvm/llvm-project/pull/149417.diff

2 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+2)
  • (modified) flang/test/Driver/intrinsic-module-path.f90 (+1)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index a8c1b5dd8ab3b..b69299fd006ee 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7142,6 +7142,8 @@ def fintrinsic_modules_path : Separate<["-"], "fintrinsic-modules-path">,  Group
   HelpText<"Specify where to find the compiled intrinsic modules">,
   DocBrief<[{This option specifies the location of pre-compiled intrinsic modules,
   if they are not in the default location expected by the compiler.}]>;
+def fintrinsic_modules_path_EQ : Joined<["-"], "fintrinsic-modules-path=">,
+  Group<f_Group>, Alias<fintrinsic_modules_path>;
 
 defm backslash : OptInFC1FFlag<"backslash", "Specify that backslash in string introduces an escape character">;
 defm xor_operator : OptInFC1FFlag<"xor-operator", "Enable .XOR. as a synonym of .NEQV.">;
diff --git a/flang/test/Driver/intrinsic-module-path.f90 b/flang/test/Driver/intrinsic-module-path.f90
index 8fe486cf61c83..615d8f9a1730a 100644
--- a/flang/test/Driver/intrinsic-module-path.f90
+++ b/flang/test/Driver/intrinsic-module-path.f90
@@ -8,6 +8,7 @@
 !-----------------------------------------
 ! RUN: %flang_fc1 -fsyntax-only %s  2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
 ! RUN: not %flang_fc1 -fsyntax-only -fintrinsic-modules-path %S/Inputs/ %s  2>&1 | FileCheck %s --check-prefix=GIVEN
+! RUN: not %flang_fc1 -fsyntax-only -fintrinsic-modules-path=%S/Inputs/ %s  2>&1 | FileCheck %s --check-prefix=GIVEN
 
 ! WITHOUT-NOT: 'ieee_arithmetic.mod' was not found
 ! WITHOUT-NOT: 'iso_fortran_env.mod' was not found

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@Meinersbur Meinersbur merged commit ed2bfd1 into main Jul 21, 2025
15 checks passed
@Meinersbur Meinersbur deleted the users/meinersbur/flang_intrinsic-modules-path branch July 21, 2025 15:18
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
Add the syntax `-fintrinsic-modules-path=<dir>` as an alias to the
existing option `-fintrinsic-modules-path <dir>`. gfortran also supports
both alternatives.

This is particularly useful with CMake which de-duplicates command-line
options. For instance,
`-fintrinsic-modules-path /path/A -fintrinsic-modules-path /path/B`
is de-duplicated to
`-fintrinsic-modules-path /path/A /path/B`
since it conisiders the second `-fintrinsic-modules-path`
"redundant". This can be avoided using the syntax
`-fintrinsic-modules-path=/path/A -fintrinsic-modules-path=/path/B`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants