[PATCH, Fortran] Parse FINAL procedure declarations

Daniel Kraft d@domob.eu
Thu May 22 21:03:00 GMT 2008


Hi,

this is a first patch including ChangeLog for implementing parsing and 
resolution of Fortran 2003 FINAL procedures; when this is completed, 
I'll work on actually finalizing expressions.

The patch enables CONTAINS-sections inside derived type definitions, 
possibly containing FINAL statements; it also adds the f2k_derived 
namespace to gfc_symbols of derived types as Paul Thomas suggested for 
F2003 OOP features.  Inside this namespace, the FINAL procedures are 
stored in a linked list.

Later in the resolution phase, this list is walked and checked that the 
procedures there fulfill the requirements of the F2003 standard for 
FINAL procedures.  So far these statements don't have any further effect.

While there are still some open issues, I believe this patch is already 
close to completion, so I post it here for comments (tomorrow I'll 
probably have few to no time, this is why I post it now).  The patch 
succeeds both my new tests included and the existing test-suite for me 
on GNU/Linux-x86-32 without any failures.

Things to note:

* I'm not completely sure about what the test-suite should/should 
not/must not (because it may be invalid?) check.  Comments on my tests 
are very welcome ;)

* There are some XXX-marks in the patch, but IIRC only/mostly for the 
point below.

* AFAIK, kind and length type parameters (in fact, type parameters at 
all) are not yet implemented in gfortran, so the according checks are 
missing from the test-suite and code.  I hope this is ok like this, 
we'll have to add the code later when these features get implemented.

* FX, I got an answer on comp.lang.fortran about the assumed shape / 
length type parameter thing (see point above); but I still believe (and 
this was also the opinion of the poster there who answered) it makes 
sense to define finalizer procedures for assumed shape so they can 
finalize arrays of all concrete shapes.  Maybe I could replace the 
commented out block in the patch (has XXX) to emit a warning rather than 
an error if a finalizer has something apart from assumed shape?  What do 
you think?

* Indentation-style in the patch is surely wrong in some places, need to 
replace eight spaces by a tab for the final version.

So far, I welcome your comments.  Though this is surely not my final 
patch for this, its probably close modulo removing some XXX-comments, 
the format-fixing and possibly minor adaptions as result of comments.

Cheers,
Daniel

-- 
Done:     Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal
Underway: Ran-Gno-Neu-Fem
To go:    Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080522/792d640b/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080522/792d640b/attachment.txt>


More information about the Gcc-patches mailing list