diff options
-rw-r--r-- | cgen.c | 19 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | types.c | 68 | ||||
-rw-r--r-- | types.h | 22 |
4 files changed, 1 insertions, 112 deletions
@@ -1728,25 +1728,6 @@ static void cgen_expr(CGenerator *g, Expression *e) { case BUILTIN_COMPILING: cgen_write(g, "false"); break; - case BUILTIN_SIZEOF_SHORT: - case BUILTIN_SIZEOF_INT: - case BUILTIN_SIZEOF_LONG: - case BUILTIN_SIZEOF_LONG_LONG: - case BUILTIN_SIZEOF_FLOAT: - case BUILTIN_SIZEOF_DOUBLE: - case BUILTIN_SIZEOF_LONG_DOUBLE: - case BUILTIN_TSIZEOF_SHORT: - case BUILTIN_TSIZEOF_INT: - case BUILTIN_TSIZEOF_LONG: - case BUILTIN_TSIZEOF_LONG_LONG: - case BUILTIN_TSIZEOF_FLOAT: - case BUILTIN_TSIZEOF_DOUBLE: - case BUILTIN_TSIZEOF_LONG_DOUBLE: - case BUILTIN_SIZEOF_SIZE_T: - case BUILTIN_TSIZEOF_SIZE_T: { - Value val = get_builtin_val(e->builtin.which.val); - cgen_write(g, I64_FMT, val.i64); - } break; } break; case EXPR_CAST: { @@ -8,10 +8,6 @@ /* @TODO: -#foreign non-functions (e.g. stderr) -remove some now-unnecessary #builtins (all are unnecessary except for "compiling", - which probably isn't even that useful but maybe more builtins will exist in - the future) &&, || #no_warn start making a standard library... (printf; stringbuilder would be nice to have) @@ -1468,55 +1468,6 @@ static Value get_builtin_val(BuiltinVal val) { case BUILTIN_COMPILING: v.boolv = true; break; - case BUILTIN_SIZEOF_SHORT: - v.i64 = (I64)sizeof(short); - break; - case BUILTIN_SIZEOF_INT: - v.i64 = (I64)sizeof(int); - break; - case BUILTIN_SIZEOF_LONG: - v.i64 = (I64)sizeof(long); - break; - case BUILTIN_SIZEOF_LONG_LONG: - v.i64 = (I64)sizeof(long long); - break; - case BUILTIN_SIZEOF_FLOAT: - v.i64 = (I64)sizeof(float); - break; - case BUILTIN_SIZEOF_DOUBLE: - v.i64 = (I64)sizeof(double); - break; - case BUILTIN_SIZEOF_LONG_DOUBLE: - v.i64 = (I64)sizeof(long double); - break; - case BUILTIN_SIZEOF_SIZE_T: - v.i64 = (I64)sizeof(size_t); - break; - /* @TODO(eventually): fix these for cross compilation */ - case BUILTIN_TSIZEOF_SHORT: - v.i64 = (I64)sizeof(short); - break; - case BUILTIN_TSIZEOF_INT: - v.i64 = (I64)sizeof(int); - break; - case BUILTIN_TSIZEOF_LONG: - v.i64 = (I64)sizeof(long); - break; - case BUILTIN_TSIZEOF_LONG_LONG: - v.i64 = (I64)sizeof(long long); - break; - case BUILTIN_TSIZEOF_FLOAT: - v.i64 = (I64)sizeof(float); - break; - case BUILTIN_TSIZEOF_DOUBLE: - v.i64 = (I64)sizeof(double); - break; - case BUILTIN_TSIZEOF_LONG_DOUBLE: - v.i64 = (I64)sizeof(long double); - break; - case BUILTIN_TSIZEOF_SIZE_T: - v.i64 =(I64)sizeof(size_t); - break; } return v; } @@ -1538,25 +1489,6 @@ static void get_builtin_val_type(Allocator *a, BuiltinVal val, Type *t) { t->kind = TYPE_BUILTIN; t->builtin = BUILTIN_BOOL; break; - case BUILTIN_SIZEOF_SHORT: - case BUILTIN_SIZEOF_INT: - case BUILTIN_SIZEOF_LONG: - case BUILTIN_SIZEOF_LONG_LONG: - case BUILTIN_SIZEOF_FLOAT: - case BUILTIN_SIZEOF_DOUBLE: - case BUILTIN_SIZEOF_LONG_DOUBLE: - case BUILTIN_TSIZEOF_SHORT: - case BUILTIN_TSIZEOF_INT: - case BUILTIN_TSIZEOF_LONG: - case BUILTIN_TSIZEOF_LONG_LONG: - case BUILTIN_TSIZEOF_FLOAT: - case BUILTIN_TSIZEOF_DOUBLE: - case BUILTIN_TSIZEOF_LONG_DOUBLE: - case BUILTIN_SIZEOF_SIZE_T: - case BUILTIN_TSIZEOF_SIZE_T: - t->kind = TYPE_BUILTIN; - t->builtin = BUILTIN_I64; - break; } } @@ -738,32 +738,12 @@ typedef enum { BUILTIN_STDOUT, BUILTIN_STDERR, BUILTIN_STDIN, - BUILTIN_SIZEOF_SHORT, - BUILTIN_TSIZEOF_SHORT, /* target sizeof(short) */ - BUILTIN_SIZEOF_INT, - BUILTIN_TSIZEOF_INT, - BUILTIN_SIZEOF_LONG, - BUILTIN_TSIZEOF_LONG, - BUILTIN_SIZEOF_LONG_LONG, - BUILTIN_TSIZEOF_LONG_LONG, - BUILTIN_SIZEOF_SIZE_T, - BUILTIN_TSIZEOF_SIZE_T, - BUILTIN_SIZEOF_FLOAT, - BUILTIN_TSIZEOF_FLOAT, - BUILTIN_SIZEOF_DOUBLE, - BUILTIN_TSIZEOF_DOUBLE, - BUILTIN_SIZEOF_LONG_DOUBLE, - BUILTIN_TSIZEOF_LONG_DOUBLE, BUILTIN_COMPILING #define BUILTIN_VAL_COUNT (BUILTIN_COMPILING+1) } BuiltinVal; const char *const builtin_val_names[BUILTIN_VAL_COUNT] = - {"stdout", "stderr", "stdin", "sizeof short", "target sizeof short", - "sizeof int", "target sizeof int", "sizeof long", "target sizeof long", - "sizeof long long", "target sizeof long long", "sizeof size_t", "target sizeof size_t", - "sizeof float", "target sizeof float", "sizeof double", "target sizeof double", - "sizeof long double", "target sizeof long double", "compiling"}; + {"stdout", "stderr", "stdin", "compiling"}; typedef struct Namespace { Block body; |