diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-03 16:09:18 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-03 16:09:18 +0000 |
commit | 8e6180019e60d0127a41c7d1de855a1977155a81 (patch) | |
tree | f7bb4780535beeba6d8a2220460dda826bff025e /gcc/fortran/symbol.c | |
parent | 6da66d757f299d67928b8067feed5b4359a222c0 (diff) | |
download | gcc-8e6180019e60d0127a41c7d1de855a1977155a81.tar.gz |
2012-03-03 Tobias Burnus <burnus@net-b.de>
* lang.opt (Wc-binding-type): New flag.
* options.c (gfc_init_options, gfc_handle_option): Handle it.
* invoke.texi (Wc-binding-type): Document it.
* gfortran.h (gfc_option_t): Add warn_c_binding_type.
* decl.c (verify_bind_c_sym): Handle -Wc-binding-type.
* symbol.c (gfc_set_default_type, verify_bind_c_derived_type):
Ditto.
2012-03-03 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/bind_c_dts_4.f03: Add dg-options -Wc-binding-type.
* gfortran.dg/bind_c_implicit_vars.f03: Ditto.
* gfortran.dg/bind_c_usage_8.f03: Ditto.
* gfortran.dg/c_kind_tests_2.f03: Ditto.
* gfortran.dg/class_30.f90: Remove dg-warning line.
* gfortran.dg/bind_c_usage_25.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184858 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 0cd7cc8d3e3..46e5f56feee 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -274,7 +274,7 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns) if (ts->type == BT_CHARACTER && ts->u.cl) sym->ts.u.cl = gfc_new_charlen (sym->ns, ts->u.cl); - if (sym->attr.is_bind_c == 1) + if (sym->attr.is_bind_c == 1 && gfc_option.warn_c_binding_type) { /* BIND(C) variables should not be implicitly declared. */ gfc_warning_now ("Implicitly declared BIND(C) variable '%s' at %L may " @@ -287,7 +287,8 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns) if (sym->ns->proc_name != NULL && (sym->ns->proc_name->attr.subroutine != 0 || sym->ns->proc_name->attr.function != 0) - && sym->ns->proc_name->attr.is_bind_c != 0) + && sym->ns->proc_name->attr.is_bind_c != 0 + && gfc_option.warn_c_binding_type) { /* Dummy args to a BIND(C) routine may not be interoperable if they are implicitly typed. */ @@ -3694,7 +3695,8 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym) recompiles with different flags (e.g., -m32 and -m64 on x86_64 and using integer(4) to claim interop with a C_LONG). */ - if (derived_sym->attr.is_bind_c == 1) + if (derived_sym->attr.is_bind_c == 1 + && gfc_option.warn_c_binding_type) /* If the derived type is bind(c), all fields must be interop. */ gfc_warning ("Component '%s' in derived type '%s' at %L " @@ -3702,7 +3704,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym) "derived type '%s' is BIND(C)", curr_comp->name, derived_sym->name, &(curr_comp->loc), derived_sym->name); - else + else if (gfc_option.warn_c_binding_type) /* If derived type is param to bind(c) routine, or to one of the iso_c_binding procs, it must be interoperable, so all fields must interop too. */ |