This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: fortran-experiments: patch for more error checking


hello all,

i've attached an updated patch.  it fixes the comments made below by
Bernhard and i also converted my javadoc style comment blocks to GNU
style.  finally, i put the function return types and names on separate
lines.  most of this patch is whitespace/commenting style fixes, but it
also includes the error checks that i added in the previous patch
mentioned below.

next, i'll work on converting the commenting style, etc., for the iso_c_*
files for libgfortran.

ChangeLog.isocbinding entry:

2007-01-21  Christoper D. Rickett  <crickett@lanl.gov>
	* gcc/fortran/symbol.c: Removed javadoc style comment blocks and
	converted to GNU style.  Also, put the function type and name on
	separate lines.  Removed commented out return in
	verify_bind_c_derived_type.
	* gcc/fortran/decl.c: Converted javadoc to GNU style for functions
	and put the function return type and name on separate lines.
	* gcc/fortran/trans-types.c: Ditto on commenting style.
	* gcc/fortran/resolve.c: Ditto on commenting style.  Also,
	combined two if statements in gfc_iso_c_sub_interface.
	* gcc/fortran/match.c: Ditto on commenting style.
	* gcc/fortran/trans-decl.c: Ditto on commenting style.
	* gcc/fortran/misc.c: Ditto on commenting style.

bootstrapped and regtested on x86 with no new failures.  thanks.
Chris

> i'll fix these and submit another patch.  the next patch will also include
> whitespace and commenting fixes.
>
> thanks for the feedback.
> Chris
>
>> On Sat, Jan 20, 2007 at 04:18:29PM -0700, Christopher D. Rickett wrote:
>>>hello all,
>>>
>>>i've attached a patch for the following:
>>>
>>>- more error checking on BIND(C) variables
>>>- error checking on the second arg of C_F_POINTER
>>>- 2 new test cases
>>
>> Below just cosmetic nitpicks ..
>>
>>>Index: gcc/fortran/symbol.c
>>>===================================================================
>>>--- gcc/fortran/symbol.c	(revision 121011)
>>>+++ gcc/fortran/symbol.c	(working copy)
>>>@@ -2909,6 +2909,18 @@ try verify_bind_c_derived_type (gfc_symb
>>>     gfc_internal_error("verify_bind_c_derived_type(): Given symbol is "
>>> 		       "unexpectedly NULL");
>>>
>>>+  /* The derived type must have the BIND attribute to be interoperable
>>>+     J3/04-007, Section 15.2.3. */
>>>+  if (derived_sym->attr.is_bind_c != 1)
>>>+    {
>>>+      derived_sym->ts.is_c_interop = 0;
>>>+      gfc_error ("Derived type '%s' declared at %L must have the BIND "
>>>+                 "attribute to be C interoperable", derived_sym->name,
>>>+                 &(derived_sym->declared_at));
>>>+/*       return FAILURE; */
>>
>> /* remove? */
>>
>>>+      retval = FAILURE;
>>>+    }
>>>+
>>>   curr_comp = derived_sym->components;
>>>   /* is this really an error??	 --Rickett, 10.24.05 */
>>>   if (curr_comp == NULL)
>>>Index: gcc/fortran/resolve.c
>>>===================================================================
>>>--- gcc/fortran/resolve.c	(revision 121011)
>>>+++ gcc/fortran/resolve.c	(working copy)
>>>@@ -1873,6 +1874,19 @@ match gfc_iso_c_sub_interface (gfc_code
>>> 		  gfc_error ("Missing SHAPE parameter for call to %s "
>>> 			     "at %L", sym->name, &(c->loc));
>>> 		}
>>>+              /* Make sure the param is a POINTER.  No need to make
>>> sure
>>>+                 it does not have INTENT(IN) since it is a POINTER.  */
>>>+              tmp_sym = c->ext.actual->next->expr->symtree->n.sym;
>>>+              if (tmp_sym != NULL)
>>>+                {
>>>+                  if (tmp_sym->attr.pointer != 1)
>>
>> I think that the convention is to fold both if statements into one:
>> if (tmp_sym && tmp_sym->attr.pointer != 1)
>>   {
>>>+                    {
>>>+                      gfc_error ("Argument '%s' to C_F_POINTER at %L "
>>>+                                 "must have the POINTER attribute",
>>>+                                 tmp_sym->name, &(c->loc));
>>>+                      m = MATCH_ERROR;
>>>+                    }
>>>+                }
>>> 	    }
>>> 	}
>>>
>>
>> cheers,
>>
>
>

Attachment: svn_diff_javadoc_ws.txt
Description: Text document


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