aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-10-31 22:04:39 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-10-31 22:04:39 -0400
commitec52b1115dda4b0e38aa5620b0c3914b69008a24 (patch)
treec668c63e9650ae10b834fb88da25c23030215504 /gcc/cp
parent202be748c9997016f1b08c98291db4b7b9b02a5f (diff)
downloadgcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.zip
gcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.tar.gz
gcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.tar.bz2
tree.h (EXPR_LOC_OR_HERE): New macro.
* tree.h (EXPR_LOC_OR_HERE): New macro. * builtins.c (c_strlen): Use it. * c-decl.c (build_enumerator): Likewise. * gimplify.c (internal_get_tmp_var): Likewise. (shortcut_cond_expr): Likewise. (gimplify_one_sizepos): Likewise. c-family/ * c-common.c (conversion_warning, warn_for_collisions_1): Use EXPR_LOC_OR_HERE. cp/ * decl.c (pop_switch): Use EXPR_LOC_OR_HERE. * typeck.c (convert_for_assignment): Likewise. From-SVN: r166123
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/typeck.c3
3 files changed, 5 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1a8837c..2b475d0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2010-10-31 Jason Merrill <jason@redhat.com>
+ * decl.c (pop_switch): Use EXPR_LOC_OR_HERE.
+ * typeck.c (convert_for_assignment): Likewise.
+
* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
message about constexpr without -std=c++0x.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index dfe37d9..b7ab080f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2897,10 +2897,7 @@ pop_switch (void)
location_t switch_location;
/* Emit warnings as needed. */
- if (EXPR_HAS_LOCATION (cs->switch_stmt))
- switch_location = EXPR_LOCATION (cs->switch_stmt);
- else
- switch_location = input_location;
+ switch_location = EXPR_LOC_OR_HERE (cs->switch_stmt);
if (!processing_template_decl)
c_do_switch_warnings (cs->cases, switch_location,
SWITCH_STMT_TYPE (cs->switch_stmt),
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 19cedd9..967fe4d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -7529,8 +7529,7 @@ convert_for_assignment (tree type, tree rhs,
&& TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
&& (complain & tf_warning))
{
- location_t loc = EXPR_HAS_LOCATION (rhs)
- ? EXPR_LOCATION (rhs) : input_location;
+ location_t loc = EXPR_LOC_OR_HERE (rhs);
warning_at (loc, OPT_Wparentheses,
"suggest parentheses around assignment used as truth value");