re PR fortran/52313 (useless error message for old version of .mod file)
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 3 Mar 2012 20:59:58 +0000 (20:59 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 3 Mar 2012 20:59:58 +0000 (20:59 +0000)
PR fortran/52313
* module.c (gfc_use_module): Improve error messages.

From-SVN: r184864

gcc/fortran/ChangeLog
gcc/fortran/module.c

index 0234bed..b41da54 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/52313
+       * module.c (gfc_use_module): Improve error messages.
+
 2012-03-03  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/48820
index 36ef4f8..31d7de1 100644 (file)
@@ -6090,22 +6090,17 @@ gfc_use_module (gfc_use_list *module)
        parse_name (c);
       if ((start == 1 && strcmp (atom_name, "GFORTRAN") != 0)
          || (start == 2 && strcmp (atom_name, " module") != 0))
-       gfc_fatal_error ("File '%s' opened at %C is not a GFORTRAN module "
-                        "file", filename);
+       gfc_fatal_error ("File '%s' opened at %C is not a GNU Fortran"
+                        " module file", filename);
       if (start == 3)
        {
          if (strcmp (atom_name, " version") != 0
              || module_char () != ' '
-             || parse_atom () != ATOM_STRING)
-           gfc_fatal_error ("Parse error when checking module version"
-                            " for file '%s' opened at %C", filename);
-
-         if (strcmp (atom_string, MOD_VERSION))
-           {
-             gfc_fatal_error ("Wrong module version '%s' (expected '%s') "
-                              "for file '%s' opened at %C", atom_string,
-                              MOD_VERSION, filename);
-           }
+             || parse_atom () != ATOM_STRING
+             || strcmp (atom_string, MOD_VERSION))
+           gfc_fatal_error ("Cannot read module file '%s' opened at %C,"
+                            " because it was created by an older"
+                            " version of GNU Fortran", filename);
 
          free (atom_string);
        }