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]

[Fortran-Experiments]: patch for c_ptr/c_funptr


hi all,

i've attached a patch that does the following:
- convert the iso_c_binding derived types to void * ptrs.
- changed the procedures in iso_c_binding to expect void * ptrs and return them (if applicable).
- fixed whitespace and coding style issues in the
libgfortran/intrinsics/iso_c_* files.
- fixed a couple bugs listed on the wiki.
- new test cases.


the patch is fairly large, but the majority of it is simply whitespace and style changes in the libgfortran/intrinsics/iso_c_* files. the goal of this patch is to convert the iso_c_binding derived types into void ptrs. this patch should at least be a start to that.

bootstrapped and regtested on x86 with no new failures.

ChangeLog entry:

2007-03-07  Christopher D. Rickett  <crickett@lanl.gov>
	* gfortran.dg/c_funloc_tests_3.f03: New test case.
	* gfortran.dg/c_ptr_tests_7.f03: Ditto.
	* gfortran.dg/c_ptr_tests_8.f03: Ditto.
	* gfortran.dg/c_ptr_tests_9.f03: Ditto.
	* gfortran.dg/c_loc_tests_7.f03: Ditto.
	* gfortran.dg/c_funloc_tests_3_funcs.c: C functions for new test
	case c_funloc_tests_3.
	* gfortran.dg/binding_label_tests_14.f03: New test case.
	* gfortran.dg/c_ptr_tests_10.f03: Ditto.
	* gfortran.dg/c_ptr_tests_8_funcs.c: C functions for new test case
	c_ptr_tests_8.
	* gfortran.dg/c_ptr_tests_7_driver.c: C Driver for c_ptr_tests_7.
	* trans-expr.c (gfc_conv_initializer): Convert expressions that
	use C_NULL_PTR or C_NULL_FUNPTR to constant expressions for NULL.
	(gfc_conv_expr): Convert typespecs for iso_c_binding derived types
	to INTEGER(kind=gfc_index_integer_kind) (size of void *).
	* symbol.c (gen_special_c_interop_ptr): Create C_PTR or C_FUNPTR
	if not listed by user in only clause and are needed.
	(generate_isocbinding_symbol): Create C_PTR or C_FUNPTR if not
	listed by user in only clause and are needed.
	* decl.c (verify_c_interop_param): Report error for procedures
	that are not BIND(C) but need to be a C interoperable parameter.
	* trans-const.c (gfc_conv_constant): Convert expressions for
	C_NULL_PTR and C_NULL_FUNPTR to constant expressions for NULL.
	* trans-types.c (gfc_typenode_for_spec): Convert typespecs for
	iso_c_binding derived types.
	(gfc_get_derived_type): Set the backend_decl of the iso_c_binding
	derived types to ptr_type_nodes (void *), of type
	INTEGER(kind=gfc_index_integer_kind), and f90_type of BT_VOID.
	Removed code that was used when the tree for the iso_c_binding
	derived types represented derived types instead of ptr_type_node.
	* resolve.c (is_scalar_expr_ptr): Allow for arrays of size 1.
	(gfc_verify_binding_labels): Fixed ICE caused by NULL pointer.
	(resolve_fl_procedure): Clear the is_bind_c attribute if the
	symbol has an error (prevents duplicate messages).
	* trans-decl.c (gfc_create_module_variable): Make sure the
	typespecs for iso_c_binding derived types are converted for
	ptr_type_node.
	(generate_local_decl): Ditto.
	* trans-io.c (transfer_expr): Convert expressions for
	iso_c_binding derived types.
	* iso_c_generated_procs.c (c_f_pointer_i1): Made C pointer
	parameter of type (void *).  Fixed whitespace and coding style.
	(c_f_pointer_i2): Ditto.
	(c_f_pointer_i4): Ditto.
	(c_f_pointer_i8): Ditto.
	(c_f_pointer_i16): Ditto.
	(c_f_pointer_r4): Ditto.
	(c_f_pointer_r8): Ditto.
	(c_f_pointer_r10): Ditto.
	(c_f_pointer_r16): Ditto.
	* iso_c_binding.c (c_f_pointer): Made C pointer parameter of type
	(void *).  Fixed whitespace and coding style.
	(c_f_pointer_u0): Ditto.
	(c_f_pointer_d0): Ditto.
	(c_f_procpointer): Ditto.
	(c_associated_1): Ditto.  Converted return type to void *.
	(c_associated_2): Ditto.
	(c_loc): Ditto.
	(c_funloc): Ditto.
	* iso_c_binding.h: Updated prototypes.

Attachment: svn_diff_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]