aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r--gcc/fortran/scanner.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 8835761..4b76f9c 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -694,7 +694,7 @@ gfc_gobble_whitespace (void)
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)
@@ -703,11 +703,25 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
int trunc_flag = 0;
char *buffer;
- /* Determine the maximum allowed line length. */
+ /* Determine the maximum allowed line length.
+ The default for free-form is GFC_MAX_LINE, for fixed-form or for
+ unknown form it is 72. Refer to the documentation in gfc_option_t. */
if (gfc_current_form == FORM_FREE)
- maxlen = GFC_MAX_LINE;
+ {
+ if (gfc_option.free_line_length == -1)
+ maxlen = GFC_MAX_LINE;
+ else
+ maxlen = gfc_option.free_line_length;
+ }
+ else if (gfc_current_form == FORM_FIXED)
+ {
+ if (gfc_option.fixed_line_length == -1)
+ maxlen = 72;
+ else
+ maxlen = gfc_option.fixed_line_length;
+ }
else
- maxlen = gfc_option.fixed_line_length;
+ maxlen = 72;
if (*pbuf == NULL)
{
@@ -778,7 +792,7 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
}
}
else if (i >= maxlen)
- {
+ {
/* Truncate the rest of the line. */
for (;;)
{
@@ -1055,7 +1069,7 @@ load_file (const char *filename, bool initial)
line = NULL;
line_len = 0;
- for (;;)
+ for (;;)
{
int trunc = load_line (input, &line, &line_len);