|
|
93e26d |
2018-11-23 Jakub Jelinek <jakub@redhat.com>
|
|
|
93e26d |
|
|
|
93e26d |
* lang.opt (fpad-source): New option.
|
|
|
93e26d |
* scanner.c (load_line): Don't pad fixed form lines if
|
|
|
93e26d |
!flag_pad_source.
|
|
|
93e26d |
* invoke.texi (-fno-pad-source): Document.
|
|
|
93e26d |
|
|
|
93e26d |
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
|
|
|
93e26d |
index 33afab1517f..d6a278b1cc2 100644
|
|
|
93e26d |
--- a/gcc/fortran/invoke.texi
|
|
|
93e26d |
+++ b/gcc/fortran/invoke.texi
|
|
|
93e26d |
@@ -121,7 +121,7 @@ by type. Explanations are in the following sections.
|
|
|
93e26d |
-fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math @gol
|
|
|
93e26d |
-fdec-include -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol
|
|
|
93e26d |
-fdefault-real-10 -fdefault-real-16 -fdollar-ok -ffixed-line-length-@var{n} @gol
|
|
|
93e26d |
--ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
|
|
|
93e26d |
+-ffixed-line-length-none -fpad-source -ffree-form -ffree-line-length-@var{n} @gol
|
|
|
93e26d |
-ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
|
|
|
93e26d |
-fmax-identifier-length -fmodule-private -ffixed-form -fno-range-check @gol
|
|
|
93e26d |
-fopenacc -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 @gol
|
|
|
93e26d |
@@ -321,8 +321,9 @@ declared as @code{PUBLIC}.
|
|
|
93e26d |
@opindex @code{ffixed-line-length-}@var{n}
|
|
|
93e26d |
@cindex file format, fixed
|
|
|
93e26d |
Set column after which characters are ignored in typical fixed-form
|
|
|
93e26d |
-lines in the source file, and through which spaces are assumed (as
|
|
|
93e26d |
-if padded to that length) after the ends of short fixed-form lines.
|
|
|
93e26d |
+lines in the source file, and, unless @code{-fno-pad-source}, through which
|
|
|
93e26d |
+spaces are assumed (as if padded to that length) after the ends of short
|
|
|
93e26d |
+fixed-form lines.
|
|
|
93e26d |
|
|
|
93e26d |
Popular values for @var{n} include 72 (the
|
|
|
93e26d |
standard and the default), 80 (card image), and 132 (corresponding
|
|
|
93e26d |
@@ -333,6 +334,15 @@ to them to fill out the line.
|
|
|
93e26d |
@option{-ffixed-line-length-0} means the same thing as
|
|
|
93e26d |
@option{-ffixed-line-length-none}.
|
|
|
93e26d |
|
|
|
93e26d |
+@item -fno-pad-source
|
|
|
93e26d |
+@opindex @code{fpad-source}
|
|
|
93e26d |
+By default fixed-form lines have spaces assumed (as if padded to that length)
|
|
|
93e26d |
+after the ends of short fixed-form lines. This is not done either if
|
|
|
93e26d |
+@option{-ffixed-line-length-0}, @option{-ffixed-line-length-none} or
|
|
|
93e26d |
+if @option{-fno-pad-source} option is used. With any of those options
|
|
|
93e26d |
+continued character constants never have implicit spaces appended
|
|
|
93e26d |
+to them to fill out the line.
|
|
|
93e26d |
+
|
|
|
93e26d |
@item -ffree-line-length-@var{n}
|
|
|
93e26d |
@opindex @code{ffree-line-length-}@var{n}
|
|
|
93e26d |
@cindex file format, free
|
|
|
93e26d |
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
|
|
|
93e26d |
index fe0c6934220..ae4957e176c 100644
|
|
|
93e26d |
--- a/gcc/fortran/lang.opt
|
|
|
93e26d |
+++ b/gcc/fortran/lang.opt
|
|
|
93e26d |
@@ -536,6 +536,10 @@ ffixed-line-length-
|
|
|
93e26d |
Fortran RejectNegative Joined UInteger Var(flag_fixed_line_length) Init(72)
|
|
|
93e26d |
-ffixed-line-length-<n> Use n as character line width in fixed mode.
|
|
|
93e26d |
|
|
|
93e26d |
+fpad-source
|
|
|
93e26d |
+Fortran Var(flag_pad_source) Init(1)
|
|
|
93e26d |
+Pad shorter fixed form lines to line width with spaces.
|
|
|
93e26d |
+
|
|
|
93e26d |
ffpe-trap=
|
|
|
93e26d |
Fortran RejectNegative JoinedOrMissing
|
|
|
93e26d |
-ffpe-trap=[...] Stop on following floating point exceptions.
|
|
|
93e26d |
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
|
|
|
93e26d |
index 5b27ab5e52d..2ef32b279fe 100644
|
|
|
93e26d |
--- a/gcc/fortran/scanner.c
|
|
|
93e26d |
+++ b/gcc/fortran/scanner.c
|
|
|
93e26d |
@@ -1924,6 +1924,7 @@ next_char:
|
|
|
93e26d |
/* Pad lines to the selected line length in fixed form. */
|
|
|
93e26d |
if (gfc_current_form == FORM_FIXED
|
|
|
93e26d |
&& flag_fixed_line_length != 0
|
|
|
93e26d |
+ && flag_pad_source
|
|
|
93e26d |
&& !preprocessor_flag
|
|
|
93e26d |
&& c != EOF)
|
|
|
93e26d |
{
|
|
|
93e26d |
diff --git a/gcc/testsuite/gfortran.dg/pad_source_1.f b/gcc/testsuite/gfortran.dg/pad_source_1.f
|
|
|
93e26d |
new file mode 100644
|
|
|
93e26d |
index 00000000000..a616bba60de
|
|
|
93e26d |
--- /dev/null
|
|
|
93e26d |
+++ b/gcc/testsuite/gfortran.dg/pad_source_1.f
|
|
|
93e26d |
@@ -0,0 +1,8 @@
|
|
|
93e26d |
+c { dg-do run }
|
|
|
93e26d |
+c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" "-f*pad-source" } }
|
|
|
93e26d |
+ character(80) a
|
|
|
93e26d |
+ a = 'abc
|
|
|
93e26d |
+ +def'
|
|
|
93e26d |
+ if (a(:61) .ne. 'abc') stop 1
|
|
|
93e26d |
+ if (a(62:) .ne. 'def') stop 2
|
|
|
93e26d |
+ end
|
|
|
93e26d |
diff --git a/gcc/testsuite/gfortran.dg/pad_source_2.f b/gcc/testsuite/gfortran.dg/pad_source_2.f
|
|
|
93e26d |
new file mode 100644
|
|
|
93e26d |
index 00000000000..bcf9439cd14
|
|
|
93e26d |
--- /dev/null
|
|
|
93e26d |
+++ b/gcc/testsuite/gfortran.dg/pad_source_2.f
|
|
|
93e26d |
@@ -0,0 +1,9 @@
|
|
|
93e26d |
+c { dg-do run }
|
|
|
93e26d |
+c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" } }
|
|
|
93e26d |
+c { dg-options "-fpad-source" }
|
|
|
93e26d |
+ character(80) a
|
|
|
93e26d |
+ a = 'abc
|
|
|
93e26d |
+ +def'
|
|
|
93e26d |
+ if (a(:61) .ne. 'abc') stop 1
|
|
|
93e26d |
+ if (a(62:) .ne. 'def') stop 2
|
|
|
93e26d |
+ end
|
|
|
93e26d |
diff --git a/gcc/testsuite/gfortran.dg/pad_source_3.f b/gcc/testsuite/gfortran.dg/pad_source_3.f
|
|
|
93e26d |
new file mode 100644
|
|
|
93e26d |
index 00000000000..8fbdae0d67d
|
|
|
93e26d |
--- /dev/null
|
|
|
93e26d |
+++ b/gcc/testsuite/gfortran.dg/pad_source_3.f
|
|
|
93e26d |
@@ -0,0 +1,8 @@
|
|
|
93e26d |
+c { dg-do run }
|
|
|
93e26d |
+c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" } }
|
|
|
93e26d |
+c { dg-options "-fno-pad-source" }
|
|
|
93e26d |
+ character(80) a
|
|
|
93e26d |
+ a = 'abc
|
|
|
93e26d |
+ +def'
|
|
|
93e26d |
+ if (a .ne. 'abcdef') stop 1
|
|
|
93e26d |
+ end
|
|
|
93e26d |
diff --git a/gcc/testsuite/gfortran.dg/pad_source_4.f b/gcc/testsuite/gfortran.dg/pad_source_4.f
|
|
|
93e26d |
new file mode 100644
|
|
|
93e26d |
index 00000000000..5479cec217a
|
|
|
93e26d |
--- /dev/null
|
|
|
93e26d |
+++ b/gcc/testsuite/gfortran.dg/pad_source_4.f
|
|
|
93e26d |
@@ -0,0 +1,7 @@
|
|
|
93e26d |
+c { dg-do run }
|
|
|
93e26d |
+c { dg-options "-ffixed-line-length-none" }
|
|
|
93e26d |
+ character(80) a
|
|
|
93e26d |
+ a = 'abc
|
|
|
93e26d |
+ +def'
|
|
|
93e26d |
+ if (a .ne. 'abcdef') stop 1
|
|
|
93e26d |
+ end
|
|
|
93e26d |
diff --git a/gcc/testsuite/gfortran.dg/pad_source_5.f b/gcc/testsuite/gfortran.dg/pad_source_5.f
|
|
|
93e26d |
new file mode 100644
|
|
|
93e26d |
index 00000000000..4122c85ba66
|
|
|
93e26d |
--- /dev/null
|
|
|
93e26d |
+++ b/gcc/testsuite/gfortran.dg/pad_source_5.f
|
|
|
93e26d |
@@ -0,0 +1,7 @@
|
|
|
93e26d |
+c { dg-do run }
|
|
|
93e26d |
+c { dg-options "-ffixed-line-length-0" }
|
|
|
93e26d |
+ character(80) a
|
|
|
93e26d |
+ a = 'abc
|
|
|
93e26d |
+ +def'
|
|
|
93e26d |
+ if (a .ne. 'abcdef') stop 1
|
|
|
93e26d |
+ end
|