[all-commits] [llvm/llvm-project] 543f11: [C] Add -Wjump-bypasses-init (#138009)

Aaron Ballman via All-commits all-commits at lists.llvm.org
Fri May 2 06:06:52 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 543f112e148a81de290d099f10784dc3ff698aa4
      https://github.com/llvm/llvm-project/commit/543f112e148a81de290d099f10784dc3ff698aa4
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/JumpDiagnostics.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/Sema/warn-jump-bypasses-init.c

  Log Message:
  -----------
  [C] Add -Wjump-bypasses-init (#138009)

We already diagnose when a jump bypasses initialization in C++ because
such code is ill-formed there. However, we were not using this to
diagnose those same jumps in C.

-Wjump-bypasses-init is grouped under -Wc++-compat and diagnoses this
situation as a compatibility issue with C++. This diagnostic is off by
default.

The diagnostic could perhaps be enabled by default for C, but due to the
design of jump diagnostic handling, it not a trivial task. For now,
we'll add the diagnostic as off-by-default so we get incremental
improvement, but a follow-up could try to refactor jump diagnostics so
we can enable this by default in C and have it as a C++ compatibility
diagnostic as well.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list