aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2009-12-27 09:30:57 +0000
committerDaniel Kraft <domob@gcc.gnu.org>2009-12-27 10:30:57 +0100
commitca071303a504199e2ded9caad0d441196ede757b (patch)
treef5dbe5c613b211c7d20ee051b0b26433da3aca76 /gcc/fortran/interface.c
parent6f352c3a70dffef99f478c25b48e64c8ab4de991 (diff)
downloadgcc-ca071303a504199e2ded9caad0d441196ede757b.zip
gcc-ca071303a504199e2ded9caad0d441196ede757b.tar.gz
gcc-ca071303a504199e2ded9caad0d441196ede757b.tar.bz2
re PR fortran/22552 (Would like warning when an undeclared function is called)
2009-12-27 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> Daniel Kraft <d@domob.eu> PR fortran/22552 * lang.opt (Wimplicit-procedure): New option. * gfortran.h (struct gfc_option_t): New member `warn_implicit_procedure' * options.c (gfc_handle_option): Handle -Wimplicit-procedure. * interface.c (gfc_procedure_use): Warn about procedure never explicitly declared if requested by the new flag. * invoke.texi: Document new flag -Wimplicit-procedure. 2009-12-27 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> Daniel Kraft <d@domob.eu> PR fortran/22552 * gfortran.dg/warn_implicit_procedure_1.f90: New test. Co-Authored-By: Daniel Kraft <d@domob.eu> From-SVN: r155479
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 866a81c..0034f75 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2380,12 +2380,18 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
/* Warn about calls with an implicit interface. Special case
for calling a ISO_C_BINDING becase c_loc and c_funloc
- are pseudo-unknown. */
- if (gfc_option.warn_implicit_interface
- && sym->attr.if_source == IFSRC_UNKNOWN
- && ! sym->attr.is_iso_c)
- gfc_warning ("Procedure '%s' called with an implicit interface at %L",
- sym->name, where);
+ are pseudo-unknown. Additionally, warn about procedures not
+ explicitly declared at all if requested. */
+ if (sym->attr.if_source == IFSRC_UNKNOWN && ! sym->attr.is_iso_c)
+ {
+ if (gfc_option.warn_implicit_interface)
+ gfc_warning ("Procedure '%s' called with an implicit interface at %L",
+ sym->name, where);
+ else if (gfc_option.warn_implicit_procedure
+ && sym->attr.proc == PROC_UNKNOWN)
+ gfc_warning ("Procedure '%s' called at %L is not explicitly declared",
+ sym->name, where);
+ }
if (sym->attr.if_source == IFSRC_UNKNOWN)
{