[patch, fortran] Generate C prototypes from Fortran code
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Aug 1 17:39:00 GMT 2017
Hi Thomas,
This reminds me of project that I once started to translate fortran
into C using a similar option. I gave up in the end because I found it
more convenient to use a tree dump and modify the declarations by
hand. In respect of your query about suggestions, how about outputting
non_interop array descriptors?
Anyway, it looks good to me - OK for trunk.
Thanks
Paul
On 1 August 2017 at 16:08, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> here is a slight update on the patch, with the following changes:
>
> Fixed one ICE (yes, there was one)
>
> Added a bit to the documentation to recommend to edit
> function pointers
>
> Translates c_size_t into ssize_t now - we only have a signed
> type, unsigned makes little sense.
>
>
> OK for trunk?
>
> Regards
>
> Thomas
>
>> 2017-07-28 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.
>
>
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
More information about the Fortran
mailing list