Skip to content

Commit 984032c

Browse files
author
Tarun Prabhu
committed
[flang][Driver] Support --no-warnings option
Because of the way visibility is implemented in Options.td, options that are aliases do not inherit the visibility of the option being aliased. For now, explicitly set the visibility of the alias to be the same as the aliased option. This partially addresses #89888
1 parent 216ba6b commit 984032c

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
@@ -5978,7 +5978,9 @@ def _no_line_commands : Flag<["--"], "no-line-commands">, Alias<P>;
59785978
def _no_standard_includes : Flag<["--"], "no-standard-includes">, Alias<nostdinc>;
59795979
def _no_standard_libraries : Flag<["--"], "no-standard-libraries">, Alias<nostdlib>;
59805980
def _no_undefined : Flag<["--"], "no-undefined">, Flags<[LinkerInput]>;
5981-
def _no_warnings : Flag<["--"], "no-warnings">, Alias<w>;
5981+
def _no_warnings : Flag<["--"], "no-warnings">,
5982+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
5983+
Alias<w>;
59825984
def _optimize_EQ : Joined<["--"], "optimize=">, Alias<O>;
59835985
def _optimize : Flag<["--"], "optimize">, Alias<O>;
59845986
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)