From 12e1243e426a12358e793cef2735e77c37452ec7 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Wed, 15 Nov 2000 14:39:14 +0000 Subject: tree.c (build_type_no_quals): New function. 2000-11-13 Andrew Haley * tree.c (build_type_no_quals): New function. * tree.h (build_type_no_quals): Declare. * c-common.c (c_get_alias_set): When considering type compatibility for pointer types, ignore cv-qualifiers anywhere in a pointer chain. From-SVN: r37479 --- gcc/tree.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 4b3e930..7e820f5 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3798,6 +3798,26 @@ build_reference_type (to_type) return t; } +/* Build a type that is compatible with t but has no cv quals anywhere + in its type, thus + + const char *const *const * -> char ***. */ + +tree +build_type_no_quals (t) + tree t; +{ + switch (TREE_CODE (t)) + { + case POINTER_TYPE: + return build_pointer_type (build_type_no_quals (TREE_TYPE (t))); + case REFERENCE_TYPE: + return build_reference_type (build_type_no_quals (TREE_TYPE (t))); + default: + return TYPE_MAIN_VARIANT (t); + } +} + /* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE. MAXVAL should be the maximum value in the domain (one less than the length of the array). -- cgit v1.1