Author: Tarun Prabhu Date: 2024-09-09T09:57:49-06:00 New Revision: eba6160deec5a32e4b31c2a446172d0e388195c9
URL: https://github.com/llvm/llvm-project/commit/eba6160deec5a32e4b31c2a446172d0e388195c9 DIFF: https://github.com/llvm/llvm-project/commit/eba6160deec5a32e4b31c2a446172d0e388195c9.diff LOG: [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 https://github.com/llvm/llvm-project/issues/89888 Added: Modified: clang/include/clang/Driver/Options.td flang/test/Driver/w-option.f90 Removed: ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 37e80c24be3214..bf8569fc780d6a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5986,7 +5986,9 @@ def _no_line_commands : Flag<["--"], "no-line-commands">, Alias<P>; def _no_standard_includes : Flag<["--"], "no-standard-includes">, Alias<nostdinc>; def _no_standard_libraries : Flag<["--"], "no-standard-libraries">, Alias<nostdlib>; def _no_undefined : Flag<["--"], "no-undefined">, Flags<[LinkerInput]>; -def _no_warnings : Flag<["--"], "no-warnings">, Alias<w>; +def _no_warnings : Flag<["--"], "no-warnings">, + Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, + Alias<w>; def _optimize_EQ : Joined<["--"], "optimize=">, Alias<O>; def _optimize : Flag<["--"], "optimize">, Alias<O>; def _output_class_directory_EQ : Joined<["--"], "output-class-directory=">, Alias<foutput_class_dir_EQ>; diff --git a/flang/test/Driver/w-option.f90 b/flang/test/Driver/w-option.f90 index e34cddaab373a1..b6aa44a06ab729 100644 --- a/flang/test/Driver/w-option.f90 +++ b/flang/test/Driver/w-option.f90 @@ -4,6 +4,9 @@ ! Test that the warnings are not generated with `-w` option. ! RUN: %flang -c -w %s 2>&1 | FileCheck --allow-empty %s -check-prefix=WARNING +! Test that the warnings are not generated with `--no-warnings` option. +! RUN: %flang -c --no-warnings %s 2>&1 | FileCheck --allow-empty %s -check-prefix=WARNING + ! Test that warnings are portability messages are generated. ! RUN: %flang -c -pedantic %s 2>&1 | FileCheck %s -check-prefixes=DEFAULT,PORTABILITY _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits