diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-14 23:56:06 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 00:06:57 +0300 |
| commit | f28f255f777fc99031eed96ce42d6fbfc2e2790d (patch) | |
| tree | 5f0543b4b1823cb4c40ec4ad1f38ab0f30656a23 /src/ast.c | |
| parent | e1f17535a043b55ce34de4d7583928d8c94bb71a (diff) | |
| download | ek-f28f255f777fc99031eed96ce42d6fbfc2e2790d.tar.gz ek-f28f255f777fc99031eed96ce42d6fbfc2e2790d.zip | |
add param and return struct handling
Diffstat (limited to 'src/ast.c')
| -rw-r--r-- | src/ast.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -677,7 +677,7 @@ size_t align3k(size_t o) static size_t struct_size(struct type *t) { if (t->size != -1) - return t->size; + return (size_t)t->size; size_t size = 0; foreach_node(n, struct_body(t->d)) { @@ -691,7 +691,7 @@ static size_t struct_size(struct type *t) size += sz; } - t->size = size; + t->size = (ssize_t)size; return size; } @@ -721,9 +721,11 @@ size_t type_offsetof(struct type *t, char *m) if (same_id(var_id(n), m)) break; - size_t sz = type_size(n->t); - if (sz > 2) + size_t size = type_size(n->t); + if (size > 2) offset = align3k(offset); + + offset += size; } return offset; |
