From f03d260a86a7e2e5cfa00e825cfd3db95ceffcc0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Nov 2018 01:11:11 +0100 Subject: lang.opt (fpad-source): New option. * lang.opt (fpad-source): New option. * scanner.c (load_line): Don't pad fixed form lines if !flag_pad_source. * invoke.texi (-fno-pad-source): Document. * gfortran.dg/pad_source_1.f: New test. * gfortran.dg/pad_source_2.f: New test. * gfortran.dg/pad_source_3.f: New test. * gfortran.dg/pad_source_4.f: New test. * gfortran.dg/pad_source_5.f: New test. From-SVN: r266397 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/invoke.texi | 16 +++++++++++++--- gcc/fortran/lang.opt | 4 ++++ gcc/fortran/scanner.c | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5e6c8d3..6f29472 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-11-23 Jakub Jelinek + + * lang.opt (fpad-source): New option. + * scanner.c (load_line): Don't pad fixed form lines if + !flag_pad_source. + * invoke.texi (-fno-pad-source): Document. + 2018-11-21 Jakub Jelinek * invoke.texi (-fdec-include): Document. diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 33afab1..d6a278b 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -121,7 +121,7 @@ by type. Explanations are in the following sections. -fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math @gol -fdec-include -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol -fdefault-real-10 -fdefault-real-16 -fdollar-ok -ffixed-line-length-@var{n} @gol --ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol +-ffixed-line-length-none -fpad-source -ffree-form -ffree-line-length-@var{n} @gol -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol -fmax-identifier-length -fmodule-private -ffixed-form -fno-range-check @gol -fopenacc -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 @gol @@ -321,8 +321,9 @@ declared as @code{PUBLIC}. @opindex @code{ffixed-line-length-}@var{n} @cindex file format, fixed Set column after which characters are ignored in typical fixed-form -lines in the source file, and through which spaces are assumed (as -if padded to that length) after the ends of short fixed-form lines. +lines in the source file, and, unless @code{-fno-pad-source}, through which +spaces are assumed (as if padded to that length) after the ends of short +fixed-form lines. Popular values for @var{n} include 72 (the standard and the default), 80 (card image), and 132 (corresponding @@ -333,6 +334,15 @@ to them to fill out the line. @option{-ffixed-line-length-0} means the same thing as @option{-ffixed-line-length-none}. +@item -fno-pad-source +@opindex @code{fpad-source} +By default fixed-form lines have spaces assumed (as if padded to that length) +after the ends of short fixed-form lines. This is not done either if +@option{-ffixed-line-length-0}, @option{-ffixed-line-length-none} or +if @option{-fno-pad-source} option is used. With any of those options +continued character constants never have implicit spaces appended +to them to fill out the line. + @item -ffree-line-length-@var{n} @opindex @code{ffree-line-length-}@var{n} @cindex file format, free diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index fe0c693..ae4957e 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -536,6 +536,10 @@ ffixed-line-length- Fortran RejectNegative Joined UInteger Var(flag_fixed_line_length) Init(72) -ffixed-line-length- Use n as character line width in fixed mode. +fpad-source +Fortran Var(flag_pad_source) Init(1) +Pad shorter fixed form lines to line width with spaces. + ffpe-trap= Fortran RejectNegative JoinedOrMissing -ffpe-trap=[...] Stop on following floating point exceptions. diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 5b27ab5..2ef32b2 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1924,6 +1924,7 @@ next_char: /* Pad lines to the selected line length in fixed form. */ if (gfc_current_form == FORM_FIXED && flag_fixed_line_length != 0 + && flag_pad_source && !preprocessor_flag && c != EOF) { -- cgit v1.1