diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-12-07 17:51:24 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-12-07 17:51:24 -0500 |
commit | e78a3b4249fb70a97ac87b55b612553d19da36a3 (patch) | |
tree | 4e8fddf52263aada74645b49b6ef798cde0ed992 /gcc/c-common.c | |
parent | 6bdd692cdfa8aba199433234a8850bfe2b9ce839 (diff) | |
download | gcc-e78a3b4249fb70a97ac87b55b612553d19da36a3.zip gcc-e78a3b4249fb70a97ac87b55b612553d19da36a3.tar.gz gcc-e78a3b4249fb70a97ac87b55b612553d19da36a3.tar.bz2 |
(skip_evaluation): Likewise.
(overflow_warning, unsigned_conversion_warning): Don't warn about
potential runtime errors when skipping evaluation.
From-SVN: r13233
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 8248c07..1e2f6c5 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -37,6 +37,10 @@ Boston, MA 02111-1307, USA. */ extern struct obstack permanent_obstack; +/* Nonzero means the expression being parsed will never be evaluated. + This is a count, since unevaluated expressions can nest. */ +int skip_evaluation; + enum attrs {A_PACKED, A_NOCOMMON, A_COMMON, A_NORETURN, A_CONST, A_T_UNION, A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED, A_UNUSED, A_FORMAT, A_FORMAT_ARG, A_WEAK, A_ALIAS}; @@ -1602,7 +1606,8 @@ overflow_warning (value) && TREE_OVERFLOW (value)) { TREE_OVERFLOW (value) = 0; - warning ("integer overflow in expression"); + if (skip_evaluation == 0) + warning ("integer overflow in expression"); } else if ((TREE_CODE (value) == REAL_CST || (TREE_CODE (value) == COMPLEX_CST @@ -1610,7 +1615,8 @@ overflow_warning (value) && TREE_OVERFLOW (value)) { TREE_OVERFLOW (value) = 0; - warning ("floating point overflow in expression"); + if (skip_evaluation == 0) + warning ("floating point overflow in expression"); } } @@ -1626,6 +1632,7 @@ unsigned_conversion_warning (result, operand) if (TREE_CODE (operand) == INTEGER_CST && TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE && TREE_UNSIGNED (TREE_TYPE (result)) + && skip_evaluation == 0 && !int_fits_type_p (operand, TREE_TYPE (result))) { if (!int_fits_type_p (operand, signed_type (TREE_TYPE (result)))) @@ -1661,10 +1668,11 @@ convert_and_check (type, expr) && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr)))) /* If EXPR fits in the unsigned version of TYPE, don't warn unless pedantic. */ - if (pedantic - || TREE_UNSIGNED (type) - || ! int_fits_type_p (expr, unsigned_type (type))) - warning ("overflow in implicit constant conversion"); + if ((pedantic + || TREE_UNSIGNED (type) + || ! int_fits_type_p (expr, unsigned_type (type))) + && skip_evaluation == 0) + warning ("overflow in implicit constant conversion"); } else unsigned_conversion_warning (t, expr); |