[clang] [Clang][Wswitch-default] Warning for enum even completely covered the cases (PR #75900)
https://github.com/dongjianqiang2 closed https://github.com/llvm/llvm-project/pull/75900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Wswitch-default] Warning for enum even completely covered the cases (PR #75900)
https://github.com/dongjianqiang2 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/75900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Wswitch-default] Warning for enum even completely covered the cases (PR #75900)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (hstk30-hw) Changes --- 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; +} + `` https://github.com/llvm/llvm-project/pull/75900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Wswitch-default] Warning for enum even completely covered the cases (PR #75900)
https://github.com/hstk30-hw created https://github.com/llvm/llvm-project/pull/75900 None >From 735595ba881de8ab58a7d8f74a31534d90cf5b3a Mon Sep 17 00:00:00 2001 From: hstk-hw Date: Tue, 19 Dec 2023 14:54:16 +0800 Subject: [PATCH] test: add test for Wswitch-default --- clang/test/Sema/switch-default.c | 11 +++ 1 file changed, 11 insertions(+) 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; +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits