diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-16 14:24:40 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-16 14:24:40 +0000 |
commit | 48d94ede9eee1a831fc6cab98e8333076fe5e712 (patch) | |
tree | 7a42ffff9a8ca843cf87a59b7858690a5f169948 /gcc/testsuite/g++.dg | |
parent | e8146f09dd5125421f06a96bdb1c57e45920f946 (diff) | |
download | gcc-48d94ede9eee1a831fc6cab98e8333076fe5e712.tar.gz |
./:
* c-common.c (skip_evaluation): Don't define.
(c_inhibit_evaluation_warnings): Define global variable.
(overflow_warning): Check c_inhibit_evaluation_warnings rather
than skip_evaluation.
(convert_and_check, warn_for_div_by_zero): Likewise.
* c-common.h (skip_evaluation): Don't declare.
(c_inhibit_evaluation_warnings): Declare.
* c-parser.c (c_parser_typeof_specifier): Set
c_inhibit_evaluation_warnings rather than skip_evaluation.
(c_parser_conditional_expression): Likewise.
(c_parser_binary_expression): Likewise.
(c_parser_sizeof_expression): Likewise.
(c_parser_alignof_expression): Likewise.
* c-typeck.c (build_indirect_ref): Check
c_inhibit_evaluation_warnings rather than skip_evaluation.
(build_conditional_expr, build_binary_op): Likewise.
cp/:
* parser.c (cp_unevaluated_operand): Define global variable.
(cp_parser_question_colon_clause): Increment
c_inhibit_evaluation_warnings when evaluating an expression which
will never be executed.
(cp_parser_decltype): Increment cp_unevaluated_operand and
c_inhibit_evaluation_warnings, not skip_evaluation.
(cp_parser_sizeof_operand): Likewise.
(cp_parser_enclosed_template_argument_list): Save
cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
skip_evaluation.
* cp-tree.h (struct saved_scope): Remove skip_evaluation field.
Add unevaluated_operand and inhibit_evaluation_warnings fields.
(cp_unevaluated_operand): Declare.
* name-lookup.c (push_to_top_level): Save cp_unevaluated_operand
and c_inhibit_evaluation_warnings rather than skip_evaluation.
(pop_from_top_level): Restore cp_unevaluated_operand and
c_inhibit_evaluation_warnings rather than skip_evaluation.
* class.c (build_base_path): Check cp_unevaluated_operand rather
than skip_evaluation.
* typeck.c (build_class_member_access_expr): Likewise.
(cp_build_binary_op): Don't warn about bad shift counts if
c_inhibit_evaluation_warnings is non-zero.
* pt.c (coerce_template_parms): Save state of
cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
skip_evaluation.
(tsubst_aggr_type): Likewise.
(tsubst_pack_expansion): Check cp_unevaluated_operand rather than
skip_evaluation.
(tsubst_copy): Likewise.
(tsubst): Set cp_unevaluated_operand and
c_inhibit_evaluation_warnings, not skip_evaluation.
(tsubst_copy_and_build): Likewise.
* call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand
rather than skip_evaluation.
* decl2.c (mark_used): Likewise.
* semantics.c (finish_non_static_data_member): Likewise.
* cvt.c (cp_convert_and_check): Check
c_inhibit_evaluation_warnings rather than skip_evaluation.
* mangle.c (write_type): Set cp_unevaluated_operand rather than
skip_evaluation.
testsuite/:
* g++.dg/warn/skip-1.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148535 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/skip-1.C | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/skip-1.C b/gcc/testsuite/g++.dg/warn/skip-1.C new file mode 100644 index 00000000000..027c405d462 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/skip-1.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-Wall" } + +// Check that we don't warn about code that will not be executed. +extern int f2(int); +void +f1(int i) +{ + f2(1 == 1 ? 0 : f2(i >> -10)); + f2(1 == 1 ? 0 : f2(i >> 128)); + f2(1 == 1 ? 0 : f2(i << -10)); + f2(1 == 1 ? 0 : f2(1 << 128)); + f2(1 != 1 ? f2(i >> -10) : 0); + f2(1 != 1 ? f2(i >> 128) : 0); + f2(1 != 1 ? f2(i << -10) : 0); + f2(1 != 1 ? f2(1 << 128) : 0); +} |