-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang] Ignore -f[no-]realloc-lhs. #120320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
After llvm#120165 clang started complaining about unknown option -f[no-]realloc-lhs. This change fixes it to ignore the option like it used to be.
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Slava Zakharin (vzakhari) ChangesAfter #120165 clang started complaining about unknown Full diff: https://github.com/llvm/llvm-project/pull/120320.diff 2 Files Affected:
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 7b544d2534d469..bc3c548da8b96c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3465,7 +3465,7 @@ defm diagnostics_show_line_numbers : BoolFOption<"diagnostics-show-line-numbers"
PosFlag<SetTrue>>;
def fno_realloc_lhs : Flag<["-"], "fno-realloc-lhs">, Group<f_Group>,
HelpText<"An allocatable left-hand side of an intrinsic assignment is assumed to be allocated and match the shape/type of the right-hand side">,
- Visibility<[FlangOption, FC1Option]>;
+ Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>;
def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>,
HelpText<"Disable the use of stack protectors">;
def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
@@ -4300,7 +4300,7 @@ defm stack_size_section : BoolFOption<"stack-size-section",
"Emit section containing metadata on function stack sizes">,
NegFlag<SetFalse>>;
def frealloc_lhs : Flag<["-"], "frealloc-lhs">, Group<f_Group>,
- Visibility<[FlangOption, FC1Option]>,
+ Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>,
HelpText<"If an allocatable left-hand side of an intrinsic assignment is unallocated or its shape/type does not match the right-hand side, then it is automatically (re)allocated">;
def fstack_usage : Flag<["-"], "fstack-usage">, Group<f_Group>,
HelpText<"Emit .su file containing information on function stack sizes">;
diff --git a/clang/test/Driver/frealloc-lhs.cpp b/clang/test/Driver/frealloc-lhs.cpp
new file mode 100644
index 00000000000000..792247deaaa2c1
--- /dev/null
+++ b/clang/test/Driver/frealloc-lhs.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang -Wunused-command-line-argument -frealloc-lhs -### %s 2> %t
+// RUN: FileCheck < %t %s --check-prefix=REALLOCLHS
+// RUN: %clang -Wunused-command-line-argument -fno-realloc-lhs -### %s 2> %t
+// RUN: FileCheck < %t %s --check-prefix=NOREALLOCLHS
+
+// CHECK: argument unused during compilation: '-frealloc-lhs'
+// CHECK: argument unused during compilation: '-fno-realloc-lhs'
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After #120165 clang started complaining about unknown option -f[no-]realloc-lhs.
Was this on an existing test?
@@ -3465,7 +3465,7 @@ defm diagnostics_show_line_numbers : BoolFOption<"diagnostics-show-line-numbers" | |||
PosFlag<SetTrue>>; | |||
def fno_realloc_lhs : Flag<["-"], "fno-realloc-lhs">, Group<f_Group>, | |||
HelpText<"An allocatable left-hand side of an intrinsic assignment is assumed to be allocated and match the shape/type of the right-hand side">, | |||
Visibility<[FlangOption, FC1Option]>; | |||
Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this now show up in clang --help
and online guide? Is that what we want?
Is CLOption for Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this now show up in
clang --help
and online guide? Is that what we want? Is CLOption for Windows?
Good point! Yes, clang --help
now shows it, and I think we do not want this. I will check how I can resolve this. Any advices are welcome.
Yes, CLOption
is for Windows driver.
I noticed it when trying to compile a Fortran/C mix test where flang/clang were used as compilers and I passed |
I am guessing that this might be the case for all Fortran flags we switched over from the gfortran group to the Flang group. Previously clang could be used for forwarding Fortran options to gcc/gfortran. But this is not the case anymore. For example, i think In short I think the present behaviour is OK. But if you and others feel otherwise feel free to push forward. |
Okay, I do not see an easy way to allow this option for |
After #120165 clang started complaining about unknown
option -f[no-]realloc-lhs. This change fixes it to ignore
the option like it used to be.