[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:23 PDT 2026


================
@@ -0,0 +1,151 @@
+// RUN: %clang_cc1 -std=c23 -fdefer-ts -fsyntax-only -verify %s -Wredundant-defer
+
+#define defer _Defer
+
----------------
Sirraide wrote:

Two things I can think of that this currently doesn’t catch is when a `break/continue` is a child of a (possibly nested) `AttributedStmt` and `LabelStmt`, e.g.

```c
_Defer {}
foo: break;

_Defer {}
[[clang::likely]] break;
```

Though admittedly, I’m not sure how common either of those constructs would be

https://github.com/llvm/llvm-project/pull/225748


More information about the cfe-commits mailing list