Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Paul and Harald, 'from' is slightly better but either will be understood. Committed with "from" (which I managed to spell correctly on the second try). Best regards Thomas
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Harald, 'from' is slightly better but either will be understood. Cheers Paul Happy New Year to you all! On Mon, 1 Jan 2024 at 21:25, Harald Anlauf wrote: > Hi Thomas! > > Am 30.12.23 um 12:08 schrieb Thomas Koenig: > > Replying to myself... > > > > > >> I think this also desevers a mention in changes.html. Here is something > >> that I came up with. OK? Or does anybody have suggestions for a better > >> wording? > >> > > > > Or maybe this is better: > > > > diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html > > index 4b83037a..d232f631 100644 > > --- a/htdocs/gcc-14/changes.html > > +++ b/htdocs/gcc-14/changes.html > > @@ -282,8 +282,14 @@ a work-in-progress. > > > > > > > > - > > - > > +Fortran > > + > > + With the -save-temps option, preprocessed files > > +with the .fii extension will be generated for > > +free-form source files such as .F90 and > > +.fi for fixed-form files such as .F. > > + > > + > > > > I slightly prefer this variant. > > I wonder if it were better to write "generated from" instead of > "generated for". A native speaker might help here. > > While at it: gfortran now accepts "-std=f2023", which implies that > the limit for line-length in free-form has been increased to 1 > characters, and statements may have up to 1 million characters. > (See Tobias' commit r14-5553-gb9eba3baf54b4f). > > I'd consider this as important as the other change... ;-) > > Thanks, > Harald > > > > > > > > > > >
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Thomas! Am 30.12.23 um 12:08 schrieb Thomas Koenig: Replying to myself... I think this also desevers a mention in changes.html. Here is something that I came up with. OK? Or does anybody have suggestions for a better wording? Or maybe this is better: diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 4b83037a..d232f631 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -282,8 +282,14 @@ a work-in-progress. - - +Fortran + + With the -save-temps option, preprocessed files + with the .fii extension will be generated for + free-form source files such as .F90 and + .fi for fixed-form files such as .F. + + I slightly prefer this variant. I wonder if it were better to write "generated from" instead of "generated for". A native speaker might help here. While at it: gfortran now accepts "-std=f2023", which implies that the limit for line-length in free-form has been increased to 1 characters, and statements may have up to 1 million characters. (See Tobias' commit r14-5553-gb9eba3baf54b4f). I'd consider this as important as the other change... ;-) Thanks, Harald
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Replying to myself... I think this also desevers a mention in changes.html. Here is something that I came up with. OK? Or does anybody have suggestions for a better wording? Or maybe this is better: diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 4b83037a..d232f631 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -282,8 +282,14 @@ a work-in-progress. - - +Fortran + + With the -save-temps option, preprocessed files +with the .fii extension will be generated for +free-form source files such as .F90 and +.fi for fixed-form files such as .F. + +
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Rimvydas, Documentation part. The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings. Thanks for your work on this! I think this also desevers a mention in changes.html. Here is something that I came up with. OK? Or does anybody have suggestions for a better wording? diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index 4b83037a..b3b67dda 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -282,8 +282,13 @@ a work-in-progress. - - +Fortran + + With the -save-temps option, .fii and +.fi files are now generated from .F90 +and .F files, respectively. + +
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Rimvydas! Am 28.12.23 um 08:09 schrieb Rimvydas Jasinskas: On Wed, Dec 27, 2023 at 10:34 PM Harald Anlauf wrote: The patch is almost fine, except for a strange wording here: +@smallexample +gfortran -save-temps -c foo.F90 +@end smallexample + +preprocesses to in @file{foo.fii}, compiles to an intermediate +@file{foo.s}, and then assembles to the (implied) output file +@file{foo.o}, whereas: I understand the formulation is copied from gcc/doc/invoke.texi, where it does not fully make sense to me either. How about: "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..." Furthermore, +@smallexample +gfortran -save-temps -S foo.F +@end smallexample + +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and +then compiles to the (implied) output file @file{foo.s}. Even if this is copied from the gcc texinfo file, how about: "saves the preprocessor output in @file{foo.fi}, ..." which I find easier to read. Can you also add a reference to the PR number in the commit message? I agree, wording sounds a lot better, included in v2 together with PR number. Yes, this is OK. Pushed: https://gcc.gnu.org/g:2cb93e6686e4af5725d8c919cf19f535a7f3aa33 Thanks for the patch! Is there a specific reason thy -fc-prototypes (Interoperability Options section) is excluded from manpage? Can you be more specific? I get here (since gcc-9): % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability Options" Interoperability Options -fc-prototypes -fc-prototypes-external although no detailed explanation (-> gfortran.info). The https://gcc.gnu.org/onlinedocs/gfortran/Invoking-GNU-Fortran.html does contain a working link to https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-Options.html However the manpage has Interoperability section explicitly disabled with "@c man end" ... "@c man begin ENVIRONMENT". After digging into git log it seems that Interoperability section was unintentionally added after this comment mark in https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e655a6cc43 Yes, that might have been unintentional. Can you open a PR, and if you have a fix, attach it there? Thanks, Harald Best regards, Rimvydas
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
On Wed, Dec 27, 2023 at 10:34 PM Harald Anlauf wrote: > The patch is almost fine, except for a strange wording here: > > +@smallexample > +gfortran -save-temps -c foo.F90 > +@end smallexample > + > +preprocesses to in @file{foo.fii}, compiles to an intermediate > +@file{foo.s}, and then assembles to the (implied) output file > +@file{foo.o}, whereas: > > I understand the formulation is copied from gcc/doc/invoke.texi, > where it does not fully make sense to me either. > > How about: > > "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..." > > Furthermore, > > +@smallexample > +gfortran -save-temps -S foo.F > +@end smallexample > + > +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and > +then compiles to the (implied) output file @file{foo.s}. > > Even if this is copied from the gcc texinfo file, how about: > > "saves the preprocessor output in @file{foo.fi}, ..." > > which I find easier to read. > > Can you also add a reference to the PR number in the commit message? I agree, wording sounds a lot better, included in v2 together with PR number. > > Is there a specific reason thy -fc-prototypes (Interoperability > > Options section) is excluded from manpage? > > Can you be more specific? I get here (since gcc-9): > > % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability > Options" > Interoperability Options > -fc-prototypes -fc-prototypes-external > > although no detailed explanation (-> gfortran.info). The https://gcc.gnu.org/onlinedocs/gfortran/Invoking-GNU-Fortran.html does contain a working link to https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-Options.html However the manpage has Interoperability section explicitly disabled with "@c man end" ... "@c man begin ENVIRONMENT". After digging into git log it seems that Interoperability section was unintentionally added after this comment mark in https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e655a6cc43 Best regards, Rimvydas From f8663a022a8b9c4f1c4a76d8e4823e24f691623c Mon Sep 17 00:00:00 2001 From: Rimvydas Jasinskas Date: Sat, 23 Dec 2023 18:59:09 + Subject: Fortran: Add Developer Options mini-section to documentation Separate out -fdump-* options to the new section. Sort by option name. While there, document -save-temps intermediates. gcc/fortran/ChangeLog: PR fortran/81615 * invoke.texi: Add Developer Options section. Move '-fdump-*' to it. Add small examples about changed '-save-temps' behavior. Signed-off-by: Rimvydas Jasinskas --- gcc/fortran/invoke.texi | 117 ++-- 1 file changed, 77 insertions(+), 40 deletions(-) diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index c7fd019a7c5..5d526e23e5c 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -94,12 +94,13 @@ one is not the default. compiled. * Preprocessing Options:: Enable and customize preprocessing. * Error and Warning Options:: How picky should the compiler be? -* Debugging Options:: Symbol tables, measurements, and debugging dumps. +* Debugging Options:: Symbol tables, measurements. * Directory Options:: Where to find module files * Link Options :: Influencing the linking step * Runtime Options:: Influencing runtime behavior * Code Gen Options::Specifying conventions for function calls, data layout and register usage. +* Developer Options:: Printing GNU Fortran specific info, debugging dumps. * Interoperability Options:: Options for interoperability with other languages. * Environment Variables:: Environment variables that affect @command{gfortran}. @@ -159,9 +160,8 @@ and warnings}. } @item Debugging Options -@xref{Debugging Options,,Options for debugging your program or GNU Fortran}. -@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original --fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} +@xref{Debugging Options,,Options for debugging your program}. +@gccoptlist{-fbacktrace -fdebug-aux-vars -ffpe-trap=@var{list} -ffpe-summary=@var{list} } @@ -201,6 +201,12 @@ and warnings}. -fpack-derived -frealloc-lhs -frecursive -frepack-arrays -fshort-enums -fstack-arrays } + +@item Developer Options +@xref{Developer Options,,GNU Fortran Developer Options}. +@gccoptlist{-fdump-fortran-global -fdump-fortran-optimized +-fdump-fortran-original -fdump-parse-tree -save-temps +} @end table @node Fortran Dialect Options @@ -1280,40 +1286,14 @@ 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 +@section Options for debugging your program @cindex options, debugging @cindex debugging information options GNU Fortran has various special options that are used for debugging -either your program or the GNU Fortran compiler.
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Hi Rimvydas! Am 24.12.23 um 02:33 schrieb Rimvydas Jasinskas: Documentation part. The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings. The patch is almost fine, except for a strange wording here: +@smallexample +gfortran -save-temps -c foo.F90 +@end smallexample + +preprocesses to in @file{foo.fii}, compiles to an intermediate +@file{foo.s}, and then assembles to the (implied) output file +@file{foo.o}, whereas: I understand the formulation is copied from gcc/doc/invoke.texi, where it does not fully make sense to me either. How about: "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..." Furthermore, +@smallexample +gfortran -save-temps -S foo.F +@end smallexample + +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and +then compiles to the (implied) output file @file{foo.s}. Even if this is copied from the gcc texinfo file, how about: "saves the preprocessor output in @file{foo.fi}, ..." which I find easier to read. Can you also add a reference to the PR number in the commit message? Is there a specific reason thy -fc-prototypes (Interoperability Options section) is excluded from manpage? Can you be more specific? I get here (since gcc-9): % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability Options" Interoperability Options -fc-prototypes -fc-prototypes-external although no detailed explanation (-> gfortran.info). Regards, Rimvydas Thanks, Harald
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Documentation part. The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings. Is there a specific reason thy -fc-prototypes (Interoperability Options section) is excluded from manpage? Regards, Rimvydas From 3adb6cd8a2aa1576a8ff63b280239e725f1f112e Mon Sep 17 00:00:00 2001 From: Rimvydas Jasinskas Date: Sat, 23 Dec 2023 18:59:09 + Subject: Fortran: Add Developer Options mini-section to documentation Separate out -fdump-* options to the new section. Sort by option name. While there, document -save-temps intermediates. gcc/fortran/ChangeLog: * invoke.texi: Add Developer Options section. Move '-fdump-*' to it. Add small examples about changed '-save-temps' behavior. Signed-off-by: Rimvydas Jasinskas --- gcc/fortran/invoke.texi | 117 ++-- 1 file changed, 77 insertions(+), 40 deletions(-) diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index c7fd019a7c5..6b85fb8dff0 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -94,12 +94,13 @@ one is not the default. compiled. * Preprocessing Options:: Enable and customize preprocessing. * Error and Warning Options:: How picky should the compiler be? -* Debugging Options:: Symbol tables, measurements, and debugging dumps. +* Debugging Options:: Symbol tables, measurements. * Directory Options:: Where to find module files * Link Options :: Influencing the linking step * Runtime Options:: Influencing runtime behavior * Code Gen Options::Specifying conventions for function calls, data layout and register usage. +* Developer Options:: Printing GNU Fortran specific info, debugging dumps. * Interoperability Options:: Options for interoperability with other languages. * Environment Variables:: Environment variables that affect @command{gfortran}. @@ -159,9 +160,8 @@ and warnings}. } @item Debugging Options -@xref{Debugging Options,,Options for debugging your program or GNU Fortran}. -@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original --fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} +@xref{Debugging Options,,Options for debugging your program}. +@gccoptlist{-fbacktrace -fdebug-aux-vars -ffpe-trap=@var{list} -ffpe-summary=@var{list} } @@ -201,6 +201,12 @@ and warnings}. -fpack-derived -frealloc-lhs -frecursive -frepack-arrays -fshort-enums -fstack-arrays } + +@item Developer Options +@xref{Developer Options,,GNU Fortran Developer Options}. +@gccoptlist{-fdump-fortran-global -fdump-fortran-optimized +-fdump-fortran-original -fdump-parse-tree -save-temps +} @end table @node Fortran Dialect Options @@ -1280,40 +1286,14 @@ 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 +@section Options for debugging your program @cindex options, debugging @cindex debugging information options GNU Fortran has various special options that are used for debugging -either your program or the GNU Fortran compiler. +your program. @table @gcctabopt -@opindex @code{fdump-fortran-original} -@item -fdump-fortran-original -Output the internal parse tree after translating the source program -into internal representation. This option is mostly useful for -debugging the GNU Fortran compiler itself. The output generated by -this option might change between releases. This option may also -generate internal compiler errors for features which have only -recently been added. - -@opindex @code{fdump-fortran-optimized} -@item -fdump-fortran-optimized -Output the parse tree after front-end optimization. Mostly useful for -debugging the GNU Fortran compiler itself. The output generated by -this option might change between releases. This option may also -generate internal compiler errors for features which have only -recently been added. - -@opindex @code{fdump-parse-tree} -@item -fdump-parse-tree -Output the internal parse tree after translating the source program -into internal representation. Mostly useful for debugging the GNU -Fortran compiler itself. The output generated by this option might -change between releases. This option may also generate internal -compiler errors for features which have only recently been added. This -option is deprecated; use @code{-fdump-fortran-original} instead. - @opindex @code{fdebug-aux-vars} @item -fdebug-aux-vars Renames internal variables created by the gfortran front end and makes @@ -1323,14 +1303,6 @@ useful for debugging the compiler's code generation together with @code{-fdump-tree-original} and enabling debugging of the executable program by using @code{-g} or @code{-ggdb3}. -@opindex @code{fdump-fortran-global} -@item -fdump-fortran-global -Output a list of the global identifiers after translating into -middle-end
Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
Am 20.12.23 um 05:32 schrieb Rimvydas Jasinskas: Dear all, In the spirit of c/c++ using the .i/.ii extensions for intermediates, use the .fi/.fii intermediate extensions for gfortran fixed/free form sources when -save-temps is invoked to avoid various issues. I checked with Jerry on Mattermost that there are no objections regarding the suffixes. Pushed: https://gcc.gnu.org/g:ba615557a4c698d27042a5fe058ea6e721a03b12 Thanks for the patch! The documentation part will be submitted separately, because it involves adding a "Developer options" mini-section (as suggested by Harald) and moving the -fdump-* options from "Options for debugging your program or GNU Fortran" section. Documentation improvements are always great! Regards, Rimvydas Cheers, Harald
Fortran: Use non conflicting file extensions for intermediates [PR81615]
Dear all, In the spirit of c/c++ using the .i/.ii extensions for intermediates, use the .fi/.fii intermediate extensions for gfortran fixed/free form sources when -save-temps is invoked to avoid various issues. The documentation part will be submitted separately, because it involves adding a "Developer options" mini-section (as suggested by Harald) and moving the -fdump-* options from "Options for debugging your program or GNU Fortran" section. Regards, Rimvydas From d313ccb110c5418260b667c5f289a249247de059 Mon Sep 17 00:00:00 2001 From: Rimvydas Jasinskas Date: Wed, 20 Dec 2023 03:39:33 +0000 Subject: Fortran: Use non conflicting file extensions for intermediates [PR81615] gcc/ChangeLog: * doc/invoke.texi: Document the new file extensions gcc/fortran/ChangeLog: PR fortran/81615 * lang-specs.h (F951_CPP_OPTIONS): Do not hardcode ".f90" extension (F951_CPP_EXTENSION): Use .fi/.fii for fixed/free form sources * options.cc (form_from_filename): Handle the new extensions Signed-off-by: Rimvydas Jasinskas --- gcc/doc/invoke.texi | 2 ++ gcc/fortran/lang-specs.h | 10 +- gcc/fortran/options.cc | 6 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 940adbce1bd..22313a86d9a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1591,6 +1591,7 @@ C++ header file to be turned into a precompiled header or Ada spec. @item @var{file}.f @itemx @var{file}.for @itemx @var{file}.ftn +@itemx @var{file}.fi Fixed form Fortran source code that should not be preprocessed. @item @var{file}.F @@ -1605,6 +1606,7 @@ preprocessor). @itemx @var{file}.f95 @itemx @var{file}.f03 @itemx @var{file}.f08 +@itemx @var{file}.fii Free form Fortran source code that should not be preprocessed. @item @var{file}.F90 diff --git a/gcc/fortran/lang-specs.h b/gcc/fortran/lang-specs.h index 7b298457613..5b1ea00cf0d 100644 --- a/gcc/fortran/lang-specs.h +++ b/gcc/fortran/lang-specs.h @@ -29,7 +29,8 @@ /* Options that f951 should know about, even if not preprocessing. */ #define CPP_FORWARD_OPTIONS "%{i*} %{I*} %{M*}" -#define F951_CPP_OPTIONS"%{!nocpp: -cpp=%g.f90 %{E} %(cpp_unique_options) \ +#define F951_CPP_OPTIONS"%{!nocpp: -cpp=%g" F951_CPP_EXTENSION \ + " %{E} %(cpp_unique_options) \ %{E|M|MM:%(cpp_debug_options) " CPP_ONLY_OPTIONS \ " -fsyntax-only};: " CPP_FORWARD_OPTIONS "}" @@ -44,6 +45,7 @@ #define F951_SOURCE_FORM"%{!ffree-form:-ffixed-form}" +#define F951_CPP_EXTENSION ".fi" {".F", "@f77-cpp-input", 0, 0, 0}, {".FOR", "@f77-cpp-input", 0, 0, 0}, {".FTN", "@f77-cpp-input", 0, 0, 0}, @@ -55,11 +57,15 @@ {".f", "@f77", 0, 0, 0}, {".for", "@f77", 0, 0, 0}, {".ftn", "@f77", 0, 0, 0}, +{".fi", "@f77", 0, 0, 0}, {"@f77", "f951 %i " F951_SOURCE_FORM " \ %{E:%{!cpp:%egfortran does not support -E without -cpp}} \ %{cpp:" F951_CPP_OPTIONS ";: " CPP_FORWARD_OPTIONS "} \ %{!E:" F951_OPTIONS "}", 0, 0, 0}, + +#undef F951_CPP_EXTENSION +#define F951_CPP_EXTENSION ".fii" {".F90", "@f95-cpp-input", 0, 0, 0}, {".F95", "@f95-cpp-input", 0, 0, 0}, {".F03", "@f95-cpp-input", 0, 0, 0}, @@ -70,6 +76,7 @@ {".f95", "@f95", 0, 0, 0}, {".f03", "@f95", 0, 0, 0}, {".f08", "@f95", 0, 0, 0}, +{".fii", "@f95", 0, 0, 0}, {"@f95", "f951 %i %{E:%{!cpp:%egfortran does not support -E without -cpp}}\ %{cpp:" F951_CPP_OPTIONS ";: " CPP_FORWARD_OPTIONS "} \ @@ -79,5 +86,6 @@ #undef CPP_ONLY_OPTIONS #undef CPP_FORWARD_OPTIONS #undef F951_SOURCE_FORM +#undef F951_CPP_EXTENSION #undef F951_CPP_OPTIONS #undef F951_OPTIONS diff --git a/gcc/fortran/options.cc b/gcc/fortran/options.cc index 02a29f83b58..53a6e8553bb 100644 --- a/gcc/fortran/options.cc +++ b/gcc/fortran/options.cc @@ -199,6 +199,12 @@ form_from_filename (const char *filename) ".f08", FORM_FREE} , { +".fii", FORM_FREE} +, +{ +".fi", FORM_FIXED} +, +{ ".f", FORM_FIXED} , { -- 2.43.0