From: Tobias Burnus <burnus@net-b.de>
To: gcc patches <gcc-patches@gcc.gnu.org>, gfortran <fortran@gcc.gnu.org>
Subject: [Patch, Fortran] FINAL (prep patches 1/5): Add _final to intrinsic vtables for CLASS(*)
Date: Mon, 31 Dec 2012 12:17:00 -0000 [thread overview]
Message-ID: <50E18236.6070101@net-b.de> (raw)
[-- 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);
next reply other threads:[~2012-12-31 12:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-31 12:17 Tobias Burnus [this message]
2013-01-04 21:06 ` Paul Richard Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50E18236.6070101@net-b.de \
--to=burnus@net-b.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).