diff options
author | Rimvydas Jasinskas <rimvydas.jas@gmail.com> | 2023-12-20 03:39:33 +0000 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2023-12-20 20:22:54 +0100 |
commit | ba615557a4c698d27042a5fe058ea6e721a03b12 (patch) | |
tree | 934ae1b516dc2f221351cf36f270c8789b81a398 | |
parent | 08ab2293dcce442e139b163ba22f65a32e7ebd6c (diff) | |
download | gcc-ba615557a4c698d27042a5fe058ea6e721a03b12.zip gcc-ba615557a4c698d27042a5fe058ea6e721a03b12.tar.gz gcc-ba615557a4c698d27042a5fe058ea6e721a03b12.tar.bz2 |
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 <rimvydas.jas@gmail.com>
-rw-r--r-- | gcc/doc/invoke.texi | 2 | ||||
-rw-r--r-- | gcc/fortran/lang-specs.h | 10 | ||||
-rw-r--r-- | gcc/fortran/options.cc | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5af978b..d272b92 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1592,6 +1592,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 @@ -1606,6 +1607,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 7b29845..5b1ea00 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 02a29f8..53a6e85 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} , { |