* [Patch, Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*)
@ 2012-12-31 12:17 Tobias Burnus
2013-01-04 21:06 ` Paul Richard Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-12-31 12:17 UTC (permalink / raw)
To: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
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
[-- Attachment #2: unlimited-final.diff --]
[-- Type: text/x-patch, Size: 1312 bytes --]
2012-12-31 Tobias Burnus <burnus@net-b.de>
* 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*)
2012-12-31 12:17 [Patch, Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*) Tobias Burnus
@ 2013-01-04 21:06 ` Paul Richard Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2013-01-04 21:06 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc patches, gfortran
Dear Tobias,
This one is 'obvious' - OK for trunk.
Thanks
Paul
On 31 December 2012 13:16, Tobias Burnus <burnus@net-b.de> wrote:
> 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
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-04 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-31 12:17 [Patch, Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*) Tobias Burnus
2013-01-04 21:06 ` Paul Richard Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).