From patchwork Mon Dec 31 12:16:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*) Date: Mon, 31 Dec 2012 02:16:54 -0000 From: Tobias Burnus X-Patchwork-Id: 208849 Message-Id: <50E18236.6070101@net-b.de> To: gcc patches , gfortran This simple patch fixes a wrong indent and adds a _final component to the virtual tables generated for intrinsic types. This patch not only prepares the trunk for finalization support, it also avoids ABI issues which a later addition would cause. (For intrinsic types, changing the .mod version number will not reliable force a recompilation.) Build on x86-64-gnu-linux. OK for the trunk? Tobias 2012-12-31 Tobias Burnus * class.c (gfc_find_intrinsic_vtab): Add _final component. diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 61d65e7..84f383e 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -597,7 +597,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr, fclass->refs++; fclass->ts.type = BT_UNKNOWN; if (!ts->u.derived->attr.unlimited_polymorphic) - fclass->attr.abstract = ts->u.derived->attr.abstract; + fclass->attr.abstract = ts->u.derived->attr.abstract; fclass->f2k_derived = gfc_get_namespace (NULL, 0); if (gfc_add_flavor (&fclass->attr, FL_DERIVED, NULL, &gfc_current_locus) == FAILURE) @@ -2310,6 +2708,15 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) /* Set initializer. */ c->initializer = gfc_lval_expr_from_sym (copy); c->ts.interface = copy; + + /* Add component _final. */ + if (gfc_add_component (vtype, "_final", &c) == FAILURE) + goto cleanup; + c->attr.proc_pointer = 1; + c->attr.access = ACCESS_PRIVATE; + c->tb = XCNEW (gfc_typebound_proc); + c->tb->ppc = 1; + c->initializer = gfc_get_null_expr (NULL); } vtab->ts.u.derived = vtype; vtab->value = gfc_default_initializer (&vtab->ts);