Skip to content

Commit eba6160

Browse files
authored
[flang][Driver] Support --no-warnings option (#107455)
Because of the way visibility is implemented in Options.td, options that are aliases do not inherit the visibility of the option being aliased. Therefore, explicitly set the visibility of the alias to be the same as the aliased option. This partially addresses #89888
1 parent 914ab36 commit eba6160

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5986,7 +5986,9 @@ def _no_line_commands : Flag<["--"], "no-line-commands">, Alias<P>;
59865986
def _no_standard_includes : Flag<["--"], "no-standard-includes">, Alias<nostdinc>;
59875987
def _no_standard_libraries : Flag<["--"], "no-standard-libraries">, Alias<nostdlib>;
59885988
def _no_undefined : Flag<["--"], "no-undefined">, Flags<[LinkerInput]>;
5989-
def _no_warnings : Flag<["--"], "no-warnings">, Alias<w>;
5989+
def _no_warnings : Flag<["--"], "no-warnings">,
5990+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
5991+
Alias<w>;
59905992
def _optimize_EQ : Joined<["--"], "optimize=">, Alias<O>;
59915993
def _optimize : Flag<["--"], "optimize">, Alias<O>;
59925994
def _output_class_directory_EQ : Joined<["--"], "output-class-directory=">, Alias<foutput_class_dir_EQ>;

flang/test/Driver/w-option.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
! Test that the warnings are not generated with `-w` option.
55
! RUN: %flang -c -w %s 2>&1 | FileCheck --allow-empty %s -check-prefix=WARNING
66

7+
! Test that the warnings are not generated with `--no-warnings` option.
8+
! RUN: %flang -c --no-warnings %s 2>&1 | FileCheck --allow-empty %s -check-prefix=WARNING
9+
710
! Test that warnings are portability messages are generated.
811
! RUN: %flang -c -pedantic %s 2>&1 | FileCheck %s -check-prefixes=DEFAULT,PORTABILITY
912

0 commit comments

Comments
 (0)