From 857a060fe3a415c1909ad8a342d9ca21019ab2fc Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 13 Nov 2020 13:49:27 +0100 Subject: pkg/compiler: check for flags with all equal values There is no point in having flags when values are equal. This can only mean a typo or other bug. Check for such cases and fix 3 existing precedents. --- pkg/compiler/testdata/errors2.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg/compiler/testdata') diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt index c862358cf..111db587f 100644 --- a/pkg/compiler/testdata/errors2.txt +++ b/pkg/compiler/testdata/errors2.txt @@ -370,6 +370,12 @@ foo$534(a ptr[in, flags[large_flags, int8]]) ### large_flags U16_MAX=0xffff does large_flags = U8_MAX, U16_MAX +equal_flags_0 = 0, 0, 0, 0 ### all equal_flags_0 values are equal 0 +equal_flags_1 = 42, 42, 42, 42 ### all equal_flags_1 values are equal 42 +non_equal_flags = 0, 0, 0, 1 + +equal_flags_call(a flags[equal_flags_0], b flags[equal_flags_1], c flags[non_equal_flags]) + type type500 proc[C1, 8, int8] ### values starting from 1 with step 8 overflow base type for 32 procs type type501 int8 ### unused type type501 type type502[C] const[C, int8] ### unused type type502 -- cgit mrf-deployment