To add a new command-line option to
g77, first decide
what kind of option you wish to add.
gcc documentation for one
or more options that is most closely like the one you want to add
(in terms of what kind of effect it has, and so on) to
help clarify its nature.
gcc, but they apply only when compiling Fortran programs.
Fortran options are listed in the file
which is used during the build of
build a list of all options that are accepted by
at least one language's compiler.
This list goes into the
gcc/toplev.c, which uses this array to
determine whether a particular option should be
offered to the linked-in front end for processing
lang_option_decode, which, for
g77, is in
gcc/gcc/f/com.c and just
If the linked-in front end "rejects" a
particular option passed to it,
just ignores the option, because some
language's compiler is willing to accept it.
This allows commands like
gcc -fno-asm foo.c bar.f
to work, even though Fortran compilation does
not currently support the
even though the
f771 version of
produce a diagnostic because some other language (C)
does accept it.
This also means that commands like
g77 -fno-asm foo.f yield no diagnostics,
despite the fact that no phase of the command was
able to recognize and process
a warning about this would be helpful if it were
Code that processes Fortran options is found in
This code needs to check positive and negative forms
of each option.
The defaults for Fortran options are set in their
global definitions, also found in
Many of these defaults are actually macros defined
gcc/gcc/f/target.h, since they might be
However, since, in practice, GNU compilers
should behave the same way on all configurations
(especially when it comes to language constructs),
the practice of setting defaults in
is likely to be deprecated and, ultimately, stopped
in future versions of
Accessor macros for Fortran options, used by code
g77 FFE, are defined in
Compiler options are listed in
in the array
An option not listed in
looked up in
f_options and handled from there.
The defaults for compiler options are set in the
global definitions for the corresponding variables,
some of which are in
You can set different defaults for Fortran-oriented
or Fortran-reticent compiler options by changing
the source code of
g77 and rebuilding.
How to do this depends on the version of
G77 0.5.24 (EGCS 1.1)
G77 0.5.25 (EGCS 1.2 - which became GCC 2.95)
(Note that these versions of
perform internal consistency checking automatically
-fversion option is specified.)
G77 0.5.24 (EGCS 1.0)
-fset-g77-defaultsoption, which is always provided as the first option when called by
This code is in
Have it change just the variables that you want to default
to a different setting for Fortran compiles compared to
compiles of other languages.
-fset-g77-defaults option is passed to
automatically because of the specification information
This file tells the
gcc command how to recognize,
in this case, Fortran source files (those to be preprocessed,
and those that are not), and further, how to invoke the
appropriate programs (including
f771) to process
those source files.
It is in
-fversion, and other options are passed, as appropriate,
even when the user has not explicitly specified them.
Other "internal" options such as
are passed via this mechanism.