aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-04-22 12:57:15 -0700
committerMichael Forney <mforney@mforney.org>2021-04-23 12:50:25 -0700
commit87eaf587b4f95b3c302ced798a32d44a70db3d02 (patch)
treee35a8c30fd179efe82dda1d297d19bb466e1e487
parent110c61997bfb80d742cd406766b14ea7bdb8a593 (diff)
targ: Use correct char signedness for aarch64 and riscv64
-rw-r--r--cc.h1
-rw-r--r--targ.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/cc.h b/cc.h
index 3df0880..8143528 100644
--- a/cc.h
+++ b/cc.h
@@ -434,6 +434,7 @@ extern struct type typevalist, typevalistptr;
struct target {
const char *name;
struct type *typewchar;
+ int signedchar;
};
extern struct target *targ;
diff --git a/targ.c b/targ.c
index d079218..6ffef9e 100644
--- a/targ.c
+++ b/targ.c
@@ -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;
}