]> git.ipfire.org Git - thirdparty/gcc.git/commit
Allow CFI_cdesc_t in argument lists with -fc-prototypes.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 8 Jan 2025 16:06:31 +0000 (17:06 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 16 Jan 2025 19:09:18 +0000 (20:09 +0100)
commitc158f36027c316aedaa7bde83ca28a3365721fce
treef30f26f5ce61c293865264e29f9921f4adee9346
parent7f8bb6498691cace5cced224bfc72d13724c9b82
Allow CFI_cdesc_t in argument lists with -fc-prototypes.

This patch fixes and reorganizes dumping C prototypes.  It makes the following
changes:

- BIND(C) types are now always output before any global symbols
- CFI_cdesc_t is issued for assumed shape and assumed rank arguments.
- BIND(C,NAME="...") entities were not always issued.

gcc/fortran/ChangeLog:

PR fortran/118359
* dump-parse-tree.cc (show_external_symbol): New function.
(write_type): Add prototype, put in restrictions on what not to dump.
(has_cfi_cdesc): New function.
(need_iso_fortran_binding): New function.
(gfc_dump_c_prototypes): Adjust to take only a file output.  Add
"#include <ISO_Fortran_binding.h" if CFI_cdesc_t is found.
Traverse global namespaces to dump types and the globalsymol list
to dump external symbols.
(gfc_dump_external_c_prototypes): Traverse global namespaces.
(get_c_type_name): Handle CFI_cdesc_t.
(write_proc): Also pass array spec to get_c_type_name.
* gfortran.h (gfc_dump_c_prototypes): Adjust prototype.
* parse.cc (gfc_parse_file): Adjust call to gfc_dump_c_prototypes.
gcc/fortran/dump-parse-tree.cc
gcc/fortran/gfortran.h
gcc/fortran/parse.cc