aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-06-16 14:24:40 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-06-16 14:24:40 +0000
commit7d882b8356b9ee3e6844bf4898a996289223fab2 (patch)
tree7a42ffff9a8ca843cf87a59b7858690a5f169948 /gcc/c-common.h
parent2e4078422e64a42224ca69daa70604885698a942 (diff)
downloadgcc-7d882b8356b9ee3e6844bf4898a996289223fab2.zip
gcc-7d882b8356b9ee3e6844bf4898a996289223fab2.tar.gz
gcc-7d882b8356b9ee3e6844bf4898a996289223fab2.tar.bz2
c-common.c (skip_evaluation): Don't define.
./: * 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. From-SVN: r148535
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index eecb189..04a1945 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -719,10 +719,13 @@ extern int warn_strict_null_sentinel;
extern int max_tinst_depth;
-/* Nonzero means the expression being parsed will never be evaluated.
- This is a count, since unevaluated expressions can nest. */
+/* Nonzero means that we should not issue warnings about problems that
+ occur when the code is executed, because the code being processed
+ is not expected to be executed. This is set during parsing. This
+ is used for cases like sizeof() and "0 ? a : b". This is a count,
+ not a bool, because unexecuted expressions can nest. */
-extern int skip_evaluation;
+extern int c_inhibit_evaluation_warnings;
/* Whether lexing has been completed, so subsequent preprocessor
errors should use the compiler's input_location. */