⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invoke.texi

📁 理解和实践操作系统的一本好书
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
@end table@node Error and Warning Options@section Options to request or suppress errors and warnings@cindex options, warnings@cindex options, errors@cindex warnings, suppressing@cindex messages, error@cindex messages, warning@cindex suppressing warningsErrors are diagnostic messages that report that the GNU Fortran compilercannot compile the relevant piece of source code.  The compiler willcontinue to process the program in an attempt to report further errorsto aid in debugging, but will not produce any compiled output.  Warnings are diagnostic messages that report constructions whichare not inherently erroneous but which are risky or suggest there islikely to be a bug in the program.  Unless @option{-Werror} is specified,they do not prevent compilation of the program.You can request many specific warnings with options beginning @option{-W},for example @option{-Wimplicit} to request warnings on implicitdeclarations.  Each of these specific warning options also has anegative form beginning @option{-Wno-} to turn off warnings;for example, @option{-Wno-implicit}.  This manual lists only one of thetwo forms, whichever is not the default.These options control the amount and kinds of errors and warnings producedby GNU Fortran:@table @gcctabopt@item -fmax-errors=@var{n}@opindex @code{fmax-errors=}@var{n}@cindex errors, limitingLimits the maximum number of error messages to @var{n}, at which pointGNU Fortran bails out rather than attempting to continue processing thesource code.  If @var{n} is 0, there is no limit on the number of errormessages produced.@item -fsyntax-only@opindex @code{fsyntax-only}@cindex syntax checkingCheck the code for syntax errors, but don't actually compile it.  Thiswill generate module files for each module present in the code, but noother output file.@item -pedantic@opindex @code{pedantic}Issue warnings for uses of extensions to Fortran 95.@option{-pedantic} also applies to C-language constructs where theyoccur in GNU Fortran source files, such as use of @samp{\e} in acharacter constant within a directive like @code{#include}.Valid Fortran 95 programs should compile properly with or withoutthis option.However, without this option, certain GNU extensions and traditionalFortran features are supported as well.With this option, many of them are rejected.Some users try to use @option{-pedantic} to check programs for conformance.They soon find that it does not do quite what they want---it finds somenonstandard practices, but not all.However, improvements to GNU Fortran in this area are welcome.This should be used in conjunction with @option{-std=f95} or@option{-std=f2003}.@item -pedantic-errors@opindex @code{pedantic-errors}Like @option{-pedantic}, except that errors are produced rather thanwarnings.@item -Wall@opindex @code{Wall}@cindex all warnings@cindex warnings, allEnables commonly used warning options pertaining to usage thatwe recommend avoiding and that we believe are easy to avoid.This currently includes @option{-Waliasing},@option{-Wampersand}, @option{-Wsurprising}, @option{-Wnonstd-intrinsics},@option{-Wno-tabs}, and @option{-Wline-truncation}.@item -Waliasing@opindex @code{Waliasing}@cindex aliasing@cindex warnings, aliasingWarn about possible aliasing of dummy arguments. Specifically, it warnsif the same actual argument is associated with a dummy argument with@code{INTENT(IN)} and a dummy argument with @code{INTENT(OUT)} in a callwith an explicit interface.The following example will trigger the warning.@smallexample  interface    subroutine bar(a,b)      integer, intent(in) :: a      integer, intent(out) :: b    end subroutine  end interface  integer :: a  call bar(a,a)@end smallexample@item -Wampersand@opindex @code{Wampersand}@cindex warnings, ampersand@cindex &Warn about missing ampersand in continued character constants. The warning isgiven with @option{-Wampersand}, @option{-pedantic}, @option{-std=f95}, and@option{-std=f2003}. Note: With no ampersand given in a continued characterconstant, GNU Fortran assumes continuation at the first non-comment,non-whitespace character after the ampersand that initiated the continuation.@item -Wcharacter-truncation@opindex @code{Wcharacter-truncation}@cindex warnings, character truncationWarn when a character assignment will truncate the assigned string.@item -Wconversion@opindex @code{Wconversion}@cindex warnings, conversion@cindex conversionWarn about implicit conversions between different types.@item -Wimplicit-interface@opindex @code{Wimplicit-interface}@cindex warnings, implicit interfaceWarn if a procedure is called without an explicit interface.Note this only checks that an explicit interface is present.  It does notcheck that the declared interfaces are consistent across program units.@item -Wnonstd-intrinsics@opindex @code{Wnonstd-intrinsics}@cindex warnings, non-standard intrinsicsWarn if the user tries to use an intrinsic that does not belong to the standard the user has chosen via the @option{-std} option.@item -Wsurprising@opindex @code{Wsurprising}@cindex warnings, suspicious codeProduce a warning when ``suspicious'' code constructs are encountered.While technically legal these usually indicate that an error has been made.This currently produces a warning under the following circumstances:@itemize @bullet@itemAn INTEGER SELECT construct has a CASE that can never be matched as itslower value is greater than its upper value.@itemA LOGICAL SELECT construct has three CASE statements.@itemA TRANSFER specifies a source that is shorter than the destination.@end itemize@item -Wtabs@opindex @code{Wtabs}@cindex warnings, tabs@cindex tabulatorsBy default, tabs are accepted as whitespace, but tabs are not membersof the Fortran Character Set.  For continuation lines, a tab followedby a digit between 1 and 9 is supported.  @option{-Wno-tabs} will causea warning to be issued if a tab is encountered. Note, @option{-Wno-tabs}is active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},and @option{-Wall}.@item -Wunderflow@opindex @code{Wunderflow}@cindex warnings, underflow@cindex underflowProduce a warning when numerical constant expressions areencountered, which yield an UNDERFLOW during compilation.@item -Wunused-parameter@opindex @code{Wunused-parameter}@cindex warnings, unused parameter@cindex unused parameterContrary to @command{gcc}'s meaning of @option{-Wunused-parameter},@command{gfortran}'s implementation of this option does not warnabout unused dummy arguments, but about unused @code{PARAMETER} values.@option{-Wunused-parameter} is not included in @option{-Wall} but isimplied by @option{-Wall -Wextra}.@item -Werror@opindex @code{Werror}@cindex warnings, to errorsTurns all warnings into errors.@end table@xref{Error and Warning Options,,Options to Request or Suppress Errors andWarnings, gcc,Using the GNU Compiler Collection (GCC)}, for information onmore options offered by the GBE shared by @command{gfortran}, @command{gcc}and other GNU compilers.Some of these have no effect when compiling programs written in Fortran.@node Debugging Options@section Options for debugging your program or GNU Fortran@cindex options, debugging@cindex debugging information optionsGNU Fortran has various special options that are used for debuggingeither your program or the GNU Fortran compiler.@table @gcctabopt@item -fdump-parse-tree@opindex @code{fdump-parse-tree}Output the internal parse tree before starting code generation.  Onlyreally useful for debugging the GNU Fortran compiler itself.@item -ffpe-trap=@var{list}@opindex @code{ffpe-trap=}@var{list}Specify a list of IEEE exceptions when a Floating Point Exception(FPE) should be raised.  On most systems, this will result in a SIGFPEsignal being sent and the program being interrupted, producing a corefile useful for debugging.  @var{list} is a (possibly empty) comma-separatedlist of the following IEEE exceptions: @samp{invalid} (invalid floatingpoint operation, such as @code{SQRT(-1.0)}), @samp{zero} (division byzero), @samp{overflow} (overflow in a floating point operation),@samp{underflow} (underflow in a floating point operation),@samp{precision} (loss of precision during operation) and @samp{denormal}(operation produced a denormal value).Some of the routines in the Fortran runtime library, like@samp{CPU_TIME}, are likely to to trigger floating point exceptions when@code{ffpe-trap=precision} is used. For this reason, the use of @code{ffpe-trap=precision} is not recommended.@item -fbacktrace@opindex @code{fbacktrace}@cindex backtrace@cindex traceSpecify that, when a runtime error is encountered or a deadly signal isemitted (segmentation fault, illegal instruction, bus error orfloating-point exception), the Fortran runtimelibrary should output a backtrace of the error.  This optiononly has influence for compilation of the Fortran main program.@item -fdump-core@cindex core, dump@opindex @code{fdump-core}Request that a core-dump file is written to disk when a runtime erroris encountered on systems that support core dumps. This option isonly effective for the compilation of the Fortran main program.@end table@xref{Debugging Options,,Options for Debugging Your Program or GCC,gcc,Using the GNU Compiler Collection (GCC)}, for more information ondebugging options.@node Directory Options@section Options for directory search@cindex directory, options@cindex options, directory search@cindex search path@cindex INCLUDE directive@cindex directive, INCLUDEThese options affect how GNU Fortran searchesfor files specified by the @code{INCLUDE} directive and where it searchesfor previously compiled modules.It also affects the search paths used by @command{cpp} when used to preprocessFortran source.@table @gcctabopt@item -I@var{dir}@opindex @code{I}@var{dir}@cindex directory, search paths for inclusion@cindex inclusion, directory search paths for@cindex search paths, for included files@cindex paths, search@cindex module search pathThese affect interpretation of the @code{INCLUDE} directive(as well as of the @code{#include} directive of the @command{cpp}preprocessor).Also note that the general behavior of @option{-I} and@code{INCLUDE} is pretty much the same as of @option{-I} with@code{#include} in the @command{cpp} preprocessor, with regard tolooking for @file{header.gcc} files and other such things.This path is also used to search for @file{.mod} files when previouslycompiled modules are required by a @code{USE} statement.@xref{Directory Options,,Options for Directory Search,gcc,Using the GNU Compiler Collection (GCC)}, for information on the@option{-I} option.@item -M@var{dir}@item -J@var{dir}@opindex @code{M}@var{dir}@opindex @code{J}@var{dir}@cindex paths, search@cindex module search pathThis option specifies where to put @file{.mod} files for compiled modules.It is also added to the list of directories to searched by an @code{USE}statement.The default is the current directory.@option{-J} is an alias for @option{-M} to avoid conflicts with existingGCC options.@item -fintrinsic-modules-path @var{dir}@opindex @code{fintrinsic-modules-path} @var{dir}@cindex paths, search@cindex module search pathThis option specifies the location of pre-compiled intrinsic modules, ifthey are not in the default location expected by the compiler.@end table@node Link Options@section Influencing the linking step@cindex options, linking@cindex linking, staticThese options come into play when the compiler links object files into an executable output file. They are meaningless if the compiler is not doing a link step.@table @gcctabopt@item -static-libgfortran@opindex @code{static-libgfortran}On systems that provide @file{libgfortran} as a shared and a staticlibrary, this option forces the use of the static version. If noshared version of @file{libgfortran} was built when the compiler wasconfigured, this option has no effect.@end table@node Runtime Options

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -