Patchwork Fix -MD/-MMD interface difference between driver and cc1/f951 etc.

login
register
mail settings
Submitter Joseph S. Myers
Date Aug. 12, 2010, 12:52 a.m.
Message ID <Pine.LNX.4.64.1008120051040.13600@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/61525/
State New
Headers show

Comments

Joseph S. Myers - Aug. 12, 2010, 12:52 a.m.
When fixing incompatibilities between whether particular options take
arguments in the driver and in the compilers proper
<http://gcc.gnu.org/ml/gcc-patches/2010-07/msg02225.html>
<http://gcc.gnu.org/ml/gcc-patches/2010-07/msg02340.html>, I missed
that this issue also applied to the -MD and -MMD options and found
that in the course of testing the patch to make the driver use shared
option processing machinery.

This patch fixes this issue by changing the internal options (taking
arguments) used by cc1 etc. to -MDX and -MMDX, leaving the external
options (to the driver, not taking arguments) unchanged.  (The
alternative of using -MD= and -MMD= runs into issues with specs
generating separate arguments in some cases when not desired.)

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit (the driver and Fortran pieces)?

2010-08-12  Joseph Myers  <joseph@codesourcery.com>

	* gcc.c (cpp_unique_options): Generate -MDX and -MMDX from -MD and
	-MMD.

c-family:
2010-08-12  Joseph Myers  <joseph@codesourcery.com>

	* c.opt (MD, MMD): Change to MDX and MMDX.
	* c-opts.c (c_common_handle_option): Use OPT_MMD and OPT_MMDX.

fortran:
2010-08-12  Joseph Myers  <joseph@codesourcery.com>

	* lang.opt (MD, MMD): Change to MDX and MMDX.
	* cpp.c (gfc_cpp_handle_option): Use OPT_MMD and OPT_MMDX.
Steve Kargl - Aug. 12, 2010, 1:39 a.m.
On Thu, Aug 12, 2010 at 12:52:17AM +0000, Joseph S. Myers wrote:
> 
> fortran:
> 2010-08-12  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* lang.opt (MD, MMD): Change to MDX and MMDX.
> 	* cpp.c (gfc_cpp_handle_option): Use OPT_MMD and OPT_MMDX.
> 

The Fortran bits are ok.
Alan Modra - Aug. 14, 2010, 11:59 p.m.
On Thu, Aug 12, 2010 at 12:52:17AM +0000, Joseph S. Myers wrote:
> 	* cpp.c (gfc_cpp_handle_option): Use OPT_MMD and OPT_MMDX.

This happens to break all linux-2.6.x and at least some linux-2.5.x
kernel builds, which use -Wp,-MD,...
Andrew Pinski - Aug. 15, 2010, midnight
On Sat, Aug 14, 2010 at 4:59 PM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Aug 12, 2010 at 12:52:17AM +0000, Joseph S. Myers wrote:
>>       * cpp.c (gfc_cpp_handle_option): Use OPT_MMD and OPT_MMDX.
>
> This happens to break all linux-2.6.x and at least some linux-2.5.x
> kernel builds, which use -Wp,-MD,...

This has already been fixed. See
http://gcc.gnu.org/ml/gcc-patches/2010-08/msg01048.html .

Thanks,
Andrew Pinski

Patch

Index: c-family/c.opt
===================================================================
--- c-family/c.opt	(revision 163095)
+++ c-family/c.opt	(working copy)
@@ -72,9 +72,9 @@  M
 C ObjC C++ ObjC++
 Generate make dependencies
 
-MD
+MDX
 C ObjC C++ ObjC++ Separate MissingArgError(missing filename after %qs)
-Generate make dependencies and compile
+-MD	Generate make dependencies and compile
 
 MF
 C ObjC C++ ObjC++ Joined Separate MissingArgError(missing filename after %qs)
@@ -88,9 +88,9 @@  MM
 C ObjC C++ ObjC++
 Like -M but ignore system header files
 
-MMD
+MMDX
 C ObjC C++ ObjC++ Separate MissingArgError(missing filename after %qs)
-Like -MD but ignore system header files
+-MMD	Like -MD but ignore system header files
 
 MP
 C ObjC C++ ObjC++
Index: c-family/c-opts.c
===================================================================
--- c-family/c-opts.c	(revision 163095)
+++ c-family/c-opts.c	(working copy)
@@ -398,9 +398,9 @@  c_common_handle_option (size_t scode, co
       flag_no_output = 1;
       break;
 
-    case OPT_MD:
-    case OPT_MMD:
-      cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
+    case OPT_MDX:
+    case OPT_MMDX:
+      cpp_opts->deps.style = (code == OPT_MDX ? DEPS_SYSTEM: DEPS_USER);
       cpp_opts->deps.need_preprocessor_output = true;
       deps_file = arg;
       break;
Index: gcc.c
===================================================================
--- gcc.c	(revision 163095)
+++ gcc.c	(working copy)
@@ -829,8 +829,8 @@  static const char *trad_capable_cpp =
    file that happens to exist is up-to-date.  */
 static const char *cpp_unique_options =
 "%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I\
- %{MD:-MD %{!o:%b.d}%{o*:%.d%*}}\
- %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
+ %{MD:-MDX %{!o:%b.d}%{o*:%.d%*}}\
+ %{MMD:-MMDX %{!o:%b.d}%{o*:%.d%*}}\
  %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
  %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
  %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\
Index: fortran/cpp.c
===================================================================
--- fortran/cpp.c	(revision 163095)
+++ fortran/cpp.c	(working copy)
@@ -456,11 +456,11 @@  gfc_cpp_handle_option (size_t scode, con
       gfc_cpp_option.deps = 1;
       break;
 
-    case OPT_MMD:
+    case OPT_MMDX:
       gfc_cpp_option.deps_skip_system = 1;
       /* fall through */
 
-    case OPT_MD:
+    case OPT_MDX:
       gfc_cpp_option.deps = 1;
       gfc_cpp_option.deps_filename = arg;
       break;
Index: fortran/lang.opt
===================================================================
--- fortran/lang.opt	(revision 163095)
+++ fortran/lang.opt	(working copy)
@@ -60,7 +60,7 @@  M
 Fortran
 ; Documented in C
 
-MD
+MDX
 Fortran Separate
 ; Documented in C
 
@@ -76,7 +76,7 @@  MM
 Fortran
 ; Documented in C
 
-MMD
+MMDX
 Fortran Separate
 ; Documented in C