diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-09 12:37:32 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-09 12:37:32 +0000 |
commit | ca085fd7b7ba0cd12a6411cc0ff6a3380d82df0a (patch) | |
tree | c4488aadaa6e95ea5ce61510a777e178059a7519 /gcc/c-common.c | |
parent | 98e48a7f11b14985b94ed8b86af0f97af1e7bda7 (diff) | |
download | gcc-ca085fd7b7ba0cd12a6411cc0ff6a3380d82df0a.zip gcc-ca085fd7b7ba0cd12a6411cc0ff6a3380d82df0a.tar.gz gcc-ca085fd7b7ba0cd12a6411cc0ff6a3380d82df0a.tar.bz2 |
re PR c++/17880 (-Wsequence-point doesn't warn inside if, while, do conditions, for beg/cond/end expressions etc.)
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/17880
* c-typeck.c (digest_init): Call verify_sequence_points from here.
(c_finish_return): Likewise.
(c_start_case): Likewise.
* c-common.c (warn_for_collisions_1): Use explicit location in
warning.
* c-parser.c (c_parser_condition): New. Call
verify_sequence_points.
(c_parser_paren_condition): Call c_parser_condition.
(c_parser_for_statement): Call c_parser_condition.
testsuite/
* gcc.dg/sequence-pt-pr17880.c: New.
From-SVN: r138904
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index d2177bf..bf75fe7 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1902,8 +1902,10 @@ warn_for_collisions_1 (tree written, tree writer, struct tlist *list, && DECL_NAME (list->expr)) { warned_ids = new_tlist (warned_ids, written, NULL_TREE); - warning (OPT_Wsequence_point, "operation on %qE may be undefined", - list->expr); + warning_at (EXPR_HAS_LOCATION (writer) + ? EXPR_LOCATION (writer) : input_location, + OPT_Wsequence_point, "operation on %qE may be undefined", + list->expr); } list = list->next; } |