This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortan] Depricate -M<dir> in favour of -J<dir>
- From: Tobias Burnus <burnus at net-b dot de>
- To: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 29 Jan 2008 21:09:33 +0100
- Subject: [Patch, Fortan] Depricate -M<dir> in favour of -J<dir>
Daniel pointed out in IRC that we should deprecate the -M<dir> option as
we want eventually use -M to generate Makefile items (as GCC does, see
"man gcc").
The PR regarding using -M for makefiles is PR31588.
The attached patch does:
- Mark -M as deprecated in invoke.texi
- Change error message texts from "-M" to "-J"
- Fix an ICE if "-M" without argument has been specified as last argument
- Fix using "-M<dir>" - before only "-M <dir>" was working
- Print a warning that -M is deprecated
Currently, -J<dir> is supported while -J <dir> is not. I will fix this
after the regression-only period; a patch can be found in PR 35019.
Build and regtested on x86-64-linux.
OK for the trunk (4.3.0)?
Tobias
2008-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/31588
* gfortranspec.c (lang_specific_driver): Deprecate -M option;
if 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.c: Mark -M as depecated.
Index: gcc/fortran/gfortranspec.c
===================================================================
--- gcc/fortran/gfortranspec.c (revision 131933)
+++ gcc/fortran/gfortranspec.c (working copy)
@@ -426,7 +426,9 @@ For more information about these matters
{
char *p;
- if (argv[i][2] == '\0')
+ fprintf (stderr, _("Warning: Using -M <directory> is deprecated, "
+ "use -J instead\n"));
+ if (argv[i][2] == '\0' && i+1 < argc)
{
p = XNEWVEC (char, strlen (argv[i + 1]) + 2);
p[0] = '-';
@@ -437,7 +439,9 @@ For more information about these matters
else
{
p = XNEWVEC (char, strlen (argv[i]) + 1);
- strcpy (p, argv[i]);
+ p[0] = '-';
+ p[1] = 'J';
+ strcpy (&p[2], argv[i]);
}
append_arg (p);
continue;
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c (revision 131933)
+++ gcc/fortran/options.c (working copy)
@@ -389,13 +389,13 @@ gfc_handle_module_path_options (const ch
if (gfc_option.module_dir != NULL)
{
- gfc_status ("gfortran: Only one -M option allowed\n");
+ gfc_status ("gfortran: Only one -J option allowed\n");
exit (3);
}
if (arg == NULL)
{
- gfc_status ("gfortran: Directory required after -M\n");
+ gfc_status ("gfortran: Directory required after -J\n");
exit (3);
}
Index: gcc/fortran/invoke.texi
===================================================================
--- gcc/fortran/invoke.texi (revision 131933)
+++ gcc/fortran/invoke.texi (working copy)
@@ -627,8 +627,8 @@ 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}
+@item -M@var{dir}
@opindex @code{M}@var{dir}
@opindex @code{J}@var{dir}
@cindex paths, search
@@ -639,8 +639,7 @@ statement.
The default is the current directory.
-@option{-J} is an alias for @option{-M} to avoid conflicts with existing
-GCC options.
+Note: @option{-M} is deprecated to avoid conflicts with existing GCC options.
@item -fintrinsic-modules-path @var{dir}
@opindex @code{fintrinsic-modules-path} @var{dir}