From 8ef26f1289bf069ccc0d6383f2f4c0116a1206c1 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 12 Jul 2024 13:14:41 +0200 Subject: [PATCH] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (#98613) After commit ce4aada6e2135e29839f672a6599db628b53295d, we observed many warnings in our internal codebase. It is infeasible to fix all at once. Currently, there is no way to disable this warning. This patch provides a way to disable it using the `-Wno-missing-dependent-template-keyword` flag. --- clang/docs/ReleaseNotes.rst | 1 + clang/include/clang/Basic/DiagnosticParseKinds.td | 3 ++- clang/test/Misc/warning-flags.c | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2bca35cd4cf3c6..b211e8255ec0c5 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -315,6 +315,7 @@ Resolutions to C++ Defect Reports - Clang now correctly implements lookup for the terminal name of a member-qualified nested-name-specifier. (`CWG1835: Dependent member lookup before < `_). + The warning can be disabled via `-Wno-missing-dependent-template-keyword`. C Language Changes ------------------ diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 0bd2e35bf2e317..e00cd47411cb31 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -896,7 +896,8 @@ def missing_template_arg_list_after_template_kw : Extension< DefaultError; def ext_missing_dependent_template_keyword : ExtWarn< - "use 'template' keyword to treat '%0' as a dependent template name">; + "use 'template' keyword to treat '%0' as a dependent template name">, + InGroup>; def ext_extern_template : Extension< "extern templates are a C++11 extension">, InGroup; diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index 651a86fb6e2265..7b993f6849363b 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,10 +18,9 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (65): +CHECK: Warnings without flags (64): CHECK-NEXT: ext_expected_semi_decl_list -CHECK-NEXT: ext_missing_dependent_template_keyword CHECK-NEXT: ext_missing_whitespace_after_macro_name CHECK-NEXT: ext_new_paren_array_nonconst CHECK-NEXT: ext_plain_complex