[clang] [C] Add -Wjump-bypasses-init (PR #138009)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 05:10:44 PDT 2025


================
@@ -6561,18 +6561,28 @@ def ext_goto_into_protected_scope : ExtWarn<
 def warn_cxx98_compat_goto_into_protected_scope : Warning<
   "jump from this goto statement to its label is incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
+def warn_cpp_compat_goto_into_protected_scope : Warning<
----------------
AaronBallman wrote:

This one is covered by:
```
void goto_func_1(void) {
  goto ouch;  // c-warning {{jump from this goto statement to its label is incompatible with C++}} \
                 cxx-error {{cannot jump from this goto statement to its label}}
  int i = 12; // both-note {{jump bypasses variable initialization}}

ouch:
  ;
}
```
But the computed goto one is not covered yet.

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


More information about the cfe-commits mailing list