================
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -triple bpf -debug-info-kind=limited -fsyntax-only
-verify=expected,reloc -Wswitch %s
+// RUN: %clang_cc1 -triple bpf -fsyntax-only -verify=expected,reloc -Wswitch %s
+// RUN: %clang_cc1 -triple bpf -debug-info-kind=limited -fsyntax-only -verify
-Wswitch \
+// RUN: -fbpf-no-enum-reloc=E %s
+
+// A relocated enumerator in a case label is not diagnosed by
+// -Wbpf-enum-not-relocated. The case labels are checked with the local values,
+// as with -fbpf-no-enum-reloc=.
+
+enum E { A = 1, B = 4, C = 8, D = 300 } __attribute__((preserve_access_index));
+
+int f(int i, char c, enum E e) {
+ switch (i) {
+ case A: // expected-note {{previous case defined here}}
+ return 1;
+ case 1: // expected-error {{duplicate case value: 'A' and '1' both equal
'1'}}
----------------
yonghong-song wrote:
Ok, fix the issue. The relocated case values are no longer checked for
duplicates or overlaps. The warning is gone too.
https://github.com/llvm/llvm-project/pull/243338
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits