This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[patch, fortran] PR35156: deprecate -M


A very similar patch was already ok'ed [1], I just cleaned it up a bit. If 
there are no objections, I'll commit it on Tobias' behalf in 24 hours.


:ADDPATCH fortran:

2008-01-29  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.


Regression tested on i686-pc-linux-gnu.

Regards

	Daniel


[1] http://gcc.gnu.org/ml/fortran/2008-01/msg00366.html
Index: gfortranspec.c
===================================================================
--- gfortranspec.c	(revision 134566)
+++ gfortranspec.c	(working copy)
@@ -429,18 +429,27 @@ For more information about these matters
 	{
 	  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]) + 2);
+		  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: options.c
===================================================================
--- options.c	(revision 134566)
+++ options.c	(working copy)
@@ -391,10 +391,7 @@ gfc_handle_module_path_options (const ch
 {
 
   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);
Index: invoke.texi
===================================================================
--- invoke.texi	(revision 134566)
+++ invoke.texi	(working copy)
@@ -633,10 +633,10 @@ compiled modules are required by a @code
 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]