This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/22552] Would like warning when an undeclared function is called



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-11-08 17:59 -------
I'm not sure about the wording, but the following patch does what you want:

Index: interface.c
===================================================================
--- interface.c (revision 129869)
+++ interface.c (working copy)
@@ -2216,12 +2216,16 @@ check_intents (gfc_formal_arglist *f, gf
 void
 gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
 {
-
-  /* Warn about calls with an implicit interface.  */
+  /* Warn about calls with an implicit interface, or to procedures not
+     explicitly declared.  */
   if (gfc_option.warn_implicit_interface
       && sym->attr.if_source == IFSRC_UNKNOWN)
     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
+          && sym->attr.if_source == IFSRC_UNKNOWN)
+    gfc_warning ("Procedure '%s' called at %L is not explicitly declared",
+                sym->name, where);

   if (sym->attr.if_source == IFSRC_UNKNOWN
       || !compare_actual_formal (ap, sym->formal, 0,


You also need to add the option in lang.opt and gfortran.h, and handle it in
options.c, of course ;-)


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
           Keywords|                            |patch
   Last reconfirmed|2005-12-30 19:42:48         |2007-11-08 17:59:32
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22552


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]