public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fortran: Use non conflicting file extensions for intermediates [PR81615]
@ 2023-12-20  4:32 Rimvydas Jasinskas
  2023-12-20 19:29 ` Harald Anlauf
  0 siblings, 1 reply; 13+ messages in thread
From: Rimvydas Jasinskas @ 2023-12-20  4:32 UTC (permalink / raw)
  To: Rimvydas Jasinskas via Fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

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

[-- Attachment #2: 0001-Fortran-Use-non-conflicting-file-extensions-for-inte.patch --]
[-- Type: text/x-patch, Size: 3610 bytes --]

From d313ccb110c5418260b667c5f289a249247de059 Mon Sep 17 00:00:00 2001
From: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
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 <rimvydas.jas@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-01 21:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  4:32 Fortran: Use non conflicting file extensions for intermediates [PR81615] Rimvydas Jasinskas
2023-12-20 19:29 ` Harald Anlauf
2023-12-20 19:29   ` Harald Anlauf
2023-12-24  1:33   ` Rimvydas Jasinskas
2023-12-27 20:34     ` Harald Anlauf
2023-12-27 20:34       ` Harald Anlauf
2023-12-28  7:09       ` Rimvydas Jasinskas
2023-12-28 20:31         ` Harald Anlauf
2023-12-28 20:31           ` Harald Anlauf
2023-12-30 11:01     ` Thomas Koenig
2023-12-30 11:08       ` Thomas Koenig
2024-01-01 21:25         ` Harald Anlauf
2024-01-01 21:25           ` Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).