From 77a2c20ea02e1eadb2a639e6c1b0d25669025ac8 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Tue, 25 Feb 2020 21:31:55 -0500 Subject: compatibility cleanup --- main.c | 2 -- toc.c | 2 +- types.c | 7 +++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 3a45225..cead9b5 100644 --- a/main.c +++ b/main.c @@ -18,8 +18,6 @@ /* TODO: -replace is_reference in type_resolve_ with system for checking if type is - circularly dependent in a bad way, with compiler_sizeof foo, _ := bar(); nice syntax for #including something into a namespace run stuff at compile time without assigning it to a constant diff --git a/toc.c b/toc.c index c574731..cb01b34 100644 --- a/toc.c +++ b/toc.c @@ -35,7 +35,7 @@ /* use toc_alignof only for non-structs. it may be incorrect for pre-C(++)11. */ -#if __STDC_VERSION__ >= 201112 || __cplusplus >= 201103L +#if (__STDC_VERSION__ >= 201112 || __cplusplus >= 201103L) && !defined __TINYC__ #include #define toc_alignof alignof diff --git a/types.c b/types.c index 5c154c2..eb4de49 100644 --- a/types.c +++ b/types.c @@ -107,7 +107,6 @@ static bool struct_find_offsets(StructDef *s) { } static size_t compiler_alignof(Type *t) { - Value v; assert(t->flags & TYPE_IS_RESOLVED); switch (t->kind) { case TYPE_BUILTIN: @@ -115,11 +114,11 @@ static size_t compiler_alignof(Type *t) { case TYPE_VOID: return 1; case TYPE_FN: - return toc_alignof v.fn; + return toc_alignof(FnExpr *); case TYPE_PTR: - return toc_alignof v.ptr; + return toc_alignof(void *); case TYPE_TUPLE: - return toc_alignof v.tuple; + return toc_alignof(Value *); case TYPE_ARR: return compiler_alignof(t->arr.of); case TYPE_SLICE: -- cgit v1.2.3