Bug 90351 - -fc-prototypes does not dump prototypes for external procedures
Summary: -fc-prototypes does not dump prototypes for external procedures
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Thomas Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-05 08:10 UTC by Thomas Koenig
Modified: 2019-05-09 17:41 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-05-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2019-05-05 08:10:39 UTC
Came across this when looking at PR 90329. This is with recent trunk.

$ cat foo.f90
subroutine foo() BIND(C)
end subroutine foo
$ gfortran -c -fc-prototypes foo.f90
$ 

Probably looking at the wrong namespaces somewhere.
Comment 1 Thomas Koenig 2019-05-08 21:55:44 UTC
Author: tkoenig
Date: Wed May  8 21:55:13 2019
New Revision: 271018

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

    PR fortran/90351
    PR fortran/90329
    * gfortran.dg/dump-parse-tree.c: Include version.h.
    (gfc_dump_external_c_prototypes): New function.
    (get_c_type_name): Select "char" as a name for a simple char.
    Adjust to handling external functions. Also handle complex.
    (write_decl): Add argument bind_c. Adjust for dumping of external
    procedures.
    (write_proc): Likewise.
    (write_interop_decl): Add bind_c argument to call of write_proc.
    * gfortran.h: Add prototype for gfc_dump_external_c_prototypes.
    * lang.opt: Add -fc-prototypes-external flag.
    * parse.c (gfc_parse_file): Move dumping of BIND(C) prototypes.
    Call gfc_dump_external_c_prototypes if option is set.
    * invoke.texi: Document -fc-prototypes-external.


Modified:
    trunk/gcc/fortran/ChangeLog
    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 2 Thomas Koenig 2019-05-08 21:56:31 UTC
Fixed, closing.
Comment 3 Thomas Koenig 2019-05-09 17:41:01 UTC
Author: tkoenig
Date: Thu May  9 17:40:30 2019
New Revision: 271038

URL: https://gcc.gnu.org/viewcvs?rev=271038&root=gcc&view=rev
Log:
2019-05-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/90351
    PR fortran/90329
    * gfortran.dg/dump-parse-tree.c: Include version.h.
    (gfc_dump_external_c_prototypes): New function.
    (get_c_type_name): Select "char" as a name for a simple char.
    Adjust to handling external functions. Also handle complex.
    (write_decl): Add argument bind_c. Adjust for dumping of external
    procedures.
    (write_proc): Likewise.
    (write_interop_decl): Add bind_c argument to call of write_proc.
    * gfortran.h: Add prototype for gfc_dump_external_c_prototypes.
    * lang.opt: Add -fc-prototypes-external flag.
    * parse.c (gfc_parse_file): Move dumping of BIND(C) prototypes.
    Call gfc_dump_external_c_prototypes if option is set.
    * invoke.texi: Document -fc-prototypes-external.


Modified:
    branches/gcc-9-branch/gcc/fortran/ChangeLog
    branches/gcc-9-branch/gcc/fortran/dump-parse-tree.c
    branches/gcc-9-branch/gcc/fortran/gfortran.h
    branches/gcc-9-branch/gcc/fortran/invoke.texi
    branches/gcc-9-branch/gcc/fortran/lang.opt
    branches/gcc-9-branch/gcc/fortran/parse.c