Table of Contents




ftnchek is invoked through a command of the form:

$ ftnchek [-option -option ...] filename [filename ...]

The brackets indicate something which is optional. The brackets themselves are not actually typed. Here options are command-line switches or settings, which control the operation of the program and the amount of information that will be printed out. If no option is specified, the default action is to print error messages, warnings, and informational messages, but not the program listing or symbol tables.

Each option begins with the '-' character. (On VAX/VMS or MS-DOS systems you may use either '/' or '-'.) For the sake of conformity with an increasingly common convention, options can also begin with '--'. The options are described at greater length in the next section.

ftnchek options fall into two categories: switches, which are either true or false, and settings, which have a numeric or string value. The name of a switch is prefixed by 'no' or 'no-' to turn it off: e.g. -nopure would turn off the warnings about impure functions. The 'no' prefix can also be used with numeric settings, having the effect of turning off the corresponding warnings. Settings that control lists of warnings have a special syntax discussed below. Only the first 3 characters of an option name (not counting the '-') need be provided. A colon may be used in place of an equals sign for numeric or string setting assignments; however, we show only the equals sign form below.

The switches and settings which ftnchek currently recognizes are listed below. For each option, the default is the value used if the option is not explicitly specified, while the turn-on is the value used if the option is given without assigning it a value.

Control warnings about subprogram type and argument mismatches. Default = turn-on = all.
Control warnings in checking array arguments of subprograms. Default = turn-on = all.
Use shorter format for some error messages. Default = no.
Produce subprogram call hierarchy in one of 3 formats: text call-tree, who-calls-who and VCG. Default = none, turn-on = tree,prune,sort.

If the -mkhtml option is invoked and tree is the applied calltree option, a file named CallTree.html, will be produced depicting the tree in HTML format.

Perform checking. Default = yes.
Set maximum line length to num columns. (Beyond this is ignored.) Turn-on = max = 132. Default = 72.
Set degree of strictness in checking COMMON blocks. Default = turn-on = all.
Print cross-reference list of subprogram calls, label usage, and/or COMMON block use. Default = none.
Print a list of all identifiers whose datatype is not explicitly declared. Default = no.
Warn wherever division is done (except division by a constant). Default = no.
Set the maximum number of error messages per cascade. Default = turn-on = 3.
Warn if external subprograms which are invoked are never defined. Default = yes.
Control specific warnings about supported extensions to the Fortran 77 Standard. Default = none, turn-on = all.
Control specific warnings about supported extensions to the Fortran 77 Standard that were not adopted as part of the Fortran 90 Standard. Default = none, turn-on = all.
Control specific warnings about standard Fortran 77 features that were deleted from the Fortran 95 Standard. Default = none, turn-on = all.
Print command summary. Default = no.
Define non-alphanumeric characters that may be used in identifiers. Default = turn-on = dollar sign and underscore.
Define a directory to search for INCLUDE files before searching in the system-wide directory. Cumulative. Default = turn-on = none.
Control treatment of nonstandard intrinsic functions. Default = all except vms for Unix version, all except unix for VMS version, all except unix and vms for other versions. Turn-on = all.
Begin library mode: do not warn about subprograms in file that are defined but never used. Default = no.
Print source listing of program. Default = no.
Prepare a file of declarations. The list specifies options for the format of this file. Default = none, turn-on = declarations.
Create individual HTML document files from ftnchek analysis and code comments. Usually you will also want to specify -call=tree to create the root HTML file CallTree.html. Default = none, turn-on = documents.
Give output suitable for novice users. Default = yes.
Send output to the given file. Default and turn-on sends output to the screen. (Default filename extension is .lis).
Set the size of ``Cray pointer'' variables to num bytes. Min = 1, max = 16. Default = turn-on = 4
Warn about non-portable usages. Default = none, turn-on = all.
Give warnings for possibly misleading appearance of source code. Default = turn-on = all.
Create project file (see explanation below). Default = no.
Assume functions are pure, i.e. have no side effects. Default = yes.
Produce less verbose output. Default = no.
Print table of subprograms referenced by each subprogram. Default = no.
Print amount of resources used in analyzing the program. Default = no.
List any variable names which clash at 6 characters length. Default = no.
Print list of subprograms sorted in prerequisite order. Default = no.
Select source formatting options: fixed or free form, DEC Fortran tab-formatted lines, VMS-style INCLUDE statement, UNIX-style backslash escape sequences, and implicit typing of parameters. Default = none, turn-on = all.
Produce extra-picky warnings about obsolescent or old-fashioned programming constructions. Default = none, turn-on = all.
Print symbol table and label table for each subprogram. Default = no.
Check for possible loss of accuracy by truncation. Default = turn-on = all.
Control warnings about unused or uninitialized variables, common blocks, etc. Default = turn-on = all.
Produce VCG format of call graph.
Print version number. Default = no.
Assume COMMON blocks lose definition between activations. Default = no. (Obsolete. Use -common=volatile instead.)
Set the default word size for numeric quantities to num bytes. Default = turn-on = 4 bytes.
Set output column at which to wrap long error messages and warnings to the next line. If set to 0, turn off wrapping. Default = turn-on = 79.

When more than one option is used, they should be separated by a blank space, except on systems such as VMS where options begin with slash ( / ). No blank spaces may be placed around the equals sign ( = ) in a setting. ftnchek "?" will produce a command summary listing all options and settings.

For settings that take a list of keywords, namely -arguments, -array, -calltree, -common, -crossref, -f77, -f90, -f95, -intrinsic, -makedcls, -mkhtml, -portability, -pretty, -project, -source, -style, -truncation, and -usage, the list consists of keywords separated by commas or colons. If the list of keywords is omitted, the effect is to set the option to its turn-on value (same as ``all'' in most cases). Also, if the list is omitted, the setting name can be prefixed with no or no- to turn off all the options it controls. For example, -f77 turns on all warnings about nonstandard constructions, while -nof77 turns them all off. Three special keywords are:

Print out all the option keywords controlled by the setting, with a brief explanation of their meanings. This keyword cannot be given in a list with other keywords.
Set all options. This turns on all options controlled by the setting.
Clear all options. This turns off all options controlled by the setting.

These three special keywords must be given in full. For all other keywords, only as many letters of the keyword as are necessary to identify it unambiguously need be given, or a wildcard pattern may be used. Including a keyword in the list turns the corresponding option on. For example, -f77=intrinsic would turn on only the warnings about use of nonstandard intrinsic functions. Prefixing a keyword by no- turns its option off. For example, -pretty=no-long-line turns off warnings about lines exceeding 72 columns in length while leaving all other warnings about misleading appearance in effect. If a setting has default none, you can turn on all options except one or two by using all first. For example, -f77=all,no-include enables warnings about all nonstandard extensions except INCLUDE statements. If a setting has default all, you can turn off all warnings except one or two by using none first. For example, -truncation=none,demotion would turn off all precision related warnings except about demotions. Wildcard patterns contain an asterisk to stand for any string of characters. If a wildcard pattern is used, all the warnings that match it are affected. If no- is prefixed to the pattern, all the matching warnings are turned off, otherwise they are all turned on. The minimum unambiguous length rule does not apply to wildcard matching. For example, use -usage=no-*var* to turn off all warnings relating to variable usage (both local and common). (Unix users may need to quote any options containing wildcards in order to prevent the shell from attempting to expand them.) Wildcards are recognized only in lists of warning keywords, not in the top-level options themselves.

When ftnchek starts up, it looks for environment variables and also for a preferences file. Any options defined in the environment or in the preferences file are used as defaults in place of the built-in defaults. They are over-ridden by any command line options. See the section on changing the defaults for details about the environment options and the preferences file.

When giving a name of an input file, the extension is optional. If no extension is given, ftnchek will first look for a project file with extension .prj, and will use that if it exists. If not, then ftnchek will look for a Fortran source file with the extension .for for VMS systems, .f for UNIX systems. More than one file name can be given to ftnchek, and it will process the modules in all files as if they were in a single file.

Wildcards are allowed in the specification of filenames on the command line for the VMS and MS-DOS versions, as also of course under UNIX and any other system that performs wildcard expansion in the command processor.

If no filename is given, ftnchek will read input from the standard input.