tree.c (build_type_no_quals): New function.

2000-11-13  Andrew Haley  <aph@redhat.com>

        * 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
This commit is contained in:
Andrew Haley 2000-11-15 14:39:14 +00:00 committed by Andrew Haley
parent 71631a1f1c
commit 12e1243e42
4 changed files with 30 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2000-11-13 Andrew Haley <aph@redhat.com>
* 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.
2000-11-15 Graham Stott <grahams@redhat.com>
* regrename.c (scan_rtx_rtx): Skip to the next chain on

View File

@ -4794,9 +4794,7 @@ lang_get_alias_set (t)
can dereference IPP and CIPP. So, we ignore cv-qualifiers on
the pointed-to types. This issue has been reported to the
C++ committee. */
t1 = TYPE_MAIN_VARIANT (TREE_TYPE (t));
t1 = ((TREE_CODE (t) == POINTER_TYPE)
? build_pointer_type (t1) : build_reference_type (t1));
t1 = build_type_no_quals (t);
if (t1 != t)
return get_alias_set (t1);
}

View File

@ -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).

View File

@ -1923,6 +1923,7 @@ extern tree signed_or_unsigned_type PARAMS ((int, tree));
extern void fixup_unsigned_type PARAMS ((tree));
extern tree build_pointer_type PARAMS ((tree));
extern tree build_reference_type PARAMS ((tree));
extern tree build_type_no_quals PARAMS ((tree));
extern tree build_index_type PARAMS ((tree));
extern tree build_index_2_type PARAMS ((tree, tree));
extern tree build_array_type PARAMS ((tree, tree));