aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/module.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r--gcc/cp/module.cc39
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 73971e7..9957df5 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -6017,9 +6017,17 @@ trees_out::core_vals (tree t)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
{
+ if (code == ENUMERAL_TYPE)
+ {
+ /* These fields get set even for opaque enums that lack a
+ definition, so we stream them directly for each ENUMERAL_TYPE.
+ We stream TYPE_VALUES as part of the definition. */
+ WT (t->type_non_common.maxval);
+ WT (t->type_non_common.minval);
+ }
/* Records and unions hold FIELDS, VFIELD & BINFO on these
things. */
- if (!RECORD_OR_UNION_CODE_P (code) && code != ENUMERAL_TYPE)
+ else if (!RECORD_OR_UNION_CODE_P (code))
{
// FIXME: These are from tpl_parm_value's 'type' writing.
// Perhaps it should just be doing them directly?
@@ -6530,9 +6538,17 @@ trees_in::core_vals (tree t)
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
{
+ if (code == ENUMERAL_TYPE)
+ {
+ /* These fields get set even for opaque enums that lack a
+ definition, so we stream them directly for each ENUMERAL_TYPE.
+ We stream TYPE_VALUES as part of the definition. */
+ RT (t->type_non_common.maxval);
+ RT (t->type_non_common.minval);
+ }
/* Records and unions hold FIELDS, VFIELD & BINFO on these
things. */
- if (!RECORD_OR_UNION_CODE_P (code) && code != ENUMERAL_TYPE)
+ else if (!RECORD_OR_UNION_CODE_P (code))
{
/* This is not clobbering TYPE_CACHED_VALUES, because this
is a type that doesn't have any. */
@@ -12217,8 +12233,8 @@ trees_out::write_enum_def (tree decl)
tree type = TREE_TYPE (decl);
tree_node (TYPE_VALUES (type));
- tree_node (TYPE_MIN_VALUE (type));
- tree_node (TYPE_MAX_VALUE (type));
+ /* Note that we stream TYPE_MIN/MAX_VALUE directly as part of the
+ ENUMERAL_TYPE. */
}
void
@@ -12242,8 +12258,6 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
{
tree type = TREE_TYPE (defn);
tree values = tree_node ();
- tree min = tree_node ();
- tree max = tree_node ();
if (get_overrun ())
return false;
@@ -12254,8 +12268,8 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
if (installing)
{
TYPE_VALUES (type) = values;
- TYPE_MIN_VALUE (type) = min;
- TYPE_MAX_VALUE (type) = max;
+ /* Note that we stream TYPE_MIN/MAX_VALUE directly as part of the
+ ENUMERAL_TYPE. */
rest_of_type_compilation (type, DECL_NAMESPACE_SCOPE_P (defn));
}
@@ -12269,22 +12283,17 @@ trees_in::read_enum_def (tree defn, tree maybe_template)
tree new_decl = TREE_VALUE (values);
if (DECL_NAME (known_decl) != DECL_NAME (new_decl))
- goto bad;
+ break;
new_decl = maybe_duplicate (new_decl);
if (!cp_tree_equal (DECL_INITIAL (known_decl),
DECL_INITIAL (new_decl)))
- goto bad;
+ break;
}
if (known || values)
- goto bad;
-
- if (!cp_tree_equal (TYPE_MIN_VALUE (type), min)
- || !cp_tree_equal (TYPE_MAX_VALUE (type), max))
{
- bad:;
error_at (DECL_SOURCE_LOCATION (maybe_dup),
"definition of %qD does not match", maybe_dup);
inform (DECL_SOURCE_LOCATION (defn),