cc: remove nullwarn() from OCAST codegen, zap void casts
implicit casts would cause spurious "result of operation not used" warnings such as ape's stdio putc() macro. make (void) casts non-ops when the casted expression has no side effects. this avoid spurious warning with ape's assert() macro.
This commit is contained in:
parent
159f96c534
commit
63191949b9
|
@ -376,10 +376,7 @@ cgen(Node *n, int result, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(result == D_NONE) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, D_NONE, Z);
|
||||
cgen(l, D_NONE, Z);
|
||||
break;
|
||||
}
|
||||
lg = result;
|
||||
|
|
|
@ -376,10 +376,7 @@ cgen(Node *n, int result, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(result == D_NONE) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, D_NONE, Z);
|
||||
cgen(l, D_NONE, Z);
|
||||
break;
|
||||
}
|
||||
lg = result;
|
||||
|
|
|
@ -399,10 +399,7 @@ cgenrel(Node *n, Node *nn, int inrel)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
@ -927,7 +924,7 @@ cgen64(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z){
|
||||
nullwarn(l, Z);
|
||||
cgen(l, Z);
|
||||
goto Out;
|
||||
}
|
||||
if(typeilp[n->type->etype] && typev[l->type->etype]){
|
||||
|
|
|
@ -976,10 +976,7 @@ cgen(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -326,7 +326,7 @@ brk:
|
|||
break;
|
||||
|
||||
case OCAST:
|
||||
if(l->type->etype == TUVLONG && typefd[n->type->etype])
|
||||
if(l != Z && l->type->etype == TUVLONG && typefd[n->type->etype])
|
||||
n->complex += 2;
|
||||
break;
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ cgenrel(Node *n, Node *nn, int inrel)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
nullwarn(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -994,10 +994,7 @@ cgen(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -1073,6 +1073,11 @@ loop:
|
|||
break;
|
||||
|
||||
case OCAST:
|
||||
if(n->type == types[TVOID] && !side(l)){
|
||||
n->left = Z;
|
||||
n->type = T;
|
||||
break;
|
||||
}
|
||||
if(castucom(n))
|
||||
warn(n, "32-bit unsigned complement zero-extended to 64 bits");
|
||||
ccom(l);
|
||||
|
|
|
@ -358,10 +358,7 @@ cgen(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -395,10 +395,7 @@ cgen(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -359,10 +359,7 @@ cgen(Node *n, Node *nn)
|
|||
|
||||
case OCAST:
|
||||
if(nn == Z) {
|
||||
if(n->type != types[TVOID])
|
||||
nullwarn(l, Z);
|
||||
else
|
||||
cgen(l, Z);
|
||||
cgen(l, Z);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue