aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/triplet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prc1/triplet.c')
-rw-r--r--src/prc1/triplet.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/prc1/triplet.c b/src/prc1/triplet.c
index 37d6e10..6325555 100644
--- a/src/prc1/triplet.c
+++ b/src/prc1/triplet.c
@@ -5,6 +5,15 @@
#include <stddef.h>
#include <string.h>
+static const struct
+{
+ const char *s;
+ const struct triplet *t;
+} m[] =
+{
+ {"x86_64-linux-gnu", &x86_64_linux_gnu}
+};
+
const char *triplet(const struct prv *p)
{
const struct args *args = p->ast->args;
@@ -23,18 +32,18 @@ static const struct type *find(const char *s, const struct type (*v)[12])
const struct type *triplet_type(const char *tr, const char *s)
{
- static const struct
- {
- const char *s;
- const struct type (*v)[12];
- } m[] =
- {
- {"x86_64-linux-gnu", &x86_64_linux_gnu}
- };
+ for (size_t i = 0; i < sizeof m / sizeof *m; i++)
+ if (!strcmp(tr, m[i].s))
+ return find(s, &m[i].t->builtins);
+ return NULL;
+}
+
+const struct type *triplet_ptr(const char *tr)
+{
for (size_t i = 0; i < sizeof m / sizeof *m; i++)
if (!strcmp(tr, m[i].s))
- return find(s, m[i].v);
+ return &m[i].t->ptr;
return NULL;
}