Commit 12e1243e by Andrew Haley Committed by Andrew Haley

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
parent 71631a1f
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> 2000-11-15 Graham Stott <grahams@redhat.com>
* regrename.c (scan_rtx_rtx): Skip to the next chain on * regrename.c (scan_rtx_rtx): Skip to the next chain on
......
...@@ -4794,9 +4794,7 @@ lang_get_alias_set (t) ...@@ -4794,9 +4794,7 @@ lang_get_alias_set (t)
can dereference IPP and CIPP. So, we ignore cv-qualifiers on can dereference IPP and CIPP. So, we ignore cv-qualifiers on
the pointed-to types. This issue has been reported to the the pointed-to types. This issue has been reported to the
C++ committee. */ C++ committee. */
t1 = TYPE_MAIN_VARIANT (TREE_TYPE (t)); t1 = build_type_no_quals (t);
t1 = ((TREE_CODE (t) == POINTER_TYPE)
? build_pointer_type (t1) : build_reference_type (t1));
if (t1 != t) if (t1 != t)
return get_alias_set (t1); return get_alias_set (t1);
} }
......
...@@ -3798,6 +3798,26 @@ build_reference_type (to_type) ...@@ -3798,6 +3798,26 @@ build_reference_type (to_type)
return t; 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. /* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE.
MAXVAL should be the maximum value in the domain MAXVAL should be the maximum value in the domain
(one less than the length of the array). (one less than the length of the array).
......
...@@ -1923,6 +1923,7 @@ extern tree signed_or_unsigned_type PARAMS ((int, tree)); ...@@ -1923,6 +1923,7 @@ extern tree signed_or_unsigned_type PARAMS ((int, tree));
extern void fixup_unsigned_type PARAMS ((tree)); extern void fixup_unsigned_type PARAMS ((tree));
extern tree build_pointer_type PARAMS ((tree)); extern tree build_pointer_type PARAMS ((tree));
extern tree build_reference_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_type PARAMS ((tree));
extern tree build_index_2_type PARAMS ((tree, tree)); extern tree build_index_2_type PARAMS ((tree, tree));
extern tree build_array_type PARAMS ((tree, tree)); extern tree build_array_type PARAMS ((tree, tree));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment