https://github.com/higher-performance updated https://github.com/llvm/llvm-project/pull/172910
>From 1f1a5efa814b2cb7582ba10c9664ba6d7f91b56e Mon Sep 17 00:00:00 2001 From: higher-performance <[email protected]> Date: Thu, 18 Dec 2025 16:50:59 -0500 Subject: [PATCH] [clang] Make error for [[clang::coro_wrapper]] be downgradable to a warning Given that both -Wreturn-type and -Wdangling are already warnings and not hard errors, it makes sense for this diagnostic to behave similarly. This allows suppressing benign occurrences of the error in external headers whose source code is not in the user's direct control, such as in std::function_ref-like classes. --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 6 +++--- clang/lib/Sema/SemaDecl.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index a8fd17ecd2bdd..596fd52e69677 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -12731,10 +12731,10 @@ def err_conflicting_aligned_options : Error < def err_coro_invalid_addr_of_label : Error< "the GNU address of label extension is not allowed in coroutines" >; -def err_coroutine_return_type : Error< +def warn_coroutine_return_type : Warning< "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; " - "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type" ->; + "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type">, + DefaultError; def warn_coroutine_type_aware_allocator_ignored : Warning < "type aware %0 will not be used for coroutine allocation">, InGroup<CoroTypeAwareAllocationFunction>; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 1a5e8c607a242..d67b04baed956 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -16432,7 +16432,7 @@ void Sema::CheckCoroutineWrapper(FunctionDecl *FD) { if (CanBeGetReturnObject(FD) || CanBeGetReturnTypeOnAllocFailure(FD)) return; if (!FD->hasAttr<CoroWrapperAttr>()) - Diag(FD->getLocation(), diag::err_coroutine_return_type) << RD; + Diag(FD->getLocation(), diag::warn_coroutine_return_type) << RD; } Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, bool IsInstantiation, _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
