[clang] [Clang][Wswitch-default] Warning for enum even completely covered the cases (PR #75900)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 18 23:04:57 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (hstk30-hw)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/75900.diff
1 Files Affected:
- (modified) clang/test/Sema/switch-default.c (+11)
``````````diff
diff --git a/clang/test/Sema/switch-default.c b/clang/test/Sema/switch-default.c
index 854b561b37c48e..342a97ee68b1e2 100644
--- a/clang/test/Sema/switch-default.c
+++ b/clang/test/Sema/switch-default.c
@@ -15,3 +15,14 @@ int f2(int a) {
}
return a;
}
+
+// Warn even completely covered Enum cases(GCC compatibility).
+enum E { A, B };
+enum E check_enum(enum E e) {
+ switch (e) { // expected-warning {{'switch' missing 'default' label}}
+ case A: break;
+ case B: break;
+ }
+ return e;
+}
+
``````````
</details>
https://github.com/llvm/llvm-project/pull/75900
More information about the cfe-commits
mailing list