diff options
-rw-r--r-- | cc.h | 1 | ||||
-rw-r--r-- | targ.c | 12 |
2 files changed, 7 insertions, 6 deletions
@@ -434,6 +434,7 @@ extern struct type typevalist, typevalistptr; struct target { const char *name; struct type *typewchar; + int signedchar; }; extern struct target *targ; @@ -9,6 +9,7 @@ static struct target alltargs[] = { { .name = "x86_64", .typewchar = &typeint, + .signedchar = 1, }, { .name = "aarch64", @@ -28,13 +29,12 @@ targinit(const char *name) if (!name) { /* TODO: provide a way to set this default */ targ = &alltargs[0]; - return; } - for (i = 0; i < LEN(alltargs); ++i) { - if (strcmp(alltargs[i].name, name) == 0) { + for (i = 0; i < LEN(alltargs) && !targ; ++i) { + if (strcmp(alltargs[i].name, name) == 0) targ = &alltargs[i]; - return; - } } - fatal("unknown target '%s'", name); + if (!targ) + fatal("unknown target '%s'", name); + typechar.basic.issigned = targ->signedchar; } |