diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-08-04 12:29:59 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-08-04 16:53:16 +0200 |
| commit | 5ed76afa814812edaeaff2ea7b3227c18d5de5a6 (patch) | |
| tree | 9074ce6cb6d39bd008c841c574b8621581904972 /pkg/compiler/testdata | |
| parent | 80a0690249dc4dbbbed95ba197192b99c73694c5 (diff) | |
pkg/compiler: check for unused resources
If a resource is never used as an input, it is not useful.
It's effectively the same as using an integer.
Detect such cases, they are quite confusing.
Fix all existing errors in descriptions.
This uncovered some interesting bugs as well,
e.g. use of a completely unrelated fd subtype after copy-paste
(while the resource that was supposed to be used there is completely unused).
Diffstat (limited to 'pkg/compiler/testdata')
| -rw-r--r-- | pkg/compiler/testdata/errors2.txt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt index fb69c8c5f..68b8a66df 100644 --- a/pkg/compiler/testdata/errors2.txt +++ b/pkg/compiler/testdata/errors2.txt @@ -11,6 +11,7 @@ resource r2[r1] ### recursive resource r2->r1->r2 resource r3[int32] ### unused resource r3 foo$0(a0 ptr[out, r0], a1 ptr[out, r1], a2 ptr[out, r2]) +foo$1(a0 r0, a1 r1, a2 r2) # Recursive structs/unions. @@ -175,9 +176,11 @@ resource r104[int8] resource r105[int8] resource r106[int8] ### resource r106 can't be created (never mentioned as a syscall return value or output argument/field) resource r107[int8] ### resource r107 can't be created (never mentioned as a syscall return value or output argument/field) +resource r108[int8] ### resource r108 is never used as an input(such resources are not useful) -foo$300(a r100) +foo$300(a0 r100, a1 r101, a2 r102, a3 r103, a4 r104) foo$301(a ptr[out, array[r103]], b ptr[in, s300], c r107) r104 +foo$302() r108 s300 { f1 ptr[inout, s301] |
