summaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-27 18:04:09 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-27 18:04:09 +0000
commit4abfc532e3ffc6353597404a1784013cfbeaef70 (patch)
tree52eceb4b49f0f2845bf998c477ea0bead40db6a6 /gcc/c-typeck.c
parent046cb05c5a1580ca187222781e6736aacf247173 (diff)
downloadgcc-4abfc532e3ffc6353597404a1784013cfbeaef70.tar.gz
In gcc/:
2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. Removed small change in build_conditional_expr that had been added when fixing PR objc/27377 and which did the same check in a less complete way. 2005-12-15 Fariborz Jahanian <fjahanian@apple.com> Radar 4229905 * c-typeck.c (build_conditional_expr): Call objc_have_common_type when looking for objective-c common pointer types. 2005-06-22 Ziemowit Laski <zlaski@apple.com> Radar 4154928 * c-typeck.c (build_conditional_expr): For two ObjC pointer types, use their ObjC common type. In gcc/c-family: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2005-12-15 Fariborz Jahanian <fjahanian@apple.com> Radar 4229905 * c-common.h (objc_have_common_type): New declaration. * stub-objc.c (objc_have_common_type): New stub. 2005-06-22 Ziemowit Laski <zlaski@apple.com> Radar 4154928 * c-common.h (objc_common_type): New prototype. * stub-objc.c (objc_common_type): New stub. In gcc/objc/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2005-12-15 Fariborz Jahanian <fjahanian@apple.com> Radar 4229905 * objc-act.c (objc_have_common_types): New function. 2005-06-22 Ziemowit Laski <zlaski@apple.com> Radar 4154928 * objc-act.c (objc_common_type): New function. In gcc/cp/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from apple/trunk branch on FSF servers: 2005-12-15 Fariborz Jahanian <fjahanian@apple.com> Radar 4229905 * typeck.c (composite_pointer_type): Call objc_have_common_type when comparing two objective-c pointer types. 2005-06-22 Ziemowit Laski <zlaski@apple.com> Radar 4154928 * call.c (standard_conversion): Allow for a pointer conversion between any two ObjC pointer types. * typeck.c (composite_pointer_type): Determine common type for two ObjC pointer types. In gcc/testsuite/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. Renamed const-str-12.m to constr-str-12b.m to avoid conflicts. 2005-12-15 Fariborz Jahanian <fjahanian@apple.com> Radar 4229905 * obj-c++.dg/warn5.mm: New 2005-06-22 Ziemowit Laski <zlaski@apple.com> Radar 4154928 * obj-c++.dg/const-str-12.mm: New. * objc.dg/const-str-12.m: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 065e9b802c7..e20c234006b 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4051,7 +4051,6 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
bool int_const, op1_int_operands, op2_int_operands, int_operands;
bool ifexp_int_operands;
tree ret;
- bool objc_ok;
op1_int_operands = EXPR_INT_CONST_OPERANDS (orig_op1);
if (op1_int_operands)
@@ -4088,8 +4087,6 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
return error_mark_node;
}
- objc_ok = objc_compare_types (type1, type2, -3, NULL_TREE);
-
if ((TREE_CODE (op1) == EXCESS_PRECISION_EXPR
|| TREE_CODE (op2) == EXCESS_PRECISION_EXPR)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
@@ -4255,13 +4252,15 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
result_type = build_pointer_type (qualify_type (TREE_TYPE (type2),
TREE_TYPE (type1)));
}
+ /* Objective-C pointer comparisons are a bit more lenient. */
+ else if (objc_have_common_type (type1, type2, -3, NULL_TREE))
+ result_type = objc_common_type (type1, type2);
else
{
int qual = ENCODE_QUAL_ADDR_SPACE (as_common);
- if (!objc_ok)
- pedwarn (colon_loc, 0,
- "pointer type mismatch in conditional expression");
+ pedwarn (colon_loc, 0,
+ "pointer type mismatch in conditional expression");
result_type = build_pointer_type
(build_qualified_type (void_type_node, qual));
}