This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: fortran at gcc dot gnu dot org, patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 11 Jul 2004 20:41:13 +0200
- Subject: Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
- References: <40F132B3.5000506@physik.uni-muenchen.de> <200407111349.57083.paul@codesourcery.com>
Paul Brook wrote:
> The documentation (fortran/invoke.texi) implies that any value is allowed, so
> either the code or the documentation needs fixing.
Done as below. There is a difference from g77: g77 pads strings on
continued lines, i.e.
t = "STRING
1TEST"
will let t have a bunch of spaces between "STRING" and "TEST". We don't
do this, but since we never did, and noone complained, I guess that's no
issue.
>
> g77 supports arbitary lengths, so we probably should too.
If someone complains, I will.
>
> You might want to fix -ffixed-line-length-none at the same time:)
Done. Modulo the arbitrary linelengths :-)
Built on i686-pc-linux, I also checked that the new options work.
- Tobi
Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/invoke.texi,v
retrieving revision 1.4
diff -u -p -r1.4 invoke.texi
--- invoke.texi 4 Jul 2004 09:01:40 -0000 1.4
+++ invoke.texi 11 Jul 2004 18:35:23 -0000
@@ -191,26 +191,25 @@ older Fortran programs.
@cindex character set
Allow @samp{$} as a valid character in a symbol name.
-@cindex -ffixed-line-length-@var{n} option
-@cindex options, -ffixed-line-length-@var{n}
-@item -ffixed-line-length-@var{n}
+@cindex -ffixed-line-length-none option
+@cindex options, -ffixed-line-length-none
+@item -ffixed-line-length-none
@cindex source file format
@cindex lines, length
@cindex length of source lines
@cindex fixed form
@cindex limits, lengths of source lines
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 to the maximum value supported by
+@command{gfortran}, which by default is 132.
@cindex card image
@cindex extended-source option
Popular values for @var{n} include 72 (the
standard and the default), 80 (card image), and 132 (corresponds
to ``extended-source'' options in some popular compilers).
-@var{n} may be @samp{none}, meaning that the entire line is meaningful
-and that continued character constants never have implicit spaces appended
-to them to fill out the line.
+@var{n} may be @samp{none}, meaning the maximum value will be
+assumed. This value is a build-time constant and defaults to 132.
@option{-ffixed-line-length-0} means the same thing as
@option{-ffixed-line-length-none}.
Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/lang.opt,v
retrieving revision 1.6
diff -u -p -r1.6 lang.opt
--- lang.opt 11 Jul 2004 16:55:00 -0000 1.6
+++ lang.opt 11 Jul 2004 18:35:23 -0000
@@ -97,13 +97,13 @@ fimplicit-none
F95
Specify that no implicit typing is allowed, unless overridden by
explicit IMPLICIT statements
-ffixed-line-length-80
+ffixed-line-length-none
F95 RejectNegative
-Use 80 character line width in fixed mode
+Use maximum supported character line width in fixed mode
-ffixed-line-length-132
-F95 RejectNegative
-Use 132 character line width in fixed mode
+ffixed-line-length-
+F95 RejectNegative Joined UInteger
+-ffixed-line-length-<n> Use n as character line width in
fixed mode
fmax-identifier-length=
F95 RejectNegative Joined UInteger
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.7
diff -u -p -r1.7 options.c
--- options.c 11 Jul 2004 16:55:00 -0000 1.7
+++ options.c 11 Jul 2004 18:35:23 -0000
@@ -260,12 +260,17 @@ gfc_handle_option (size_t scode, const c
gfc_option.flag_repack_arrays = value;
break;
- case OPT_ffixed_line_length_80:
- gfc_option.fixed_line_length = 80;
- break;
-
- case OPT_ffixed_line_length_132:
- gfc_option.fixed_line_length = 132;
+ case OPT_ffixed_line_length_none:
+ value = GFC_MAX_LINE;
+ /* Fall through ... */
+
+ case OPT_ffixed_line_length_:
+ if (value == 0)
+ value = GFC_MAX_LINE;
+ if (value > GFC_MAX_LINE)
+ gfc_fatal_error ("Maximum supported line length is %d",
+ GFC_MAX_LINE);
+ gfc_option.fixed_line_length = value;
break;
case OPT_fmax_identifier_length_: