aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/td.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prc1/td.c')
-rw-r--r--src/prc1/td.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/prc1/td.c b/src/prc1/td.c
index b38a9d3..b3c6692 100644
--- a/src/prc1/td.c
+++ b/src/prc1/td.c
@@ -114,7 +114,7 @@ static int cid(const struct lex *l, struct prv *p)
struct type *nt;
const struct loc *loc;
- if (t)
+ if (t && t->type != OP)
{
loc = &t->tk->loc;
errloc(id, "type \"%s\" already defined at %s:%d:%d", id->s, loc->f,
@@ -263,7 +263,7 @@ static int c(const struct lex *l, struct prv *p)
const struct tdconstant *tdc = p->tdc;
const struct loc *loc;
- if (t)
+ if (t && t->type != OP)
{
loc = &t->tk->loc;
errloc(id, "type \"%s\" already defined at %s:%d:%d", id->s, loc->f,
@@ -372,13 +372,7 @@ static int op(const struct lex *l, struct prv *p)
const struct type *t = type_find(fn, tr, id->s);
if (t)
- {
- const struct loc *loc = &t->tk->loc;
-
- errloc(id, "type \"%s\" already defined at %s:%d:%d", id->s, loc->f,
- loc->line, loc->col);
- return -1;
- }
+ goto end;
else if (!(nt = malloc(sizeof *nt)))
{
perror("realloc(3)");
@@ -393,6 +387,7 @@ static int op(const struct lex *l, struct prv *p)
insert(td, nt);
dbg("\tadd opaque type %s (%d:%d)\n", id->s, loc->line, loc->col);
+end:
reset(p);
return 0;
}
@@ -480,7 +475,7 @@ static int s(const struct lex *l, struct prv *p)
struct type *nt;
const struct type *t = type_find(fn, tr, id->s);
- if (t)
+ if (t && t->type != OP)
{
const struct loc *loc = &t->tk->loc;