aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index c7565a0..e044a43 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -572,7 +572,8 @@ finish_goto_stmt (tree destination)
}
/* COND is the condition-expression for an if, while, etc.,
- statement. Convert it to a boolean value, if appropriate. */
+ statement. Convert it to a boolean value, if appropriate.
+ In addition, verify sequence points if -Wsequence-point is enabled. */
static tree
maybe_convert_cond (tree cond)
@@ -585,6 +586,9 @@ maybe_convert_cond (tree cond)
if (processing_template_decl)
return cond;
+ if (warn_sequence_point)
+ verify_sequence_points (cond);
+
/* Do the conversion. */
cond = convert_from_reference (cond);
@@ -790,6 +794,9 @@ finish_return_stmt (tree expr)
return error_mark_node;
if (!processing_template_decl)
{
+ if (warn_sequence_point)
+ verify_sequence_points (expr);
+
if (DECL_DESTRUCTOR_P (current_function_decl)
|| (DECL_CONSTRUCTOR_P (current_function_decl)
&& targetm.cxx.cdtor_returns_this ()))
@@ -978,6 +985,9 @@ finish_switch_cond (tree cond, tree switch_stmt)
}
if (check_for_bare_parameter_packs (cond))
cond = error_mark_node;
+ else if (!processing_template_decl && warn_sequence_point)
+ verify_sequence_points (cond);
+
finish_cond (&SWITCH_STMT_COND (switch_stmt), cond);
SWITCH_STMT_TYPE (switch_stmt) = orig_type;
add_stmt (switch_stmt);