[clang-tools-extra] [clang-tidy][NFC] Clarify switch-missing-default-case doc (#164699) (PR #164709)

Keith Thompson via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 13:56:12 PDT 2025


https://github.com/Keith-S-Thompson created https://github.com/llvm/llvm-project/pull/164709

Falling through a defaultless switch statement has well defined behavior.

Credit for noticing this problem goes to user "pozz" on comp.lang.c,
Message-ID: <10da67g$3q59f$1 at dont-email.me>

>From 283624cd251e86b00f2c02ecb040e29ee93cdfa0 Mon Sep 17 00:00:00 2001
From: Keith Thompson <Keith.S.Thompson at gmail.com>
Date: Wed, 22 Oct 2025 13:32:00 -0700
Subject: [PATCH] [clang-tidy][NFC] Clarify switch-missing-default-case doc
 (#164699)

Falling through a defaultless switch statement has well defined
behavior.

Credit for noticing this problem goes to user "pozz" on comp.lang.c,
Message-ID: <10da67g$3q59f$1 at dont-email.me>
---
 .../checks/bugprone/switch-missing-default-case.rst           | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.rst
index 648c2c208a4ec..3ce862ff8afcc 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.rst
@@ -9,8 +9,8 @@ on covering cases with non-enums where the compiler may not issue warnings.
 Switch statements without a default case can lead to unexpected
 behavior and incomplete handling of all possible cases. When a switch statement
 lacks a default case, if a value is encountered that does not match any of the
-specified cases, the program will continue execution without any defined
-behavior or handling.
+specified cases, the switch statement will do nothing and the program will
+continue execution without handling the value.
 
 This check helps identify switch statements that are missing a default case,
 allowing developers to ensure that all possible cases are handled properly.



More information about the cfe-commits mailing list