aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/builtins.c5
-rw-r--r--gcc/c-decl.c5
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c6
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/typeck.c3
-rw-r--r--gcc/gimplify.c22
-rw-r--r--gcc/tree.h1
10 files changed, 31 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3c42680..9fcc7cd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-31 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
2010-10-31 Richard Henderson <rth@redhat.com>
* config/i386/cygming.h (TARGET_SEH): New.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 611b777..ced2fa7 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -506,10 +506,7 @@ c_strlen (tree src, int only_value)
&& (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0))))
return c_strlen (TREE_OPERAND (src, 1), only_value);
- if (EXPR_HAS_LOCATION (src))
- loc = EXPR_LOCATION (src);
- else
- loc = input_location;
+ loc = EXPR_LOC_OR_HERE (src);
src = string_constant (src, &offset_node);
if (src == 0)
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index a06d073..bb7cf64 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -7499,9 +7499,8 @@ build_enumerator (location_t decl_loc, location_t loc,
/* Set basis for default for next value. */
the_enum->enum_next_value
- = build_binary_op
- (EXPR_HAS_LOCATION (value) ? EXPR_LOCATION (value) : input_location,
- PLUS_EXPR, value, integer_one_node, 0);
+ = build_binary_op (EXPR_LOC_OR_HERE (value),
+ PLUS_EXPR, value, integer_one_node, 0);
the_enum->enum_overflow = tree_int_cst_lt (the_enum->enum_next_value, value);
/* Now create a declaration for the enum value name. */
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 83a27c2..cb5b5dc 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-31 Jason Merrill <jason@redhat.com>
+
+ * c-common.c (conversion_warning, warn_for_collisions_1): Use
+ EXPR_LOC_OR_HERE.
+
2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented Objective-C 2.0 @property, @synthesize and @dynamic.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 1b76d74..923c63a 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1863,8 +1863,7 @@ conversion_warning (tree type, tree expr)
int i;
const int expr_num_operands = TREE_OPERAND_LENGTH (expr);
tree expr_type = TREE_TYPE (expr);
- location_t loc = EXPR_HAS_LOCATION (expr)
- ? EXPR_LOCATION (expr) : input_location;
+ location_t loc = EXPR_LOC_OR_HERE (expr);
if (!warn_conversion && !warn_sign_conversion)
return;
@@ -2297,8 +2296,7 @@ warn_for_collisions_1 (tree written, tree writer, struct tlist *list,
&& (!only_writes || list->writer))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
- warning_at (EXPR_HAS_LOCATION (writer)
- ? EXPR_LOCATION (writer) : input_location,
+ warning_at (EXPR_LOC_OR_HERE (writer),
OPT_Wsequence_point, "operation on %qE may be undefined",
list->expr);
}
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");
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 87b57f0..885f013 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -587,10 +587,7 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p,
mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));
- if (EXPR_HAS_LOCATION (val))
- SET_EXPR_LOCATION (mod, EXPR_LOCATION (val));
- else
- SET_EXPR_LOCATION (mod, input_location);
+ SET_EXPR_LOCATION (mod, EXPR_LOC_OR_HERE (val));
/* gimplify_modify_expr might want to reduce this further. */
gimplify_and_add (mod, pre_p);
@@ -2620,8 +2617,7 @@ shortcut_cond_expr (tree expr)
while (TREE_CODE (pred) == TRUTH_ANDIF_EXPR)
{
/* Keep the original source location on the first 'if'. */
- location_t locus = EXPR_HAS_LOCATION (expr)
- ? EXPR_LOCATION (expr) : input_location;
+ location_t locus = EXPR_LOC_OR_HERE (expr);
TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
/* Set the source location of the && on the second 'if'. */
if (EXPR_HAS_LOCATION (pred))
@@ -2643,8 +2639,7 @@ shortcut_cond_expr (tree expr)
while (TREE_CODE (pred) == TRUTH_ORIF_EXPR)
{
/* Keep the original source location on the first 'if'. */
- location_t locus = EXPR_HAS_LOCATION (expr)
- ? EXPR_LOCATION (expr) : input_location;
+ location_t locus = EXPR_LOC_OR_HERE (expr);
TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
/* Set the source location of the || on the second 'if'. */
if (EXPR_HAS_LOCATION (pred))
@@ -2708,8 +2703,7 @@ shortcut_cond_expr (tree expr)
/* If there was nothing else in our arms, just forward the label(s). */
if (!then_se && !else_se)
return shortcut_cond_r (pred, true_label_p, false_label_p,
- EXPR_HAS_LOCATION (expr)
- ? EXPR_LOCATION (expr) : input_location);
+ EXPR_LOC_OR_HERE (expr));
/* If our last subexpression already has a terminal label, reuse it. */
if (else_se)
@@ -2741,8 +2735,7 @@ shortcut_cond_expr (tree expr)
jump_over_else = block_may_fallthru (then_);
pred = shortcut_cond_r (pred, true_label_p, false_label_p,
- EXPR_HAS_LOCATION (expr)
- ? EXPR_LOCATION (expr) : input_location);
+ EXPR_LOC_OR_HERE (expr));
expr = NULL;
append_to_statement_list (pred, &expr);
@@ -7638,10 +7631,7 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p)
*expr_p = create_tmp_var (type, NULL);
tmp = build1 (NOP_EXPR, type, expr);
stmt = gimplify_assign (*expr_p, tmp, stmt_p);
- if (EXPR_HAS_LOCATION (expr))
- gimple_set_location (stmt, EXPR_LOCATION (expr));
- else
- gimple_set_location (stmt, input_location);
+ gimple_set_location (stmt, EXPR_LOC_OR_HERE (expr));
}
}
diff --git a/gcc/tree.h b/gcc/tree.h
index f0b1e74..2de56c7 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1598,6 +1598,7 @@ struct GTY(()) tree_constructor {
(EXPR_P ((NODE)) ? (NODE)->exp.locus : UNKNOWN_LOCATION)
#define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))->exp.locus = (LOCUS)
#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
+#define EXPR_LOC_OR_HERE(NODE) (EXPR_HAS_LOCATION (NODE) ? (NODE)->exp.locus : input_location)
#define EXPR_FILENAME(NODE) LOCATION_FILE (EXPR_CHECK ((NODE))->exp.locus)
#define EXPR_LINENO(NODE) LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)