re PR fortran/35156 ([patch] Deprecate -M<dir>)
authorTobias Burnus <burnus@net-b.de>
Fri, 25 Apr 2008 21:14:49 +0000 (23:14 +0200)
committerDaniel Franke <dfranke@gcc.gnu.org>
Fri, 25 Apr 2008 21:14:49 +0000 (17:14 -0400)
2008-04-25  Tobias Burnus  <burnus@net-b.de>
            Daniel Franke <franke.daniel@gmail.com>

PR fortran/35156
        * gfortranspec.c (lang_specific_driver): Deprecate
        -M option; fix ICE when "-M" is last argument and
        make "-M<dir>" work.
        * options.c (gfc_handle_module_path_options):
        Use -J instead of -M in error messages.
        * invoke.texi: Mark -M as depecated.

Co-Authored-By: Daniel Franke <franke.daniel@gmail.com>
From-SVN: r134680

gcc/fortran/ChangeLog
gcc/fortran/gfortranspec.c
gcc/fortran/invoke.texi
gcc/fortran/options.c

index 4de64f1..b469063 100644 (file)
@@ -1,3 +1,14 @@
+2008-04-25  Tobias Burnus  <burnus@net-b.de>
+           Daniel Franke <franke.daniel@gmail.com>
+
+       PR fortran/35156
+       * gfortranspec.c (lang_specific_driver): Deprecate
+       -M option; fix ICE when "-M" is last argument and
+       make "-M<dir>" work.
+       * options.c (gfc_handle_module_path_options): 
+       Use -J instead of -M in error messages.
+       * invoke.texi: Mark -M as depecated.
+
 2008-04-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
            Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
index 5f3a8d7..4a7d02f 100644 (file)
@@ -429,18 +429,27 @@ For more information about these matters, see the file named COPYING\n\n"));
        {
          char *p;
 
+         fprintf (stderr, _("Warning: Using -M <directory> is deprecated, "
+                  "use -J instead\n"));
          if (argv[i][2] == '\0')
            {
-             p = XNEWVEC (char, strlen (argv[i + 1]) + 2);
-             p[0] = '-';
-             p[1] = 'J';
-             strcpy (&p[2], argv[i + 1]);
-             i++;
+             if (i+1 < argc)
+               {
+                 p = XNEWVEC (char, strlen (argv[i + 1]) + 3);
+                 p[0] = '-';
+                 p[1] = 'J';
+                 strcpy (&p[2], argv[i + 1]);
+                 i++;
+               }
+             else
+               fatal ("argument to '%s' missing", argv[i]);
            }
          else
            {
              p = XNEWVEC (char, strlen (argv[i]) + 1);
-             strcpy (p, argv[i]);
+             p[0] = '-';
+             p[1] = 'J';
+             strcpy (&p[2], argv[i] + 2);
            }
          append_arg (p);
          continue;
index 2bac12c..712aa21 100644 (file)
@@ -633,10 +633,10 @@ compiled modules are required by a @code{USE} statement.
 gcc,Using the GNU Compiler Collection (GCC)}, for information on the
 @option{-I} option.
 
-@item -M@var{dir}
 @item -J@var{dir}
-@opindex @code{M}@var{dir}
+@item -M@var{dir}
 @opindex @code{J}@var{dir}
+@opindex @code{M}@var{dir}
 @cindex paths, search
 @cindex module search path
 This option specifies where to put @file{.mod} files for compiled modules.
@@ -645,8 +645,7 @@ statement.
 
 The default is the current directory.
 
-@option{-J} is an alias for @option{-M} to avoid conflicts with existing
-GCC options.
+@option{-M} is deprecated to avoid conflicts with existing GCC options.
 
 @item -fintrinsic-modules-path @var{dir}
 @opindex @code{fintrinsic-modules-path} @var{dir}
index 06a4622..a1020bf 100644 (file)
@@ -391,10 +391,7 @@ gfc_handle_module_path_options (const char *arg)
 {
 
   if (gfc_option.module_dir != NULL)
-    gfc_fatal_error ("gfortran: Only one -M option allowed");
-
-  if (arg == NULL)
-    gfc_fatal_error ("gfortran: Directory required after -M");
+    gfc_fatal_error ("gfortran: Only one -J option allowed");
 
   gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
   strcpy (gfc_option.module_dir, arg);
@@ -718,14 +715,13 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       break;
 
     case OPT_J:
-    case OPT_M:
       gfc_handle_module_path_options (arg);
       break;
-    
+
     case OPT_fsign_zero:
       gfc_option.flag_sign_zero = value;
       break;
-    
+
     case OPT_ffpe_trap_:
       gfc_handle_fpe_trap_option (arg);
       break;