Skip to content

Commit

Permalink
Fixed to correctly diagnose expressions with NPC
Browse files Browse the repository at this point in the history
  • Loading branch information
mycoboco committed Dec 10, 2014
1 parent 3b3f01b commit 2c17b51
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ extern Tree cnsttree(Type, ...);
extern Tree consttree(int, Type);
extern Tree eqtree(int, Tree, Tree);
extern int iscallb(Tree);
extern int isnullptr(Tree);
extern Tree shtree(int, Tree, Tree);
extern void typeerror(int, Tree, Tree);

Expand Down
3 changes: 1 addition & 2 deletions src/enode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ static Tree addtree(int, Tree, Tree);
static Tree andtree(int, Tree, Tree);
static Tree cmptree(int, Tree, Tree);
static int compatible(Type, Type);
static int isnullptr(Tree e);
static Tree multree(int, Tree, Tree);
static Tree subtree(int, Tree, Tree);
#define isvoidptr(ty) \
Expand Down Expand Up @@ -226,7 +225,7 @@ static int compatible(Type ty1, Type ty2) {
&& isptr(ty2) && !isfunc(ty2->type)
&& eqtype(unqual(ty1->type), unqual(ty2->type), 0);
}
static int isnullptr(Tree e) {
int isnullptr(Tree e) {
Type ty = unqual(e->type);

return generic(e->op) == CNST
Expand Down
2 changes: 1 addition & 1 deletion src/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ Tree cast(Tree p, Type type) {
p = simplify(CVP, dst, p, NULL);
else {
if (isfunc(src->type) && !isfunc(dst->type)
|| !isfunc(src->type) && isfunc(dst->type))
|| !isnullptr(p) && !isfunc(src->type) && isfunc(dst->type))
warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type);

if (src->size != dst->size)
Expand Down

0 comments on commit 2c17b51

Please sign in to comment.