[Patch, libfortran, 2nd version] PR 48618 - Negative unit number in OPEN(...) is sometimes allowed

Tobias Burnus burnus@net-b.de
Thu Mar 7 11:46:00 GMT 2013


Hi,

Tilo Schwarz wrote:
> this patch fixes PR 48618.
> Built and regtested on Linux 3.2.0-4-686-pae.

Thanks for the patch, which mostly looks okay.

A few remarks:

* Do not create a diff of the ChangeLog but include it separately at the 
top of the patch. Reason: It's easier to read and if another patch has 
been applied before, your patch won't apply.

* A ChangeLog for the testcase is missing.


* Coding style: If 8 spaces have accumulated, replace them by one tab, i.e.
-      u = find_or_create_unit (opp->common.unit);
+      if (u == NULL)
+        u = find_or_create_unit (opp->common.unit);

Here, the last line should use a "tab". (The other important rule is to 
have maximally 80 character per source line.)

See also http://gcc.gnu.org/wiki/FormattingCodeForGCC

(Consistent coding styles makes it easier to read the code. The style 
might not always the best or to the personal taste, but still 
consistency helps. For instance, function names always start in column 1 
and have a " " before the "(". Hence, one can do "grep '^funcname ' *.c 
to find the function.)



* Comment style:
+      if (u == NULL) /* negative unit and no unit found */
+        generate_error (&opp->common, LIBERROR_BAD_OPTION,
+                        "Bad unit number in OPEN statement");
+      /* check for previous error, otherwise unit won't be unlocked 
later */

To quote the comment style from 
http://www.gnu.org/prep/standards/html_node/Comments.html:

"Please put two spaces after the end of a sentence in your comments, so 
that the Emacs sentence commands will work. Also, please write complete 
sentences and capitalize the first word. If a lower-case identifier 
comes at the beginning of a sentence, donÂ’t capitalize it! Changing the 
spelling makes it a different identifier. If you donÂ’t like starting a 
sentence with a lower case letter, write the sentence differently (e.g., 
“The identifier lower-case is …”)."

(The existing code does not always follow the style, but one should at 
least try, even if there is some leeway ;-)


* Regarding your patch itself. I think it is easier to read if one moves 
the code a bit further down as I did in the attachment. What do you think?


* Copyright assignment: You mentioned that you have emailed(§) the form 
back to the FSF. Was this the actual copyright-assignment form which the 
FSF sent to you by mail? Or was it 'only' request form? Can you tell us, 
when the FSF has acknowledged the arrival of the copyright assignment?


Tobias


(§) Side note: The FSF now also allows to send the copyright form back 
by FAX or (scanned) by email, but only if you are residing in the USA or 
in Germany. Residents of other countries still have to return it by 
(air,surface) mail. Cf. 
http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: open.diff
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130307/c43cc1a7/attachment.bin>


More information about the Fortran mailing list