summaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-30 23:57:44 +0000
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-30 23:57:44 +0000
commit8301615623327972c6ad5dd1b14ec3d959381d4f (patch)
tree2c79d3d03822356a4f0ab0c7c7b6c42b8f03862a /gcc/fortran/scanner.c
parent3d37b978e5c46b41d7046d0b31ce81ca6c4b42eb (diff)
downloadgcc-8301615623327972c6ad5dd1b14ec3d959381d4f.tar.gz
2005-11-30 Bernhard Fischer <rep.nop@aon.at>
PR fortran/21302 * lang.opt: New options -ffree-line-length- and -ffree-line-length-none. * gfortran.h: Add free_line_length and add description of free_line_length and fixed_line_length. * options.c (gfc_init_options, gfc_handle_option): Initialize and set free_line_length and fixed_line_length. * scanner.c (load_line): Set free_line_length to 132 and fixed_line_length to 72 or user requested values. * scanner.c: Typo in comment. * invoke.texi: Document -ffree-line-length- and -ffree-line-length-none gfortran.dg/line_length_1.f: New test: gfortran.dg/line_length_2.f90: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107745 138bc75d-0d04-0410-961f-82ee72b054a4
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 883576166ff..4b76f9c73e9 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);