diff options
author | Michael Forney <mforney@mforney.org> | 2021-04-22 12:57:15 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-04-23 12:50:25 -0700 |
commit | 87eaf587b4f95b3c302ced798a32d44a70db3d02 (patch) | |
tree | e35a8c30fd179efe82dda1d297d19bb466e1e487 | |
parent | 110c61997bfb80d742cd406766b14ea7bdb8a593 (diff) |
targ: Use correct char signedness for aarch64 and riscv64
-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; } |