public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [patch] pr 21302 Max line length in free form mode
@ 2005-08-08 7:22 Bernhard Fischer
2005-08-08 21:14 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Fischer @ 2005-08-08 7:22 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches, gcc-bugs
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
Hi,
Attached proposed patch would close pr 21302 for me.
Is reusing -ffixed-line-length instead of introducing a new
-fline-length ok?
If it isn't, should -ffixed-line-length be renamed to -fline-length
and -ffixed-line-length be an alias for the new -fline-length?
thank you,
Bernhard
[-- Attachment #2: pr21302.diff --]
[-- Type: text/plain, Size: 1098 bytes --]
Index: gcc/fortran/scanner.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.22
diff -u -r1.22 scanner.c
--- gcc/fortran/scanner.c 14 Jul 2005 07:14:37 -0000 1.22
+++ gcc/fortran/scanner.c 4 Aug 2005 17:58:42 -0000
@@ -680,7 +680,7 @@
In fixed mode, we expand a tab that occurs within the statement
label region to expand to spaces that leave the next character in
the source region.
- load_line returns wether the line was truncated. */
+ load_line returns whether the line was truncated. */
static int
load_line (FILE * input, char **pbuf, int *pbuflen)
@@ -690,9 +690,12 @@
char *buffer;
/* Determine the maximum allowed line length. */
- if (gfc_current_form == FORM_FREE)
- maxlen = GFC_MAX_LINE;
- else
+ if (gfc_current_form == FORM_FREE) {
+ if (gfc_option.fixed_line_length == 72) /* default */
+ maxlen = GFC_MAX_LINE;
+ else
+ maxlen = gfc_option.fixed_line_length;
+ } else
maxlen = gfc_option.fixed_line_length;
if (*pbuf == NULL)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] pr 21302 Max line length in free form mode
2005-08-08 7:22 [patch] pr 21302 Max line length in free form mode Bernhard Fischer
@ 2005-08-08 21:14 ` Steve Kargl
2005-08-10 15:35 ` Bernhard Fischer
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2005-08-08 21:14 UTC (permalink / raw)
To: Bernhard Fischer; +Cc: fortran, gcc-patches, gcc-bugs
On Mon, Aug 08, 2005 at 09:23:07AM +0200, Bernhard Fischer wrote:
> /* Determine the maximum allowed line length. */
> - if (gfc_current_form == FORM_FREE)
> - maxlen = GFC_MAX_LINE;
> - else
> + if (gfc_current_form == FORM_FREE) {
> + if (gfc_option.fixed_line_length == 72) /* default */
> + maxlen = GFC_MAX_LINE;
> + else
> + maxlen = gfc_option.fixed_line_length;
> + } else
> maxlen = gfc_option.fixed_line_length;
Unless I misunderstand the above, the following
gfortran -ffixed_line_length=72 test.f90
will use GFC_MAX_LINE, which is 132 (not the requested
length of 72).
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] pr 21302 Max line length in free form mode
2005-08-08 21:14 ` Steve Kargl
@ 2005-08-10 15:35 ` Bernhard Fischer
0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Fischer @ 2005-08-10 15:35 UTC (permalink / raw)
To: Steve Kargl; +Cc: fortran, gcc-patches, gcc-bugs
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
On Mon, Aug 08, 2005 at 02:14:42PM -0700, Steve Kargl wrote:
>On Mon, Aug 08, 2005 at 09:23:07AM +0200, Bernhard Fischer wrote:
>> + if (gfc_option.fixed_line_length == 72) /* default */
>> + maxlen = GFC_MAX_LINE;
>Unless I misunderstand the above, the following
>
> gfortran -ffixed_line_length=72 test.f90
>
>will use GFC_MAX_LINE, which is 132 (not the requested
>length of 72).
right. Corrected patch attached.
gcc-line-length.diff:
PR 21302
* gcc/fortran/options.c: initialize fixed_line_length to -1.
* gcc/fortran/scanner.c (load_line): default fixed_line_length
to GFC_MAX_LINE for FORM_FREE else default to 72. If a line
length was given, use it.
Perhaps also check that the line-length given is not too big?
Something like
gcc-line-length-max.diff:
* gcc/fortran/options.c: make sure that -ffixed-line-length
is less than 1048577.
ok?
--
Bernhard
[-- Attachment #2: gcc-line-length.diff --]
[-- Type: text/plain, Size: 1369 bytes --]
Index: gcc/fortran/options.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.22
diff -u -p -r1.22 options.c
--- gcc/fortran/options.c 25 Jun 2005 00:40:35 -0000 1.22
+++ gcc/fortran/options.c 10 Aug 2005 13:20:22 -0000
@@ -45,7 +45,7 @@ gfc_init_options (unsigned int argc ATTR
gfc_option.source = NULL;
gfc_option.module_dir = NULL;
gfc_option.source_form = FORM_UNKNOWN;
- gfc_option.fixed_line_length = 72;
+ gfc_option.fixed_line_length = -1;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
gfc_option.verbose = 0;
Index: gcc/fortran/scanner.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.23
diff -u -p -r1.23 scanner.c
--- gcc/fortran/scanner.c 9 Aug 2005 08:08:28 -0000 1.23
+++ gcc/fortran/scanner.c 10 Aug 2005 13:20:22 -0000
@@ -690,8 +690,11 @@ load_line (FILE * input, char **pbuf, in
char *buffer;
/* Determine the maximum allowed line length. */
- if (gfc_current_form == FORM_FREE)
- maxlen = GFC_MAX_LINE;
+ if (gfc_option.fixed_line_length == -1)
+ if (gfc_current_form == FORM_FREE)
+ maxlen = GFC_MAX_LINE;
+ else
+ maxlen = 72; /* GFC_DEFAULT_LINE */
else
maxlen = gfc_option.fixed_line_length;
[-- Attachment #3: gcc-line-length-max.diff --]
[-- Type: text/plain, Size: 673 bytes --]
Index: gcc/fortran/options.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.22
diff -u -p -r1.22 options.c
--- gcc/fortran/options.c 25 Jun 2005 00:40:35 -0000 1.22
+++ gcc/fortran/options.c 10 Aug 2005 14:51:53 -0000
@@ -289,6 +289,9 @@ gfc_handle_option (size_t scode, const c
case OPT_ffixed_line_length_:
if (value != 0 && value < 7)
gfc_fatal_error ("Fixed line length must be at least seven.");
+ else
+ if (value > 1048576)
+ gfc_fatal_error ("Fixed line length must be at most 1048576.");
gfc_option.fixed_line_length = value;
break;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-10 15:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-08 7:22 [patch] pr 21302 Max line length in free form mode Bernhard Fischer
2005-08-08 21:14 ` Steve Kargl
2005-08-10 15:35 ` Bernhard Fischer
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).