diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-01-12 10:45:32 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-01-13 12:52:09 +0100 |
| commit | 5585946e227fc9dab364e87365312fef911b0c12 (patch) | |
| tree | 34508a628101899eb5044765547c6de5560360b6 /pkg/compiler/testdata | |
| parent | 6b52293f4defa6b45b564d037fd641be5d6d0e0e (diff) | |
pkg/compiler: support void type
"void": type with static size 0
mostly useful inside of templates and varlen unions
can't be syscall argument
Diffstat (limited to 'pkg/compiler/testdata')
| -rw-r--r-- | pkg/compiler/testdata/all.txt | 53 | ||||
| -rw-r--r-- | pkg/compiler/testdata/errors.txt | 5 |
2 files changed, 56 insertions, 2 deletions
diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt index 4aeae45df..9c557be0f 100644 --- a/pkg/compiler/testdata/all.txt +++ b/pkg/compiler/testdata/all.txt @@ -11,6 +11,59 @@ proc_struct1 { f1 proc[C0, 8, int8] } +# Void type. + +void0 { + f void +} + +void1 { + f1 void + f2 int8 +} + +void2 { + f1 void + f2 int8 +} + +void3 [ + f1 void + f2 int8 +] + +void4 [ + f1 void + f2 int8 +] [varlen] + +void5 { + f1 void + f2 void +} + +struct_with_void0 { + f1 int8 + f2 array[array[void]] + f3 int64 +} + +struct_with_void1 { + f1 int8 + f2 array[void5] + f3 int64 +} + +foo$void0(a ptr[in, void0]) +foo$void1(a ptr[in, void1]) +foo$void2(a ptr[in, void2]) +foo$void3(a ptr[in, void3]) +foo$void4(a ptr[in, void4]) +foo$void5(a ptr[in, void5]) +foo$void6(a ptr[in, struct_with_void0]) +foo$void7(a ptr[in, struct_with_void1]) +foo$void8(a ptr[in, void]) + # Bitfields. bitfield0 { diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index 3c67ac66a..26c29c4e0 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -110,6 +110,7 @@ foo$53(a proc[20, 10, opt]) # This must not error yet (consts are not patched). foo$54(a ptr[in, string["foo", C1]]) foo$55(a int8[opt[int8]]) ### opt can't have arguments +foo$56(a void) ### void can't be syscall argument opt { ### struct uses reserved name opt f1 int32 @@ -187,8 +188,8 @@ typestruct { } type type0 int8 -type type0 int8 ### type type0 redeclared, previously declared as type alias at errors.txt:189:6 -resource type0[int32] ### type type0 redeclared, previously declared as type alias at errors.txt:189:6 +type type0 int8 ### type type0 redeclared, previously declared as type alias at errors.txt:190:6 +resource type0[int32] ### type type0 redeclared, previously declared as type alias at errors.txt:190:6 type0 = 0, 1 type type1 type1 ### type instantiation loop: type1 -> type1 type type2 int8:4 ### unexpected ':', only struct fields can be bitfields |
