Bug 45435 - Automatically generate C interop interface blocks from C code
Summary: Automatically generate C interop interface blocks from C code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-27 23:04 UTC by Thomas Koenig
Modified: 2017-10-01 06:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-08-28 07:26:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2010-08-27 23:04:05 UTC
It would be nice for to automatically generate Fortran
interface blocks from the C source.

Something like

gfortran -fgenerate-c-interop-blocks foo.c
Comment 1 Daniel Kraft 2010-08-28 07:26:48 UTC
I agree, this is also something I thought about in the past.  And to be complete, we could also just do the other way round?
Comment 2 Thomas Koenig 2017-08-01 17:59:44 UTC
Author: tkoenig
Date: Tue Aug  1 17:59:11 2017
New Revision: 250791

URL: https://gcc.gnu.org/viewcvs?rev=250791&root=gcc&view=rev
Log:
2017-08-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45435
	* lang.opt (fc-prototypes): Add option.
	* gfortran.h (gfc_typespec): Add interop_kind to struct.
	(gfc_dump_c_prototypes): Add prototype.
	* decl.c (gfc_match_kind_spec): Copy symbol used for kind to typespec.
	* parse.c (gfc_parse_file): Call gfc_dump_prototypes.
	* dump-parse-tree.c (gfc_dump_c_prototypes): New function.
	(type_return): New enum.
	(get_c_type_name): New function.
	(write_decl): New function.
	(write_type): New function.
	(write_variable): New function.
	(write_proc): New function.
	(write_interop_decl): New function.
	* invoke.texi: Document -fc-prototypes.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/parse.c
Comment 3 Aldy Hernandez 2017-09-13 16:17:16 UTC
Author: aldyh
Date: Wed Sep 13 16:16:45 2017
New Revision: 252235

URL: https://gcc.gnu.org/viewcvs?rev=252235&root=gcc&view=rev
Log:
2017-08-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/45435
	* lang.opt (fc-prototypes): Add option.
	* gfortran.h (gfc_typespec): Add interop_kind to struct.
	(gfc_dump_c_prototypes): Add prototype.
	* decl.c (gfc_match_kind_spec): Copy symbol used for kind to typespec.
	* parse.c (gfc_parse_file): Call gfc_dump_prototypes.
	* dump-parse-tree.c (gfc_dump_c_prototypes): New function.
	(type_return): New enum.
	(get_c_type_name): New function.
	(write_decl): New function.
	(write_type): New function.
	(write_variable): New function.
	(write_proc): New function.
	(write_interop_decl): New function.
	* invoke.texi: Document -fc-prototypes.

Modified:
    branches/range-gen2/gcc/fortran/ChangeLog
    branches/range-gen2/gcc/fortran/decl.c
    branches/range-gen2/gcc/fortran/dump-parse-tree.c
    branches/range-gen2/gcc/fortran/gfortran.h
    branches/range-gen2/gcc/fortran/invoke.texi
    branches/range-gen2/gcc/fortran/lang.opt
    branches/range-gen2/gcc/fortran/parse.c
Comment 4 Thomas Koenig 2017-10-01 06:59:49 UTC
Done, closing.