From f453b313f62ba42d748f00628be7b3750c797c86 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 29 Jun 2023 09:59:30 +0200 Subject: add initializers (only static for initialier list rn) and other fixes --- c.h | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'c.h') diff --git a/c.h b/c.h index 6cdde09..33eef54 100644 --- a/c.h +++ b/c.h @@ -38,11 +38,43 @@ struct expr { uvlong u; vlong i; double f; /* ENUMLIT */ struct bytes s; /* ESTRLIT */ struct decl *sym; /* ESYM */ - struct initializer *ini; /* EINIT */ + struct init *init; /* EINIT */ + }; +}; + +struct init { + uint n; + struct bitset *zero; + uint *offs; + struct { uchar off, siz; } *bitf; + struct expr **ex; +}; + +enum storageclass { + SCNONE, + SCTYPEDEF = 1<<0, + SCEXTERN = 1<<1, + SCSTATIC = 1<<2, + SCTHREADLOCAL = 1<<3, + SCAUTO = 1<<4, + SCREGISTER = 1<<5, +}; + +struct decl { + union type ty; + uchar scls; + uchar qual : 2; + uchar isenum : 1; + struct span span; + const char *name; + union { + struct { ushort align; int id; }; + vlong value; }; }; enum evalmode { + EVNONE, EVINTCONST, EVARITH, EVSTATICINI, -- cgit v1.2.3