diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2007-09-08 17:49:20 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2007-09-08 17:49:20 +0000 |
commit | 04b01bd35eb823788ab7bd003fb857a71979144b (patch) | |
tree | 48464f1c3a2ae7f40b1ea83863982826ffd98cac | |
parent | 601000c93ec6106039fcd277533def7883b1a4ee (diff) |
Fix false negatives in dealing with unreachable code after calls to __dead
functions. Prodded by fgs@, but a different diff than his.
"Makes sense" fgs@
-rw-r--r-- | usr.bin/xlint/lint1/cgram.y | 5 | ||||
-rw-r--r-- | usr.bin/xlint/lint1/tree.c | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y index 4f90fabe01d..19d5ae34346 100644 --- a/usr.bin/xlint/lint1/cgram.y +++ b/usr.bin/xlint/lint1/cgram.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: cgram.y,v 1.21 2007/04/24 16:47:36 miod Exp $ */ +/* $OpenBSD: cgram.y,v 1.22 2007/09/08 17:49:18 cloder Exp $ */ /* $NetBSD: cgram.y,v 1.8 1995/10/02 17:31:35 jpo Exp $ */ /* @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: cgram.y,v 1.21 2007/04/24 16:47:36 miod Exp $"; +static char rcsid[] = "$OpenBSD: cgram.y,v 1.22 2007/09/08 17:49:18 cloder Exp $"; #endif #include <stdlib.h> @@ -259,6 +259,7 @@ ext_decl: new->s_rimpl = old->s_rimpl; new->s_osdef = old->s_osdef; new->s_inline = old->s_inline; + new->s_noreturn = old->s_noreturn; new->s_def = old->s_def; new->s_scl = old->s_scl; new->s_blklev = old->s_blklev; diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index 19b56dfe381..843394480e5 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.44 2006/10/26 22:36:54 cloder Exp $ */ +/* $OpenBSD: tree.c,v 1.45 2007/09/08 17:49:19 cloder Exp $ */ /* $NetBSD: tree.c,v 1.12 1995/10/02 17:37:57 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: tree.c,v 1.44 2006/10/26 22:36:54 cloder Exp $"; +static char rcsid[] = "$OpenBSD: tree.c,v 1.45 2007/09/08 17:49:19 cloder Exp $"; #endif #include <stdlib.h> @@ -3109,9 +3109,6 @@ funccall(tnode_t *func, tnode_t *args) fcop = ICALL; } - if (func->tn_sym->s_noreturn) - notreach(0); - /* * after cconv() func will always be a pointer to a function * if it is a valid function designator. @@ -3327,7 +3324,11 @@ expr(tnode_t *tn, int vctx, int tctx) warning(161); } } + } else if (tn->tn_op == CALL && tn->tn_left->tn_op == AMPER) { + if (tn->tn_left->tn_left->tn_sym->s_noreturn) + reached = rchflg = 0; } + if (!modtab[tn->tn_op].m_sideeff) { /* * for left operands of COMMA this warning is already |