From 0781895e0f8359843b9215ac6ad16925a46b2703 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 14 Apr 2020 07:00:48 +0200 Subject: pkg/compiler: refactor attribute handling Introduce common infrastructure for describing and parsing attribute instead of custom per-attribute code scattered across several locations. Change align attribute syntax from the weird align_N to align[N]. This also allows to use literal constants as N. Introduce notion of builtin constants. Currently we have only PTR_SIZE, which is needed to replace align_ptr with align[PTR_SIZE]. --- pkg/compiler/testdata/errors.txt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'pkg/compiler/testdata/errors.txt') diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index d5611a531..3b77ed4b9 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -152,20 +152,12 @@ s3 { f7 int32:33 ### bitfield of size 33 is too large for base type of size 32 f8 const[0, int32:C1] ### literal const bitfield sizes are not supported f9 const[0] ### wrong number of arguments for type const, expect value, base type -} [packed, align_4] - -s4 { - f1 int8 -} [align_7] ### bad struct s4 alignment 7 (must be a sane power of 2) +} [packed, align[4]] s5 { f1 int8 } [varlen] ### unknown struct s5 attribute varlen -s6 { - f1 int8 -} [align_foo] ### bad struct s6 alignment foo - s7 { f1 ptr64[in, int32] } @@ -298,7 +290,7 @@ type templ_struct0[A, B] { len len[parent, int16] typ const[A, int16] data B -} [align_4] +} [align[4]] type templ_struct1[STR] { f string[STR, 40] -- cgit mrf-deployment