[clang] [Clang][Sema] Add -Wredundant-defer to diagnose redundant `_Defer`s (PR #225748)
Ambrose Leeb via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 06:52:22 PDT 2026
================
@@ -11342,6 +11342,10 @@ def warn_empty_defer_body : Warning<
def note_empty_body_on_separate_line : Note<
"put the semicolon on a separate line to silence this warning">;
+def warn_redundant_defer: Warning<
+ "redundant use of defer; the deferred statement is executed immediately">,
+ InGroup<RedundantDefer>, DefaultIgnore;
----------------
Sirraide wrote:
The diagnostic should either be on by default or part of something like `-Wall`; adding off by default warnings is something we try to avoid nowadays because usually no-one turns them on.
https://github.com/llvm/llvm-project/pull/225748
More information about the cfe-commits
mailing list