This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH] -d_lines


(apologies again ...)

:ADDPATCH fortran:

Here's a patch updated to the suggestions various people have made.  Now there
are two options -fd-lines-as-code and -fd-lines-as-comment (could a native
speaker tell me whether -fd-lines-as-comments would be preferable?  I'm also
open to other suggestions.)  I've not incorporated Steve's patch yet, but will
do so before committing, I simply didn't think of it before I had scp'ed the
patch to my office machine and started the build.

Bernhard Fischer wrote:
>>+@cindex option, -fd-lines
>>+@cindex -fd-lines, option
>>+@item -fd-lines
>>+Enables debug lines in fixed form sources.  Debug lines are lines with
>>+a @samp{D} in column 1.  If this option is not given or if
>>+@option{-fno-d-lines} is given, they are treated as comments.
>
>
> According to 2c above, the description for 'option not given' is not
> correct. As earlier noted by someone else, please add the lowercase d.

Indeed, I had only put that in as filler before I decided on the semantics, but
then didn't go bak to updating this.

>>-fdollar-ok
>>+fd-lines
>>F95
>>-Allow dollar signs in entity names
>>+Don't interpret lines with 'D' in column zero as comments in fixed form
>
>
> Do columns in text files start with 0 or 1, from a user perspective?

Same here, should have been column 1.

>>      col = 1;
>>+
>>+      if (c == 'd' || c == 'D')
>>+	{
>>+	  if (gfc_option.flag_d_lines == 0)
>>+	    {
>>+	      skip_comment_line ();
>>+	      continue;
>>+	    }
>>+	  else if (gfc_option.flag_d_lines == 1)
>>+	    {
>>+	      *start.nextc = ' ';
>>+	      col = 2;
>>+	    }
>>+	  else
>>+	    {
>>+	      /* Let the syntax error be caught elsewhere.  */
>>+	      gfc_current_locus = start;
>>+	      col = 1;
>
> Looks like col should already be 1 here.

Yes, I had wanted to only set col inside the if, but for some reason gcc's
optimizers decided that the variable might be used uninitialized that way, and
then forgot about the superfluous col = 1.

> I'll try your patch tomorrow to see why you need this whole else block
> at all.

Thanks.  The if block is there to do the right thing in all three possible
cases: treat as comment, replace 'd' by blank, ignore.

Bootstrapped and tested on i686-pc-linux.  Ok?

- Tobi

2005-08-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
fortran/
	* gfortran.h (gfc_option_t): Remove source field.  Add
	flag_d_lines field.
	(gfc_new_file): Remove arguments in prototype.
	* f95-lang.c (gfc_init): Use gfc_source_file instead of
	gfc_option.source.  Call gfc_new_file without arguments.
	* invoke.texi: Document new options '-fd-lines-as-code' and
	'-fd-lines-as-comment'.
	* lang.opt: Add new options.  Alphabetize.
	* options.c (gfc_init_options): Initialize gfc_source_file instead
	of gfc_option.source.  Initialize gfc_option.flag_d_lines.
	(form_from_filename): Move here from scanner.c
	(gfc_post_options): Set gfc_source_file.  Determine source form.
	Warn if 'd-lines*' are used in free form.
	* scanner.c (skip_fixed_comments): Deal with d-lines.
	(form_from_filename): Moved to options.c.
	(gfc_new_file): Remove arguments.  Don't initialize
	gfc_source_file, don't determine source form.
	* trans-const.c (gfc_init_constants): Use gfc_source_file instead
	of gfc_option.source.

testsuite/
	* d_lines_1.f, d_lines_2.f, d_lines_3.f, d_lines_4.f: New.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]