Navigation: Previous   Up   Next

2.25 Enhanced Source File Polishing

The enhanced polisher takes a set of Fortran source files, which may be in fixed or free source form, and produces a free source form “polished” version of each file. C files and fpp-processed files are not handled. Unlike the simple polisher, the Fortran source files must be compilable without error; this is because the information needed for enhanced polishing requires successful semantic analysis of the files.

The enhanced polisher understands the following compiler options with the same meaning: -132, -abi, -dcfuns, -double, -dryrun, -dusty, -encoding, -english, -f2003, -f2008, -f95, -fixed, -free, -help, -I, -i8, -indirect, -info, -kind, -max_parameter_size, -maxcontin, -mismatch, -mismatch_all, -nihongo, -nocheck_modtime, -nomod, -nonstrict, -noqueue, -o, -openmp, -Qpath, -r8, -tempdir, -thread_safe, -u, -u=external, -u=locality, -u=sharing, -v, -V, -w and -xlicinfo.

The enhanced polisher includes all the simple polish options, which are not repeated here, except for -idcase=Asis.

Note that unlike nagfor =polish, -name_scopes=Asis acts as if it were -name_scopes=Keywords, which is the default. Similarly, -array_constructor_brackets=Asis acts as if it were -array_constructor_brackets=ParenSlash, and is the default, and -dcolon_in_decls=Asis acts as if it were -dcolon_in_decls=Insert, and is the default.

The default filename extension for the output file is ‘.f90_epo’, used when no -o option is specified.

The following additional options control the operation of this tool.

-add_arg_keywords
Add keywords to actual arguments in references to user-defined procedures with an explicit interface and at least two dummy arguments, and in references to intrinsic procedures and intrinsic module procedures with at least three dummy arguments (except for MAX and MIN, where it is at least three actual arguments).

Keywords are not added to arguments that precede a label argument. The order of the arguments is unchanged.

This option is equivalent to -add_arg_keywords=all2,intrinsic3.

-add_arg_keywords=proc_class_list
Add keywords to actual arguments in procedure references, when the procedure has an explicit interface, for the classes of procedure listed in proc_class_list, which is a comma-separated list that may contain the following suboptions:

all (all classes of procedure),
bound (object-bound and type-bound procedures),
dummy (dummy procedures),
external (external procedures),
internal (internal procedures),
intrinsic (intrinsic procedures and intrinsic module procedures),
module (non-intrinsic module procedures),
user (procedures other than intrinsic procedures and intrinsic module procedures).

Keywords are not added to arguments that precede a label argument. The order of the arguments is unchanged. Procedure pointer components are also known as “object-bound procedures”, and thus included in -add_arg_keywords=bound; named procedure pointers are treated as external procedures and thus included in -add_arg_keywords=external.

A suboption name may be followed by a single nonzero digit (e.g. “intrinsic3”); this specifies that for procedures covered by that suboption, keywords are only to be added if the procedure has at least that many dummy arguments. For type-bound and object-bound procedures, the passed-object dummy argument does not count towards the limit (as it never appears in the argument list). The intrinsic MAX and MIN functions use the number of actual arguments instead.

A suboption name followed by a digit may be further followed by the letter ‘a’ (e.g. “intrinsic3a”; this specifies that the argument limit applies to the number of actual arguments in a reference to the procedure, not the number of dummy arguments (the number of actual arguments will be less than the number of dummy arguments when an optional argument is omitted).

Note that suboptions are parsed from left to right, and later suboptions override earlier ones.

-case:kind=case-list
Specifies case rules for specific kinds of name; this option overrides other case options except for -casex. The colon is followed by a comma-separated list of “kind=case”, where case is a case specification (UPPERCASE, lowercase, Capitalised, Camel_Case), and kind is one of the categories listed below:

comp Component
constr Construct name
intr Intrinsic procedure
param PARAMETER
proc Procedure
tbp Type-bound procedure
tparam Derived type parameter
type Derived type
var Variable

For example, -case:var=lower,proc=u specifies lowercase for variables and UPPERCASE for procedures. If there is no setting for a particular kind of name, it will fall back to an appropriate category; param, type, comp, tparam and proc all fall back to var, intr will fall back to proc, and tbp will fall back to comp or proc. If there is no rule or fall-back rule, the -idcase= option setting (or default) is used.

-casex:name-list
Specifies exceptions to the case rules. The colon is followed by a comma-separated list of names in the exact case required. For example, -casex:MaxVal,XYz will result in every occurence of a name equivalent to maxval or xyz appearing as MaxVal or XYz respectively.
-intrinsic_case=analogy
Specifies whether the case of an intrinsic procedure name should be the same as other names (as_names), or the same as language keywords (as_keywords). The default is -intrinsic_case=as_names.
-remove_intrinsic_stmts
Specifies that intrinsic procedure names that were not passed as actual arguments should be removed from INTRINSIC statements, and that if all the names in an INTRINSIC statement are removed in this way, the INTRINSIC statement itself should be removed. Any comments associated with the INTRINSIC statement will remain.
-subroutine_parens
Specifies that empty parentheses should appear on argumentless SUBROUTINE and CALL statements. By default, these optional parentheses are omitted (except for a SUBROUTINE statement with a BIND(C) clause).