From 664ef9a3e1016e80fc1fcbbef6e9f66a2ededfe6 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 30 Jun 2018 19:34:41 +0200 Subject: pkg/compiler: check for unused declarations Error on unused structs/unions/resources/flags. Finds tons of bugs. --- pkg/compiler/testdata/all.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pkg/compiler/testdata/all.txt') diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt index 69ad6d181..a5a097de3 100644 --- a/pkg/compiler/testdata/all.txt +++ b/pkg/compiler/testdata/all.txt @@ -7,6 +7,7 @@ foo$2(a ptr[out, array[int32]]) foo$3(a union_arg) foo$4() r0 foo$5(a int8['a':'z']) +foo$6(a ptr[in, strings]) resource r0[intptr] @@ -38,6 +39,8 @@ strings { string_flags1 = "foo", "barbaz" string_flags2 = "" int_flags = 0, 1 +_ = 1, 2 +_ = C1, C2 # Proc type. @@ -45,6 +48,8 @@ proc_struct1 { f1 proc[C0, 8, int8] } +foo$proc1(a ptr[in, proc_struct1]) + # Len/bytesize types. type len_templ1[DATA1, DATA2] { @@ -122,6 +127,8 @@ bitfield0 { f2 int8:2 } +foo$bitfield0(a ptr[in, bitfield0]) + # Type templates. type type0 int8 @@ -184,6 +191,8 @@ foo$templ3(a ptr[in, templ_struct1[1]], b ptr[in, templ_struct1[2]]) foo$templ4(a ptr[in, templ_struct1[3]]) foo$templ5(a ptr[in, templ_struct1[3]]) foo$templ6(a ptr[in, templ_struct4]) +foo$templ7(a ptr[in, templ_struct5], b ptr[in, templ_struct6], c ptr[in, templ_union], d ptr[in, type3]) +foo$templ8(a ptr[in, templ_templ_use]) # Structs. @@ -195,8 +204,12 @@ s1 { f1 int8 } [size[C2]] +foo$s0(a ptr[in, s0], b ptr[in, s1]) + # Unions. u0 [ f1 int32 ] + +foo$u0(a ptr[in, u0]) -- cgit mrf-deployment