[gcc r14-6758] Fortran: Use non conflicting file extensions for intermediates [PR81615]
Harald Anlauf
anlauf@gcc.gnu.org
Wed Dec 20 19:24:29 GMT 2023
https://gcc.gnu.org/g:ba615557a4c698d27042a5fe058ea6e721a03b12
commit r14-6758-gba615557a4c698d27042a5fe058ea6e721a03b12
Author: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
Date: Wed Dec 20 03:39:33 2023 +0000
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>
Diff:
---
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 5af978b0a67..d272b9228dd 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 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}
,
{
More information about the Gcc-cvs
mailing list