aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-lang.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2004-07-15 17:50:51 -0400
committerJason Merrill <jason@gcc.gnu.org>2004-07-15 17:50:51 -0400
commite4f78bd4af1ac824139f05da29ef6c6c4366aa0b (patch)
treef820294f653da18ebccc79a5d1540ab7b4b21ed2 /gcc/cp/cp-lang.c
parentbc2f7bb864e8e75db8114c76c36db761e0d65f7e (diff)
downloadgcc-e4f78bd4af1ac824139f05da29ef6c6c4366aa0b.zip
gcc-e4f78bd4af1ac824139f05da29ef6c6c4366aa0b.tar.gz
gcc-e4f78bd4af1ac824139f05da29ef6c6c4366aa0b.tar.bz2
re PR middle-end/15885 (wrong va_start warning (and code))
* cp-lang.c (cxx_types_compatible_p): To the middle-end, references and pointers are compatible. PR middle-end/15885 * gimplify.c (gimplify_arg): New fn, split out from... (gimplify_call_expr): Here. Special-case BUILT_IN_VA_START. From-SVN: r84782
Diffstat (limited to 'gcc/cp/cp-lang.c')
-rw-r--r--gcc/cp/cp-lang.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 5f38fbb..b6e933f 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -317,9 +317,23 @@ cp_var_mod_type_p (tree type, tree fn)
return false;
}
+/* This compares two types for equivalence ("compatible" in C-based languages).
+ This routine should only return 1 if it is sure. It should not be used
+ in contexts where erroneously returning 0 causes problems. */
+
static int cxx_types_compatible_p (tree x, tree y)
{
- return same_type_ignoring_top_level_qualifiers_p (x, y);
+ if (same_type_ignoring_top_level_qualifiers_p (x, y))
+ return 1;
+
+ /* Once we get to the middle-end, references and pointers are
+ interchangeable. FIXME should we try to replace all references with
+ pointers? */
+ if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y)
+ && same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
+ return 1;
+
+ return 0;
}
/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed