Syntax:
The /warn option instructs the compiler to generate diagnostic messages for defined classes of additional checking that can be performed at compile-time. It also can change the severity level of issued compilation messages.
In the visual development environment, specify the Warning Level (/warn:nogeneral, default, or /warn:error) in the General or the Compiler Diagnostic Compiler Option Category. Specify individual Warning Options in the Compiler Diagnostic Compiler Option Category. The /warn options and their visual development environment names are:
/warn:noalignments (Data Alignment) |
/warn:argument_checking (Argument Mismatch) |
/warn:declarations or /4Yd (Undeclared Variables) |
/warn:errors or /WX (Warning Level: Errors) |
/warn:nofileopt (Inform when Compiling Files Separately) |
/warn:nogeneral (Warning Level: Ignore) |
/warn:ignore_loc (Inform When Removing %LOC from an Argument) |
/warn:stderror or /4Ys (Treat Fortran Standard Warnings as Errors) |
/warn:truncated_source (Truncated Source) |
/warn:nouncalled (Uncalled Routines) |
/warn:nouninitialized (Uninitialized Variables) |
/warn:unused (Unused Variables) |
/warn:nousage (Usage) |
/warn:all or /warn |
/warn:none, /nowarn, or /W0 |
If you omit /warn, the defaults are:
The /warn keywords are:
Suppresses warning messages for data that is not naturally aligned. The default is /warn:alignments.
Enables warnings about argument mismatches between callers and callees, when compiled together. The default is /warn:noargument_checking, except in the visual development environment for a debug configuration, where the default is /warn:argument_checking.
Issues an error message for any undeclared symbols. This option makes the default type of a variable undefined (IMPLICIT NONE) rather than using the default Fortran rules. The default is /warn:nodeclarations or /4Nd.
Changes the severity of all warning diagnostics into error diagnostics. The default is /warn:noerrors. Specifying /warn:errors (or /WX) sets /warn:stderrors.
Suppresses the display of an informational-level diagnostic message when compiling multiple files separately, which can prevent interprocedure optimizations. The default is /warn:fileopt (displays the message: Some interprocedural optimizations may be disabled when compiling in this mode), except in the visual development environment for a release configuration, where the default is /warn:nofileopt.
Suppresses all informational-level and warning-level diagnostic messages from the compiler. The default is /warn:general or /W1.
Requests that the compiler issues warnings when %LOC is stripped from an argument. The default is /warn:noignore_loc (does not issue a warning for this condition).
Requests Fortran 90 standards checking (see /stand) with error-level compilation messages instead of warning-level messages. Specifying /warn:stderrors sets /stand:f90 and is equivalent to /4Ys.
Specifying /warn:stderrors with /stand:f95 requests error-level messages for extensions to the proposed Fortran 95 standard.
Specifying /warn:errors sets /warn:stderrors. The default is /warn:nostderrrors.
Requests that the compiler issue a warning diagnostic message
when it reads a source line with a statement field
that exceeds the maximum column width in fixed-format source files.
The maximum column width for fixed-format files is column 72 or 132,
depending whether the /extend_source option was specified.
This option has no effect on truncation; lines that exceed
the maximum column width are always truncated. This option does not apply to free-format
source files. The default is /warn:notruncated_source.
Suppresses the compiler warning diagnostic message when a statement function is never called. The default is /warn:uncalled.
Suppresses warning messages for a variable that is used before a value was assigned to it. The default is /warn:uninitialized.
Requests warning messages for a variable that is declared but never used. The default is /warn:nounused.
Suppresses warning messages about questionable programming practices and the use of intrinsic functions that use a two-digit year (year 2000). The questionable programming practices, although allowed, often are the result of programming errors. For example, /warn:usage detects a continued character or Hollerith literal whose first part ends before the statement field ends and appears to end with trailing spaces. The default is /warn:usage. The /pad_source option can prevent warning messages from /warn:usage.
Requests all possible warning messages, but does not set /warn:errors or /warn:stderrors. To enable all the additional checking to be performed and force the severity of the diagnostics to be severe enough to not generate an object file, specify /warn:(all,errors) or /warn:(all,stderrors).
Suppresses all warning messages.
For example, the following command requests the argument_checking and declarations keywords and accepts the defaults for the other /warn keywords:
df /warn:(argument_checking,declarations) testfile.f90