[RFC][PATCH] -d_lines

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Aug 17 09:38:00 GMT 2005


On Wed, Aug 17, 2005 at 01:21:45AM +0200, Bernhard Fischer wrote:
> 
> Several "ancient" fortran programs do exercise -- as well as most
> commercial compilers do support -- a variant of fixed-mode where 'D'
> resp. 'd' in the first column of source is either treated as comment --
> per default -- or as code -- if the compiler sees an argument akin to
> -d_lines.
> 
> gfortran is, ATM, not able to deal with those, however.
> 
> Attached patch and testcase 1) are a Request For Comments to implement
> an option -d_lines to deal with such codes proper.
> 
> I'd be glad for reviewers/testers/committers for this case.
> 
> 
> 1) i didn't install dejagnu so far, so please bear with me for now..
> 
> PS: Changelog inlined in the patchlet; is this ok or should it be kept
> in the accompagning mail body?
> 

ChangeLog should be in the accompanying email.

As to my comments.

(1) -d_lines is not expressed in the GNU standard for options.
    It should be -fd_lines.

(2) I've never seen this convention in the 20 years that I've
    been reading and writing Fortran code.  It looks like a
    cute trick to avoid the use of a preprocessor (cpp, fpp,
    or sed).   IMHO, this type of option does not belong in
    gfortran, but I guess I'll accept it if the majority of
    users want it.

>      case OPT_fdefault_double_8:
>        gfc_option.flag_default_double = value;
> +      break;
> +
> +    case OPT_d_lines:
> +      gfc_option.d_lines = value;
>        break;

This should be placed in lexicographic order.

> +      if (c == 'D' || c == 'd')
> +	{
> +	  if  (!gfc_option.d_lines)
> +	    {
> +	      /* d_lines is not set, line is a comment.  */
> +	      skip_comment_line ();
> +	      continue;
> +	    }
> +	  else
> +	    /* d_lines is set, treat line as code and eat the identifier.  */
> +	    *start.nextc++;
> +	}

I agree with Brook that this might screw up the locus for
error reporting.  Have you read over the code that expands
a tab in column 1 to 6 spaces.

-- 
Steve



More information about the Fortran mailing list