diff options
author | Bernhard Fischer <rep.nop@aon.at> | 2005-12-01 00:57:44 +0100 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-11-30 23:57:44 +0000 |
commit | 16ab8e74dad98cca30b431ae68b3926fe897aab4 (patch) | |
tree | 2c79d3d03822356a4f0ab0c7c7b6c42b8f03862a /gcc/fortran/scanner.c | |
parent | 4b860192e48ff466dc4975c9212e61e621fdb103 (diff) | |
download | gcc-16ab8e74dad98cca30b431ae68b3926fe897aab4.zip gcc-16ab8e74dad98cca30b431ae68b3926fe897aab4.tar.gz gcc-16ab8e74dad98cca30b431ae68b3926fe897aab4.tar.bz2 |
re PR fortran/21302 (Max line length in free form mode)
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.
From-SVN: r107745
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r-- | gcc/fortran/scanner.c | 26 |
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); |